problem with ethernet loopback test using loopback plug/stub: receiving socket not se
we are writing socket application to send UDP packets out from eth1
and loop it back to
the same interface using loopback stub to verify the hardware without
using external
devices/ports. The sending and receiving port are the same.
our target machine has eth0 configured as 15.6.xx.xx and eth1
configured as 16.6.6.6.
the listening socket is listing on all ip.
.
When we looked at the packet in the tx code of the driver, we have
observed that the packet passed down from the ip stack has the same
MAC address for both source and destination. Also when packet is
returning, its ip source and destination are the same as the
transmitting packet, which is to be expected.
The outgoing packet on eth1 has ip address of 16.6.10.10.
1. Is this type of loopback possible under linux?
2 If not, what if we were to use raw socket to bypass ip stack? can the destination then be 16.6.6.6, and the packet will be delivered to the driver as opposed to being loopbacked at the ip stack?
3. is there a similar code that we can leverage?
4. the returning (incoming) packet is lost after the driver passes it
to the ip stack. The receving socket is not able to retrieve packets
the driver receives.
What could be some of the issues?
Thank you in advance.
|