LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   problem with ethernet loopback test using loopback plug/stub: receiving socket not se (http://www.linuxquestions.org/questions/linux-kernel-70/problem-with-ethernet-loopback-test-using-loopback-plug-stub-receiving-socket-not-se-826922/)

mcha 08-18-2010 01:52 AM

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.

nini09 08-18-2010 06:27 PM

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?

marco18 08-18-2010 08:13 PM

Quote:

Originally Posted by mcha (Post 4069855)
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.

As far as I know loopback addresses are by default from 127.0.0.1 to 127.255.255.254 (Class A). Perhaps there is a way to configure a virtual interface with IP address 16.6.6.6 to work as a loopback.

mcha 08-26-2010 11:28 AM

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 04:34 AM.