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
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 18.104.22.168.
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 22.214.171.124.
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 126.96.36.199, 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.
Sound's like you already try it. What problem do you got?
Ideally, if the program is socket application and destination IP address in packet is interface IP address. The packet should go to loopback interface instead of real hardware device. If destination IP address in packet is another IP address but in same subnetwork, what's MAC address of that IP address?
i found out that if i send data packet via socket using AF_PACKET protocol, then i can bypass TCP/IP stack; this is exactly what i need.
thank you everyone for you help.
|All times are GMT -5. The time now is 06:49 AM.|