LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-18-2010, 01:52 AM   #1
mcha
LQ Newbie
 
Registered: Feb 2010
Posts: 10

Rep: Reputation: 0
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.
 
Old 08-18-2010, 06:27 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
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?
 
Old 08-18-2010, 08:13 PM   #3
marco18
Member
 
Registered: Jul 2007
Location: Argentina
Distribution: Ubuntu 13.04 , Debian Lenny 5.0.7
Posts: 223

Rep: Reputation: 21
Quote:
Originally Posted by mcha View Post
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.
 
Old 08-26-2010, 11:28 AM   #4
mcha
LQ Newbie
 
Registered: Feb 2010
Posts: 10

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PF_PACKET socket bind() to loopback interface (lo) cwpetersen Linux - Networking 0 03-17-2009 12:02 PM
ethernet loopback anjana Linux - Networking 1 04-04-2008 06:54 AM
c code to make a socket mirror (loopback) saavik Programming 2 08-16-2007 12:55 AM
help for the NIC loopback test functions dfengui Linux - Networking 1 06-17-2007 05:43 PM
Internal loopback test process cdcshu Linux - Networking 0 02-01-2007 09:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration