Re: Tracing IPv6 packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avinash Ramanath wrote:
Jay,

You can do an identifier search of "ipv6_rcv" on lxr.linux.no, and
then you will find the a ipv6_packet_type has the structure:
60 static struct packet_type ipv6_packet_type = {
61         .type = __constant_htons(ETH_P_IPV6),
62         .func = ipv6_rcv,
63 };

Then search for ipv6_packet_type:
You will see that it is added by the device in:
696 void __init ipv6_packet_init(void)
697 {
698         dev_add_pack(&ipv6_packet_type);
699 }

Now search for dev_add_pack; you will see that list_add_rcu is invoked:
272 void dev_add_pack(struct packet_type *pt)
273 {
274         int hash;
275
276         spin_lock_bh(&ptype_lock);
277         if (pt->type == htons(ETH_P_ALL)) {
278                 netdev_nit++;
279                 list_add_rcu(&pt->list, &ptype_all);
280         } else {
281                 hash = ntohs(pt->type) & 15;
282                 list_add_rcu(&pt->list, &ptype_base[hash]);
283         }
284         spin_unlock_bh(&ptype_lock);
285 }

Now search for netif_receive_skb; (invoked when an skb is queued):
This effectively calls deliver_skb (which pushes the packet up the stack)
Now look for deliver_skb; you will find that it will call:
1559         return pt_prev->func(skb, skb->dev, pt_prev);

So now ipv6_rcv would be called if it is an IPv6 packet.

Ok now the packet can finally take the flow for a regular IPv6 packet! :-)

Thanks to all of you who replied.  I appreciate it.

Jay

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux