Subject: [PATCH] keep track of network interface renaming From: Olaf Hering Patch-mainline: not yet 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 Signed-off-by: Olaf Hering net/core/dev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -945,8 +945,12 @@ static int dev_get_valid_name(struct net return __dev_alloc_name(net, name, buf); else if (__dev_get_by_name(net, name)) return -EEXIST; - else if (buf != name) + else if (buf != name) { + if (strncmp(name, buf, IFNAMSIZ)) + printk(KERN_INFO "%s renamed to %s by %s [%u]\n", + buf, name, current->comm, current->pid); strlcpy(buf, name, IFNAMSIZ); + } return 0; }