From: Kay Sievers Date: Wed, 07 Mar 2007 20:35:18 +0000 Subject: Re: [PATCH] udev+ifrename integration Message-Id: <1173299718.3692.61.camel@pim.off.vrfy.org> List-Id: References: <20070307194435.GA22264@bougret.hpl.hp.com> In-Reply-To: <20070307194435.GA22264@bougret.hpl.hp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On Wed, 2007-03-07 at 11:44 -0800, Jean Tourrilhes wrote: > Integration of ifrename into udev has been a thorn in the side > of some major distro (Unbuntu, Debian...). That's all because it's just not needed. Udev ships a full-featured solution for persistent network names, and that's what these distros use. > There is a set of users that are hooked to ifrename for > renaming interfaces. Ifrename has various power user feature that > allow you to shoot yourself in the foot pretty nicely, and those users > can't live without that. They are integrating ifrename into udev in > various ad-hoc ways and everything "seems" to work. > Then, the distro maintainers point out that they can't do that > because in reality it breaks udev (and HAL, and NetworkManager, and so > on). >=20 > One of the solution is to migrate all apps using Hotplug > events to use 'ifindex' instead of 'ifname'. This is needed anyway to > fix the netif remove/add race condition. But this require kernel > support (which I just sent to Kay) and won't happen overnight. There is no known add/remove race since we killed the /sbin/hotplug fork-bomb. Care to explain what you mean? > The other solution is to offer a clean integration of ifrename > into udev. This has other benefits as well. > The attached patch for udev-105 does just that. The first > thing to notice is that the changes are minimal. Also, none of the > changes are specific to ifrename, and those could be used by any > network renaming program/script and solutions based on 'nameif' of > 'iproute2'. > Another point is that this integration will mostly work with > older version of ifrename but only version 29-pre14 or later will > fully work. >=20 > Finally, the udev rules would look like : > ---------------------------------------------------- > ENV{UDEVTEST}=3D"yes", SUBSYSTEM=3D"net", PROGRAM=3D"/usr/local/sbin/ifre= name -D -V -i %k", NAME:=3D"%c", OPTIONS+=3D"skip_netrename", OPTIONS+=3D"l= ast_rule" > SUBSYSTEM=3D"net", PROGRAM=3D"/usr/local/sbin/ifrename -i %k", NAME:=3D"%= c", OPTIONS+=3D"skip_netrename", OPTIONS+=3D"last_rule" > ---------------------------------------------------- You can almost never use "last_rule", that will break a lot of stuff that wants to see event from udev, including HAL. > --- udev-105-pristine/udev.h 2007-02-02 16:24:48.000000000 -0800 > +++ udev-105/udev.h 2007-02-28 17:26:03.000000000 -0800 > @@ -85,6 +85,7 @@ struct udevice { > int partitions; > int ignore_device; > int ignore_remove; > + int skip_netrename; You ask udev to rename a netif, but want to skip that part, but use the rest of the logic in NAME=3D, huh? Why not just instruct your external tool, not to actually rename the interface (dry run), but return the name, and udev will do the rename? > --- udev-105-pristine/udevtest.c 2007-02-02 16:24:48.000000000 -0800 > +++ udev-105/udevtest.c 2007-02-28 16:53:29.000000000 -0800 > @@ -110,6 +110,8 @@ int main(int argc, char *argv[], char *e > setenv("DEVPATH", udev->dev->devpath, 1); > setenv("SUBSYSTEM", udev->dev->subsystem, 1); > setenv("ACTION", "add", 1); > + /* Allow rules to know it's debugging time */ > + setenv("UDEVTEST", "yes", 1); There is no real need for that, just match on UDEV_LOG, if you want to add debugging rules. Udevtest has at least LOG_INFO, the udev default is LOG_ERR.=20 Also the udevtest program doesn't really work today, and is kind of useless, because we match on all the kernel supplied variables which are not available. Kay ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ 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