aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-02 03:08:01 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-02 03:08:01 -0400
commit802fb176d8c635ae42da31b80841c26e8c7338a0 (patch)
tree3f0a1283ca650868fd41942fb13e5ada129788c7 /net/8021q/vlan.c
parentf32c5f2c3866bf4d932d2bc42216dafb90a50ab7 (diff)
[VLAN]: Proc entry is not renamed when vlan device name changes.
This may lead to situations, when each of two proc entries produce data for the other's device. Looks like a BUG, so this patch is for net-2.6. It will not apply to net-2.6.26 since dev->nd_net access is replaced with dev_net(dev) one. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index dbc81b965096..b33410abfd6b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -374,17 +374,35 @@ static void vlan_sync_address(struct net_device *dev,
374 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); 374 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
375} 375}
376 376
377static void __vlan_device_event(struct net_device *dev, unsigned long event)
378{
379 switch (event) {
380 case NETDEV_CHANGENAME:
381 vlan_proc_rem_dev(dev);
382 if (vlan_proc_add_dev(dev) < 0)
383 pr_warning("8021q: failed to change proc name for %s\n",
384 dev->name);
385 break;
386 }
387}
388
377static int vlan_device_event(struct notifier_block *unused, unsigned long event, 389static int vlan_device_event(struct notifier_block *unused, unsigned long event,
378 void *ptr) 390 void *ptr)
379{ 391{
380 struct net_device *dev = ptr; 392 struct net_device *dev = ptr;
381 struct vlan_group *grp = __vlan_find_group(dev->ifindex); 393 struct vlan_group *grp;
382 int i, flgs; 394 int i, flgs;
383 struct net_device *vlandev; 395 struct net_device *vlandev;
384 396
385 if (dev->nd_net != &init_net) 397 if (dev->nd_net != &init_net)
386 return NOTIFY_DONE; 398 return NOTIFY_DONE;
387 399
400 if (is_vlan_dev(dev)) {
401 __vlan_device_event(dev, event);
402 goto out;
403 }
404
405 grp = __vlan_find_group(dev->ifindex);
388 if (!grp) 406 if (!grp)
389 goto out; 407 goto out;
390 408