[SOLVED] problem with ethernet loopback test using loopback plug/stub: receiving socket not se
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.