netdev
[Top] [All Lists]

Re: af_packet bug?

To: kuznet@xxxxxxxxxxxxx
Subject: Re: af_packet bug?
From: Lars Brinkhoff <lars.spam@xxxxxxxxxx>
Date: 30 Oct 2001 08:39:13 +0100
Cc: netdev@xxxxxxxxxxx
In-reply-to: <200110291843.VAA01641@xxxxxxxxxxxxx>
Organization: nocrew
References: <200110291843.VAA01641@xxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
kuznet@xxxxxxxxxxxxx writes:
> Lars Brinkhoff writes:
> > I have an application that sends raw ethernet frames to a network
> > interface using the af_packet module.  This works well except when
> > sending a packet intended for the host that the application is
> > running on.  Apparently the outbound frame is never considered for
> > input to the TCP/IP stack.  Is this considered a bug or a feature?
> 
> Neither or them. It is simply the only expected behaviour.  Ethernet
> is simplex media, it does not hear itself and it is impossible to
> talk to self using it.  Apparently you want to send to loopback.

The application is in fact a computer emulator.  Among other things,
the emulator emulates a network interface using the af_packet
facility.  The emulator can run an operating system with a TCP/IP
stack, and the emulated machine will have a different IP number than
the Linux host.

The emulated machine communicates with other network hosts by sending
ethernet packets using af_packet.  But since this doesn't work for
talking to the host machine the emulator is running on, the emulator
must strip off the ethernet header and send those packets to the
loopback device.  Does that sound like a plausible solution?

-- 
Lars Brinkhoff          http://lars.nocrew.org/     Linux, GCC, PDP-10
Brinkhoff Consulting    http://www.brinkhoff.se/    programming

<Prev in Thread] Current Thread [Next in Thread>