mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: How to get a local IPv4 address from within a kernel module?
Date: Wed, 30 Oct 2002 18:38:21 -0800	[thread overview]
Message-ID: <20021031023821.GA2156@bougret.hpl.hp.com> (raw)

Juan Gomez wrote :
> 
> Is there any standard way of doing this? I looked into ipv4 code but I did
> not find a function that would provide a direct, clean way to query the
> local IPv4 addresses of a given node.

	There is no such thing as the local IPv4 addresses of a given
node. IP addresses are assigned for each network interfaces, so you
may have more than one IP address. Note that I have many systems that
don't have any "eth0" and still have many IP addresses (on wlan0,
ppp0, bnep0...).
	On top of that, the DNS may assign an IP address that map to
your current hostname (which may correspond to one of the addresses
above). That's purely a user space stuff.

	So, you are basically starting on a wrong assumption, the
information you are looking for doesn't exist, and I therefore suspect
that you need to rethink the thing you want to do.

	I suggest you use a user space application to pick the IP
address most relevant to your setup (i.e. policy decision) and inject
it in your module.

	Good luck,

	Jean

             reply	other threads:[~2002-10-31  2:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-31  2:38 Jean Tourrilhes [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-31 18:56 Juan Gomez
2002-10-31 18:09 Juan Gomez
2002-10-31 18:30 ` Jean Tourrilhes
2002-10-31 18:57   ` Richard B. Johnson
2002-10-31 19:09   ` Jesse Pollard
2002-10-31 17:32 Juan Gomez
2002-10-31 18:01 ` Josh Myer
2002-10-31  0:52 Juan Gomez

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=20021031023821.GA2156@bougret.hpl.hp.com \
    --to=jt@bougret.hpl.hp.com \
    --cc=jt@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome