]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | Subject: [PATCH] keep track of network interface renaming |
2 | From: Olaf Hering <olh@suse.de> | |
3 | ||
4 | Keep track about which network interface names were renamed after the | |
5 | network device driver printed its banner. Example insanity: | |
6 | ||
7 | honeydew:~ # dmesg| grep -Ew '(eth[0-9]|rename|renamed)' | |
8 | e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection | |
9 | e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection | |
10 | e1000: eth2: e1000_probe: Intel(R) PRO/1000 Network Connection | |
11 | e1000: eth3: e1000_probe: Intel(R) PRO/1000 Network Connection | |
12 | dev_change_name: about to rename 'eth3' to 'eth0' | |
13 | dev_change_name: about to rename 'eth3' to 'ethxx3' | |
14 | eth3 renamed to ethxx3 | |
15 | dev_change_name: about to rename 'ethxx3' to 'eth0' | |
16 | dev_change_name: about to rename 'eth0' to 'eth3' | |
17 | eth0 renamed to eth3 | |
18 | dev_change_name: about to rename 'eth1' to 'eth2' | |
19 | dev_change_name: about to rename 'eth1' to 'ethxx1' | |
20 | eth1 renamed to ethxx1 | |
21 | dev_change_name: about to rename 'ethxx1' to 'eth2' | |
22 | dev_change_name: about to rename 'eth2' to 'eth1' | |
23 | eth2 renamed to eth1 | |
24 | dev_change_name: about to rename 'ethxx3' to 'eth0' | |
25 | ethxx3 renamed to eth0 | |
26 | dev_change_name: about to rename 'ethxx1' to 'eth2' | |
27 | ethxx1 renamed to eth2 | |
28 | e1000: eth0: e1000_watchdog_task: NIC Link is Up 100 Mbps Full Duplex | |
29 | ||
30 | ||
31 | ||
32 | Signed-off-by: Olaf Hering <olh@suse.de> | |
33 | ||
34 | net/core/dev.c | 4 ++++ | |
35 | 1 file changed, 4 insertions(+) | |
36 | ||
37 | --- a/net/core/dev.c | |
38 | +++ b/net/core/dev.c | |
39 | @@ -922,7 +922,11 @@ int dev_change_name(struct net_device *d | |
40 | else if (__dev_get_by_name(net, newname)) | |
41 | return -EEXIST; | |
42 | else | |
43 | + { | |
44 | + if (strncmp(newname, dev->name, IFNAMSIZ)) | |
45 | + printk(KERN_INFO "%s renamed to %s by %s [%u]\n", dev->name, newname, current->comm, current->pid); | |
46 | strlcpy(dev->name, newname, IFNAMSIZ); | |
47 | + } | |
48 | ||
49 | rollback: | |
50 | err = device_rename(&dev->dev, dev->name); |