2002-07-05 13:55:42

by Bloch, Jack

[permalink] [raw]
Subject: Question concerning ifconfig

I am running a Red Hat 7.2 load (Kernel version 2.4.7-10). I am trying to
enter the following command to change the MAC address on my device.

ifconfig ifp0 hw ether A2:A5:A5:01:00:00

ifp0 is my own device which replaces eth0. The system gives me a response
"SIOCSIFHWADDR : device or resources busy"
The same exact command works on my 2.2.16 Kernel. Any ideas why the error.
Please CC me directly in any responses.

Thanks in advance,

Jack Bloch
Siemens Carrier Networks
e-mail : [email protected]
phone : (561) 923-6550


2002-07-05 17:17:55

by Ben Greear

[permalink] [raw]
Subject: Re: Question concerning ifconfig

Bloch, Jack wrote:
> I am running a Red Hat 7.2 load (Kernel version 2.4.7-10). I am trying to
> enter the following command to change the MAC address on my device.
>
> ifconfig ifp0 hw ether A2:A5:A5:01:00:00
>
> ifp0 is my own device which replaces eth0. The system gives me a response
> "SIOCSIFHWADDR : device or resources busy"
> The same exact command works on my 2.2.16 Kernel. Any ideas why the error.
> Please CC me directly in any responses.

ifconfig ifp0 down

first, then it should work.

Ben

>
> Thanks in advance,
>
> Jack Bloch
> Siemens Carrier Networks
> e-mail : [email protected]
> phone : (561) 923-6550
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>



--
Ben Greear <[email protected]> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear


2002-07-05 17:30:54

by Bernd Eckenfels

[permalink] [raw]
Subject: Re: Question concerning ifconfig

Bloch, Jack <[email protected]> wrote:
> ifconfig ifp0 hw ether A2:A5:A5:01:00:00

I get also EBUSY on 0x8924 aka SIOCSIFHWADDR.

Looking into the kernel:

core/dev.c
case SIOCSIFHWADDR:
if (dev->set_mac_address == NULL)
return -EOPNOTSUPP;
if (ifr->ifr_hwaddr.sa_family!=dev->type)
return -EINVAL;
if (!netif_device_present(dev))
return -ENODEV;
err = dev->set_mac_address(dev, &ifr->ifr_hwaddr);
if (!err)
notifier_call_chain(&netdev_chain, NETDEV_CHANGE
return err;


It looks to me that set_mac_address() of the device is doing that. For my
card it is the generic one in net_init.c which is doing:

static int eth_mac_addr(struct net_device *dev, void *p)
{
struct sockaddr *addr=p;
if (netif_running(dev))
return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
return 0;
}

So, as long as your interface is up, you are not allowed to change the
address.

I will add that to the man page.

Greetings
Bernd

2002-07-08 11:34:37

by Bloch, Jack

[permalink] [raw]
Subject: RE: Question concerning ifconfig

Thanks for the quick response, but in the mean time I figured it out through
trial and error. My driver did not have a set_mac_address method. There must
have been some sort of default method in 2.2

Jack Bloch
Siemens Carrier Networks
e-mail : [email protected]
phone : (561) 923-6550


-----Original Message-----
From: Ben Greear [mailto:[email protected]]
Sent: Friday, July 05, 2002 1:20 PM
To: Bloch, Jack
Cc: '[email protected]'
Subject: Re: Question concerning ifconfig


Bloch, Jack wrote:
> I am running a Red Hat 7.2 load (Kernel version 2.4.7-10). I am trying to
> enter the following command to change the MAC address on my device.
>
> ifconfig ifp0 hw ether A2:A5:A5:01:00:00
>
> ifp0 is my own device which replaces eth0. The system gives me a response
> "SIOCSIFHWADDR : device or resources busy"
> The same exact command works on my 2.2.16 Kernel. Any ideas why the error.
> Please CC me directly in any responses.

ifconfig ifp0 down

first, then it should work.

Ben

>
> Thanks in advance,
>
> Jack Bloch
> Siemens Carrier Networks
> e-mail : [email protected]
> phone : (561) 923-6550
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>



--
Ben Greear <[email protected]> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear