aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_notify.c
diff options
context:
space:
mode:
authorSimon Arlott <simon@fire.lp0.eu>2010-05-10 05:31:11 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-16 02:10:15 -0400
commite0f43752a942b7be1bc06b9fd74e20ae337c1cca (patch)
tree892d0fbc2ecae39f2e5c4a7b711cbb988c8dc3f1 /net/bridge/br_notify.c
parent28a16c97963d3bc36a2c192859f6d8025ef2967a (diff)
bridge: update sysfs link names if port device names have changed
Links for each port are created in sysfs using the device name, but this could be changed after being added to the bridge. As well as being unable to remove interfaces after this occurs (because userspace tools don't recognise the new name, and the kernel won't recognise the old name), adding another interface with the old name to the bridge will cause an error trying to create the sysfs link. This fixes the problem by listening for NETDEV_CHANGENAME notifications and renaming the link. https://bugzilla.kernel.org/show_bug.cgi?id=12743 Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_notify.c')
-rw-r--r--net/bridge/br_notify.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 1413b72acc7f..717e1fd6133c 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
34 struct net_device *dev = ptr; 34 struct net_device *dev = ptr;
35 struct net_bridge_port *p = dev->br_port; 35 struct net_bridge_port *p = dev->br_port;
36 struct net_bridge *br; 36 struct net_bridge *br;
37 int err;
37 38
38 /* not a port of a bridge */ 39 /* not a port of a bridge */
39 if (p == NULL) 40 if (p == NULL)
@@ -83,6 +84,12 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
83 br_del_if(br, dev); 84 br_del_if(br, dev);
84 break; 85 break;
85 86
87 case NETDEV_CHANGENAME:
88 err = br_sysfs_renameif(p);
89 if (err)
90 return notifier_from_errno(err);
91 break;
92
86 case NETDEV_PRE_TYPE_CHANGE: 93 case NETDEV_PRE_TYPE_CHANGE:
87 /* Forbid underlaying device to change its type. */ 94 /* Forbid underlaying device to change its type. */
88 return NOTIFY_BAD; 95 return NOTIFY_BAD;