Hello,
Thanks!
What I did , assuiming that I understood you right, was:
....
struct net_device* device;
struct net_device* deviceEth0;
struct in_device* in_dev;
struct in_ifaddr* if_info;
device = dev_get_by_name("eth0");
in_dev = (struct in_device *)device->ip_ptr;
if_info = in_dev->ifa_list;
........
and then traverse if_info (using it's ifa_next pointer) checking if
ifa_label is eth0:1
The ip address was in ifa_local.
This did work.
I hoped there is a more starightforward way. (maybe there is?)
Regards,
Amir
From: Gilad Ben-Yossef <[EMAIL PROTECTED]>
To: Amir Binyamini <[EMAIL PROTECTED]>
CC: linux-il@linux.org.il
Subject: Re: dev_get_by_name with eth0:1
Date: Thu, 14 Jul 2005 10:44:59 +0300
Amir Binyamini wrote:
Hello,
This post has some relavance to a former question , which dealt with
getting
the ip of eth0 ;Now I must also get the IP on eth0:1 .
I do have an IP on both eth0 and eth0:1 , as running ifconfig shows
I try in init method of a module I wrote:
.........
struct net_device* device;
device = dev_get_by_name("eth0:1");
if (device == NULL)
{
printk("device is NULL\n");
}
...
I do get the "device is NULL message" after insmod my module.
Of course, because there is no such device as eth0:1. It's just an alias of
"eth0".
If you took a good look at the structure that is returned by
dev_get_by_name you would have noticed that the field containing the IP is
actually an array which holds all the addresses assigned to the interface
and it's aliases.
In short:
Use the Source, Luke!
Gilad
--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Codefidence. A name you can trust(tm)
Web: http://codefidence.com | SIP: [EMAIL PROTECTED]
IL: +972.9.8650475 ext. 201 | Fax: +972.9.8850643
US: +1.360.2275194 ext. 201 | Cel: +972.52.8260388
"I am Jack's Overwritten Stack Pointer"
-- Hackers Club, the movie
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]