]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[INET]: Fix netdev renaming and inet address labels
authorMark McLoughlin <markmc@redhat.com>
Tue, 15 Jan 2008 21:25:01 +0000 (23:25 +0200)
committerAdrian Bunk <bunk@kernel.org>
Tue, 15 Jan 2008 23:48:09 +0000 (01:48 +0200)
[ Upstream commit: 44344b2a85f03326c7047a8c861b0c625c674839 ]

When re-naming an interface, the previous secondary address
labels get lost e.g.

  $> brctl addbr foo
  $> ip addr add 192.168.0.1 dev foo
  $> ip addr add 192.168.0.2 dev foo label foo:00
  $> ip addr show dev foo | grep inet
    inet 192.168.0.1/32 scope global foo
    inet 192.168.0.2/32 scope global foo:00
  $> ip link set foo name bar
  $> ip addr show dev bar | grep inet
    inet 192.168.0.1/32 scope global bar
    inet 192.168.0.2/32 scope global bar:2

Turns out to be a simple thinko in inetdev_changename() - clearly we
want to look at the address label, rather than the device name, for
a suffix to retain.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
net/ipv4/devinet.c

index 73a62007e36e9add5868a5c19b9f6105a9135ba7..4f88e2ef57fd3f2557d3c0d3fa223a9ad79611f4 100644 (file)
@@ -962,7 +962,7 @@ static void inetdev_changename(struct net_device *dev, struct in_device *in_dev)
                memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); 
                if (named++ == 0)
                        continue;
-               dot = strchr(ifa->ifa_label, ':');
+               dot = strchr(old, ':');
                if (dot == NULL) { 
                        sprintf(old, ":%d", named); 
                        dot = old;