> 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