Re: to get IP address of network interfaces from Kernel space.

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

 



Bizhan,

The way I did it for the eth0 network interface is the following:

struct net_device *dev;
struct in_addr origin;

               if ((dev = __dev_get_by_name("eth0")) != NULL)
                     origin.s_addr = inet_select_addr(dev, 0 , 0);

I believe you need to know the names of the network interfaces, but I
am not sure where you can get them from. I used a static name (eth0)
in my code. I hope it helps.

Cheers,

Cristian.

On 3/24/07, Bizhan Gholikhamseh (bgholikh) <bgholikh@xxxxxxxxx> wrote:


Hi All,
How could  I get the IP address(s) of all the network interfaces on my
system from kernel space?

Many thanks in advance,
B

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux