netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [INET] Fix netdev renaming and inet address labels
@ 2008-01-03 15:57 Mark McLoughlin
  2008-01-04  8:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Mark McLoughlin @ 2008-01-03 15:57 UTC (permalink / raw)
  To: netdev; +Cc: Mark McLoughlin

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>
---
 net/ipv4/devinet.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 3168c3d..b42f746 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;
-- 
1.5.3.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [INET] Fix netdev renaming and inet address labels
  2008-01-03 15:57 [PATCH] [INET] Fix netdev renaming and inet address labels Mark McLoughlin
@ 2008-01-04  8:57 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-01-04  8:57 UTC (permalink / raw)
  To: markmc; +Cc: netdev

From: Mark McLoughlin <markmc@redhat.com>
Date: Thu,  3 Jan 2008 15:57:03 +0000

> 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>

This bug has been there since the function in question was
written :-)

Patch applied, thanks Mark.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-04  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03 15:57 [PATCH] [INET] Fix netdev renaming and inet address labels Mark McLoughlin
2008-01-04  8:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).