[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: udev naming problems for eth*



Hello!

martin f krafft <madduck@debian.org> writes:

> also sprach Emilio Jesús Gallego Arias <egallego@babel.ls.fi.upm.es> [2006.01.18.1254 +0100]:
>> As far as I can tell, network interface names are given by the
>> kernel and they've nothing to do with udev.
>> 
>> To get a stable naming you should use some package like ifrename.
>
> ifrename is a hack and needed for 2.4 kernels only these days. udev

As it has been pointed by Tomas Hood, udev is the same hack that
ifrename of a custom nameif script and it is not race free. Indeed,
some of the DEV_NET events are special-cased in half of udev due to
not having a device file associated.

A netif name is given in the kernel, udev only tries to rename it (as
the other tools do):

udev_add.c:287
	} else if (udev->type == DEV_NET) {
		/* look if we want to change the name of the netif */
		if (strcmp(udev->name, udev->kernel_name) != 0) {
			retval = rename_net_if(udev);
			if (retval != 0)
				goto exit;

			info("renamed netif to '%s'", udev->name);
			/* we've changed the name, now fake the devpath, cause the
			 * original kernel name sleeps with the fishes and we don't
			 * get an event from the kernel with the new name
			 */
			pos = strrchr(udev->devpath, '/');
			if (pos != NULL) {
				pos[1] = '\0';
				strlcat(udev->devpath, udev->name, sizeof(udev->devpath));
				strlcpy(udev->kernel_name, udev->name, sizeof(udev->kernel_name));
				setenv("DEVPATH", udev->devpath, 1);
				setenv("INTERFACE", udev->name, 1);
			}
		}

With the current situation, upstream (kernel) support is needed to do
the rename in a successfully way. You could retry the rename, but then
you'd get into liveliness issues (you want eth0->eth1 and eth1->eth0,
etc...).

So I think that using other tools for the job is equally appropriate.

I'll stop now as I really have no clue about udev and this has nothing
to do with the original post.

Regards, sorry for the noise and keep up the good work with Debian, 

Emilio



Reply to: