linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: locally-administered MAC addresses create stupid rules
Date: Mon, 19 Nov 2007 11:31:13 +0000	[thread overview]
Message-ID: <c072ca310711190331s5cf439e7v6a79ff126bd57968@mail.gmail.com> (raw)
In-Reply-To: <fhr4de$lfb$1@ger.gmane.org>

2007/11/19, Kay Sievers <kay.sievers@vrfy.org>:
> On Nov 19, 2007 5:45 AM, Alexander E. Patrakov <patrakov@gmail.com> wrote:
> > the default persistent network rules generator in udev-117 creates this stupid
> > rule for a network card with a locally-administered MAC address:
> >
> > SUBSYSTEM="net", ACTION="add", ATTR{type}="1", NAME="eth0"
> >
> > (to reproduce: kvm -net nic,macaddr#:45:67:89:ab:cd -hda hda.dsk)
> >
> > This generated rule is stupid, because it matches every ethernet card. The logic
> > that strips out locally-administered MAC addresses from the match should be
> > revised, but I don't know how to do it properly.
>
> Yeah, right, that looks broken. We should add something like this, I guess:
>
> +# see if we got enough data to create a rule
> +ENV{MATCHADDR}="", ENV{MATCHID}="", ENV{INTERFACE_NAME}="",
> GOTO="persistent_net_generator_end"
> +

No, this won't work. Suppose that there is one "weird" NIC with a
locally-administered MAC address, and one "normal" NIC, and the race
between them is significant enough for the initial kernel names to be
unpredictable (i.e., udev needs to swap them in 50% of cases). When
the generator patched with the above change runs, it writes a rule for
the "normal" NIC. Let's suppose that the written rule ends up setting
the name for a "normal" NIC to eth0.

Now imagine that, after rebooting the box, the kernel has assigned
eth0 to the "weird" NIC and eth1 to the "normal" NIC, so that udev has
to swap them. But there is no rule to rename the "weird" NIC. The end
result is that there is only one rule that tells udev to rename the
normal NIC to eth0. It tries to do this, notices that eth0 already
exists, renames eth1 to eth?_rename, and fruitlessly waits for eth0 to
disappear.

-- 
Alexander E. Patrakov

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2007-11-19 11:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19  4:45 locally-administered MAC addresses create stupid rules Alexander E. Patrakov
2007-11-19 11:06 ` Kay Sievers
2007-11-19 11:31 ` Alexander E. Patrakov [this message]
2007-11-19 11:55 ` Kay Sievers
2007-11-19 12:04 ` Alexander E. Patrakov
2007-11-19 12:18 ` Kay Sievers
2007-11-19 12:53 ` Alexander E. Patrakov

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=c072ca310711190331s5cf439e7v6a79ff126bd57968@mail.gmail.com \
    --to=patrakov@gmail.com \
    --cc=linux-hotplug@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;
as well as URLs for NNTP newsgroup(s).