Networking Forums

Networking Forums > Computer Networking > Linux Networking > Find IPv4 address(es) for an interface

Reply
Thread Tools Display Modes

Find IPv4 address(es) for an interface

 
 
Spoon
Guest
Posts: n/a

 
      06-05-2006, 08:40 PM
Hello everyone,

Is there a /proc node that would return the IPv4 address(es) given to an
interface? (Where does ifconfig find the info?)

How does "ip address show dev eth1" work? (I'll take a look at the
source code tomorrow.)

Regards.
 
Reply With Quote
 
 
 
 
Spoon
Guest
Posts: n/a

 
      06-06-2006, 10:26 PM
Spoon wrote:

> Is there a /proc node that would return the IPv4 address(es) given to an
> interface? (Where does ifconfig find the info?)
>
> How does "ip address show dev eth1" work? (I'll take a look at the
> source code tomorrow.)


Anyone?
 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a

 
      06-06-2006, 10:31 PM
On Wed, 07 Jun 2006 00:26:57 +0200, Spoon wrote:

> Is there a /proc node that would return the IPv4 address(es) given to an
> interface? (Where does ifconfig find the info?)
>
> How does "ip address show dev eth1" work? (I'll take a look at the
> source code tomorrow.)


> Anyone?


maybe a
strings /sbin/ifconfig | grep get
and strings /sbin/ifconfig | grep /proc
will give you some hints

 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      06-06-2006, 11:26 PM
Spoon <root@127.0.0.1> wrote:
>Spoon wrote:
>
>> Is there a /proc node that would return the IPv4 address(es) given to an
>> interface? (Where does ifconfig find the info?)
>>
>> How does "ip address show dev eth1" work? (I'll take a look at the
>> source code tomorrow.)

>
>Anyone?


If you want C code to do it, it is trivial.

Got to google's Usenet archives and search on these three words
'struct ifr floyd', and you will find several articles where I've
posted a demo program to do that.

If you don't find it, ask and I'll post it again.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Grant
Guest
Posts: n/a

 
      06-07-2006, 01:04 AM
On Wed, 07 Jun 2006 00:26:57 +0200, Spoon <root@127.0.0.1> wrote:

>Spoon wrote:
>
>> Is there a /proc node that would return the IPv4 address(es) given to an
>> interface? (Where does ifconfig find the info?)
>>
>> How does "ip address show dev eth1" work? (I'll take a look at the
>> source code tomorrow.)

>
>Anyone?


Sure it's there under /proc, IP addr in hexadecimal (lo 0000007F...

What you trying to do?

Grant.
--
But Linux grew from humble and stupid roots.

Linus -- lkml 24 Apr 2006
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IPv4 Autoconfiguration Address Dan Walowski Windows Networking 1 07-20-2009 08:46 PM
IPv4 address validation in Net::IP Jigs Linux Networking 2 11-09-2006 01:32 PM
IPv4 unicast sendto() through a network interface Vinod Kumar P Linux Networking 2 10-30-2003 02:00 PM
IPV4 recvfrom() thru which network interface Vinod Windows Networking 0 10-28-2003 08:59 PM
Re: IPV4 recvfrom() thru which network interface Paul Chitescu Windows Networking 0 10-28-2003 11:06 AM



1 2 3 4 5 6 7 8 9 10 11