LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   TCP/IP Packet sending Resolve ARP (https://www.linuxquestions.org/questions/linux-networking-3/tcp-ip-packet-sending-resolve-arp-285739/)

cranium2004 02-03-2005 07:19 AM

TCP/IP Packet sending Resolve ARP
 
Hello,
In Linux kernel by adding debug statement i observe that if i ping to host 10.0.0.5 with 10 packets then first i know network stack require to resolve hosts IP to its Hardware ID by sending ARP on Ethernet LAN.
But then what i get that if i again ping for another 10 packets to 10.0.0.5 then ARP routine is called.
Why? Why linux kernel is not caching it. Infact its caching i check it in debug statements then why network stack require to resolve 10.0.0.5 host to send packets to it?

Also i want to know once eth_header_cache called then all successive packet to that cache host goes directly from hh->hh_output(skb) to hard_start_xmit?
regards,
cranium.

cowanrl 02-03-2005 12:19 PM

I would imagine that the kernel will always call the arp routine before it transmits a TCP/IP packet. When the arp routine is called, the first thing it would do is check the arp table. If it finds an entry there that satisfies it, it will not broadcast arp packets. If it doesn't find an entry in the arp table, it will broadcast for it.

Have you checked to see if the second time you ping 10.0.0.5 it's actually transmitting the arp packets over the network? The best way to tell is with a packet sniffer such as Ethereal.

From my experience, as long as the ip address to MAC address mapping is in the arp table, the TCP/IP stack will not broadcast for it.

jspaar 02-03-2005 07:10 PM

Cowanrl's experiment will prove that arp caching works as expected.

Quote:

Also i want to know once eth_header_cache called then all successive packet to that cache host goes directly from hh->hh_output(skb) to hard_start_xmit?
I think the answer is yes. I'm no expert on the code, but you can see in net/ipv4/ip_output.c in ip_finish_output2(), if a cached hardware header is there, hh_output() will be called, which will call hard_start_xmit() via core/dev.c/dev_queue_xmit().

Otherwise (no cached hardware header), core/neighbour.c/neigh_resolve_output() will be invoked, generating arp requests.

cranium2004 02-03-2005 09:40 PM

Hello jaspar,
Quote:

I think the answer is yes. I'm no expert on the code, but you can see in net/ipv4/ip_output.c in ip_finish_output2(), if a cached hardware header is there, hh_output() will be called, which will call hard_start_xmit() via core/dev.c/dev_queue_xmit().
As you said i agree but i am not seeing any flow in dev_queue_xmit. I have added debug statements in that functions to print flow info but i got flow debug statements directly from hh_output to hard_start_xmit. Is that workings for packets once their hardware header get cache?


All times are GMT -5. The time now is 02:40 PM.