Casting (struct rtable*) to (struct dst_entry*)

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

 



Hi,
   I have been looking at the networking code of Linux for my Masters thesis. 
I observed the following:
In ip_route_input(), if a route is found in the cache, the skb->dst is setup 
with the route found by casting the rtable entry to dst_entry:
	skb->dst = (struct dst_entry*)rth;

Later in ip_route_input(), skb->dst->input() is called:
	return skb->dst->input(skb);

In ip_forward(), skb->dst is again casted to rtable:
	rt = (struct rtable*)skb->dst;

I am unable to understand how a rtable structure casted to dst_entry will give 
a correct pointer to the input() function. I looked at the fields in rtable 
and dst_entry, the fields in the structures are cannot be lined up (the 
fourth field in rtable is not the same type as the fourth field in 
dst_entry). 

Can anybody help me understand this casting of rtable to dst_entry and then 
back to rtable?

Thanks,
Ashok
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux