On Wed, 13 Jul 2005, Amir Binyamini wrote:

> 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 ifconfigshows
> 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.

so this does not work...

> I had looked at net/pv4/devinet.cin dev_get_by_name() implementation:
>
> struct net_device *dev_get_by_name(const char *name)
> {
>       struct net_device *dev;
>
>       read_lock(&dev_base_lock);
>       dev = __dev_get_by_name(name);
>       if (dev)
>               dev_hold(dev);
>       read_unlock(&dev_base_lock);
>       return dev;
> }
>
> but I don't know what the problem is.

ofcourse you don't, because this function doesn't do anything, but calls
another function, __dev_get_by_name. now, don't be afraid, and follow the
call chain until you get to the part of the code that does the actual
work, and decipher it. it's not that hard (up to some point), and by doing
this, you'll familiarize yourself with the kernel's code, and will be be
able to support yourself.

-- 
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy

=================================================================
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