LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-25-2011, 03:37 AM   #1
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Rep: Reputation: 16
Why is there no function for packet reception in linux loopback network interface ?


Normally any network driver should provide a function or should implement an interrupt for the packet reception however /drivers/net/loopback.c which is the source code for linux network loopback interface does not contain any mechanism to implement packet reception.

How does it function without an exclusive reception mechanism?
 
Old 08-26-2011, 02:16 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,850

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by avee137 View Post
Normally any network driver should provide a function or should implement an interrupt for the packet reception however /drivers/net/loopback.c which is the source code for linux network loopback interface does not contain any mechanism to implement packet reception.

How does it function without an exclusive reception mechanism?
Where would it be receiving from? The loopback driver does not have any associated hardware; send and receive are the same thing.
 
1 members found this post helpful.
Old 08-27-2011, 12:37 AM   #3
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Even though it does not have any h/w ,It sends packets to itself and that has to be received and sent up the protocol stack to the application layer. When we use ping we get reply as below:
Code:
avi@linux-inng:~/cscope> ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.043 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.038 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=64 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=64 time=0.039 ms
^C
--- 127.0.0.1 ping statistics ---
14 packets transmitted, 14 received, 0% packet loss, time 13000ms
rtt min/avg/max/mdev = 0.031/0.044/0.051/0.006 ms
 
Old 08-27-2011, 12:39 AM   #4
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Even though it does not have any h/w ,It sends packets to itself and that has to be received and sent up the protocol stack to the application layer. When we use ping we get reply as below:
Code:
avi@linux-inng:~/cscope> ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.043 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.038 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=64 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=64 time=0.039 ms
^C
--- 127.0.0.1 ping statistics ---
14 packets transmitted, 14 received, 0% packet loss, time 13000ms
rtt min/avg/max/mdev = 0.031/0.044/0.051/0.006 ms
it clearly shows 14 packets transmitted, 14 received.

so there must be some exclusive mechanism at work. Which does not appear anywhere in cource code loopback.c .
 
  


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
loopback network interface driver location avee137 Linux - Newbie 5 10-04-2016 02:08 PM
Virtual network driver packet reception j-osh Linux - Kernel 1 02-13-2010 06:08 AM
Bypassing packet reception path dodo76 Linux - Networking 2 10-28-2009 09:40 AM
Why packet incoming interface (sk_buff->dev) effects application reception? farkeu Linux - Networking 1 08-22-2009 07:11 PM
packet reception by virtual network interface seeker321in Linux - Networking 0 04-19-2002 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration