Keep track about which network interface names were renamed after the
network device driver printed its banner. Example insanity:

honeydew:~ # dmesg| grep -Ew '(eth[0-9]|rename|renamed)'
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000: eth2: e1000_probe: Intel(R) PRO/1000 Network Connection
e1000: eth3: e1000_probe: Intel(R) PRO/1000 Network Connection
dev_change_name: about to rename 'eth3' to 'eth0'
dev_change_name: about to rename 'eth3' to 'ethxx3'
eth3 renamed to ethxx3
dev_change_name: about to rename 'ethxx3' to 'eth0'
dev_change_name: about to rename 'eth0' to 'eth3'
eth0 renamed to eth3
dev_change_name: about to rename 'eth1' to 'eth2'
dev_change_name: about to rename 'eth1' to 'ethxx1'
eth1 renamed to ethxx1
dev_change_name: about to rename 'ethxx1' to 'eth2'
dev_change_name: about to rename 'eth2' to 'eth1'
eth2 renamed to eth1
dev_change_name: about to rename 'ethxx3' to 'eth0'
ethxx3 renamed to eth0
dev_change_name: about to rename 'ethxx1' to 'eth2'
ethxx1 renamed to eth2
e1000: eth0: e1000_watchdog_task: NIC Link is Up 100 Mbps Full Duplex

The KERN_DEBUG line can obviously go in the final version.

Signed-off-by: Olaf Hering <[EMAIL PROTECTED]>

 net/core/dev.c |    5 +++++
 1 files changed, 5 insertions(+)

Index: linux-2.6.16-rc4-olh/net/core/dev.c
===================================================================
--- linux-2.6.16-rc4-olh.orig/net/core/dev.c
+++ linux-2.6.16-rc4-olh/net/core/dev.c
@@ -713,6 +713,7 @@ int dev_change_name(struct net_device *d
 {
        int err = 0;
 
+       printk(KERN_DEBUG "%s: about to rename '%s' to '%s'\n", __FUNCTION__, 
dev->name, newname);
        ASSERT_RTNL();
 
        if (dev->flags & IFF_UP)
@@ -730,7 +731,11 @@ int dev_change_name(struct net_device *d
        else if (__dev_get_by_name(newname))
                return -EEXIST;
        else
+       {
+               if (strncmp(newname, dev->name, IFNAMSIZ))
+                       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) {
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to