netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: N N Ashok <nalkunda@cse.msu.edu>
To: netdev@oss.sgi.com, linux-net@vger.kernel.org
Subject: Casting (struct rtable*) to (struct dst_entry*)
Date: Wed, 19 Mar 2003 23:55:02 -0500	[thread overview]
Message-ID: <200303192355.02509.nalkunda@cse.msu.edu> (raw)

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

             reply	other threads:[~2003-03-20  4:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20  4:55 N N Ashok [this message]
2003-03-20  4:59 ` Casting (struct rtable*) to (struct dst_entry*) David S. Miller
2003-03-20  5:27   ` N N Ashok
2003-03-20  5:33     ` David S. Miller
2003-03-20  6:02       ` N N Ashok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200303192355.02509.nalkunda@cse.msu.edu \
    --to=nalkunda@cse.msu.edu \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).