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]

Reply via email to