kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: ddvlad@herebedragons.ro (Vlad Dogaru)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How do we determine IP Address of interface the packet arrived on
Date: Wed, 24 Sep 2014 10:41:54 +0300	[thread overview]
Message-ID: <20140924074154.GB6880@vdogaru> (raw)
In-Reply-To: <CAHzLHWrsqOeCPaj_EZGOJLhrU=3K+tbQdmaeEdX8wrq1T=0Uzw@mail.gmail.com>

On Wed, Sep 24, 2014 at 10:19:34AM +0530, Maninder Singh wrote:
> Hi,
> 
> Each time a packet arrives at a router in a subnet during transit, I
> need to determine the IP address of the incoming interface of the
> router for that packet. I have a netfilter kernel module running at
> each router but I dont understand which data structure will give me
> thw IP address. Can someone please suggest how shall I get that?

An interface can have more than one IP address, so your question is a
little strange.

However, you can find out all the IPv4 addresses a particular device has
by iterating through dev->ip_ptr->ifa_list.

Hope this helps,
Vlad

  reply	other threads:[~2014-09-24  7:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  4:49 How do we determine IP Address of interface the packet arrived on Maninder Singh
2014-09-24  7:41 ` Vlad Dogaru [this message]
2014-09-24 12:03   ` 정현
2014-09-24 12:24     ` Valdis.Kletnieks at vt.edu
2014-09-24 14:08   ` John de la Garza
2014-09-24 16:22     ` Valdis.Kletnieks at vt.edu
2014-09-24 16:34   ` Jeff Haran
2014-09-25  3:14   ` maninder.tiet at gmail.com
2014-09-24 12:25 ` Valdis.Kletnieks at vt.edu
2014-09-25  3:20   ` Maninder Singh

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=20140924074154.GB6880@vdogaru \
    --to=ddvlad@herebedragons.ro \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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).