mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bernd Eckenfels <ecki-news2002-06@lina.inka.de>
To: linux-kernel@vger.kernel.org
Subject: Re: Question concerning ifconfig
Date: Fri, 5 Jul 2002 19:33:25 +0200	[thread overview]
Message-ID: <E17QWxR-0000Im-00@sites.inka.de> (raw)
In-Reply-To: <180577A42806D61189D30008C7E632E8793972@boca213a.boca.ssc.siemens.com>

Bloch, Jack <Jack.Bloch@icn.siemens.com> 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

  parent reply	other threads:[~2002-07-05 17:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-05 13:58 Bloch, Jack
2002-07-05 17:20 ` Ben Greear
2002-07-05 17:33 ` Bernd Eckenfels [this message]
2002-07-08 11:37 Bloch, Jack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E17QWxR-0000Im-00@sites.inka.de \
    --to=ecki-news2002-06@lina.inka.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®