From: Mark McLoughlin Date: Fri, 4 Jan 2008 08:56:25 +0000 (-0800) Subject: [INET]: Fix netdev renaming and inet address labels X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=44344b2a85f03326c7047a8c861b0c625c674839;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [INET]: Fix netdev renaming and inet address labels 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 Signed-off-by: David S. Miller --- diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 3168c3de4919..b42f74617bac 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1027,7 +1027,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;