Skip to contentSkip to conversation

keep track of network interface renaming

PATCH In review Olaf Hering 2 participants 2 messages Aug 15, 2006 – Aug 16, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 keep track of network interface renaming

Keep track about which network interface names were renamed after the network device driver printed its banner. Previous kernel names will be reused when new interfaces get registerd.
Recent udev scripts implement a stable kernel device name for network interfaces.
This printk avoids confusion about what network hardware maps to what kernel interface in later driver or network stack messages.

---
 net/core/dev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/dev.c +4 -1
Index: linux-2.6.18-rc4/net/core/dev.c
===================================================================
@@ -738,8 +738,11 @@ int dev_change_name(struct net_device *d
 	}
 	else if (__dev_get_by_name(newname))
 		return -EEXIST;
-	else
+	else {
+		if (strcmp(newname, dev->name))
+			printk(KERN_INFO "%s renamed to %s\n", dev->name, newname);
 		strlcpy(dev->name, newname, IFNAMSIZ);
+	}
 
 	err = class_device_rename(&dev->class_dev, dev->name);
 	if (!err) {
#1 lore raw
Quoted 7 lines · Olaf Hering

Keep track about which network interface names were renamed after the network device driver printed its banner. Previous kernel names will be reused when new interfaces get registerd.
Recent udev scripts implement a stable kernel device name for network interfaces.
This printk avoids confusion about what network hardware maps to what kernel interface in later driver or network stack messages.

I think it would be even easier to follow, especially with many devices, if some stable identifier was included in messages relating to network devices, like ifindex or maybe the LL address. And it would avoid spamming the ringbuffer for people making use of this to implement alternative naming schemes.