From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sun, 26 Dec 2004 12:33:21 +0000 Subject: Re: how does udev rename an interface? Message-Id: <1104064401.16548.12.camel@localhost.localdomain> List-Id: References: <20041226112849.GA8995@fishbowl> In-Reply-To: <20041226112849.GA8995@fishbowl> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Sun, 2004-12-26 at 12:28 +0100, martin f krafft wrote: > udev has the ability to rename network interfaces. At least on my > system, udevsend is called from /etc/hotplug.d/default. A network > device usually triggers two hotplug events, the first for the > device, and the second for the network interface. Therefore, udev > runs twice, but network interface renaming only makes sense during > the second invocation, since it only applies to network interfaces. > > I have two questions about how udev handles this: > > - /etc/hotplug.d/net/*.hotplug are run before udevsend is called > from /etc/hotplug.d/default. Thus, if a tool such as ifplugd > already configures the network interface with > /etc/hotplug.d/net, udev effectively cannot change the > interface name because the interface is in use. Right, if something brings up the netif earlier, udev can't do anything. > - even if udev changes the interface name, how does it communicate > the new name to net.agent and all the other hook scripts?The > interface name is stored in $INTERFACE in the environment of the > hotplug process, and udev cannot change that environment (or can > it?). On a successful rename, udev calls the /etc/dev.d/net/hotplug.dev script, which calls the /etc/hotplug.d/default/default.hotplug again with the corrected environment. > How does udev deal with this? If /sbin/udevsend is used as the hotplug helper and udevd manages the complete hotplug event, only one correct hotplug netif call is visible to the hotplug scripts. The one for the old name will be "converted" to carry the new name and no second event needs to be faked. Kay ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ 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