diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-04-02 03:08:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-02 03:08:01 -0400 |
commit | 802fb176d8c635ae42da31b80841c26e8c7338a0 (patch) | |
tree | 3f0a1283ca650868fd41942fb13e5ada129788c7 /net/8021q | |
parent | f32c5f2c3866bf4d932d2bc42216dafb90a50ab7 (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')
-rw-r--r-- | net/8021q/vlan.c | 20 | ||||
-rw-r--r-- | net/8021q/vlan.h | 5 | ||||
-rw-r--r-- | net/8021q/vlanproc.c | 5 |
3 files changed, 24 insertions, 6 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 | ||
377 | static 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 | |||
377 | static int vlan_device_event(struct notifier_block *unused, unsigned long event, | 389 | static 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 | ||
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 73efcc715ccb..51271aea402b 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -45,4 +45,9 @@ void vlan_netlink_fini(void); | |||
45 | 45 | ||
46 | extern struct rtnl_link_ops vlan_link_ops; | 46 | extern struct rtnl_link_ops vlan_link_ops; |
47 | 47 | ||
48 | static inline int is_vlan_dev(struct net_device *dev) | ||
49 | { | ||
50 | return dev->priv_flags & IFF_802_1Q_VLAN; | ||
51 | } | ||
52 | |||
48 | #endif /* !(__BEN_VLAN_802_1Q_INC__) */ | 53 | #endif /* !(__BEN_VLAN_802_1Q_INC__) */ |
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index 146cfb0e9882..9671aa51af2c 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -210,11 +210,6 @@ int vlan_proc_rem_dev(struct net_device *vlandev) | |||
210 | * The following few functions build the content of /proc/net/vlan/config | 210 | * The following few functions build the content of /proc/net/vlan/config |
211 | */ | 211 | */ |
212 | 212 | ||
213 | static inline int is_vlan_dev(struct net_device *dev) | ||
214 | { | ||
215 | return dev->priv_flags & IFF_802_1Q_VLAN; | ||
216 | } | ||
217 | |||
218 | /* start read of /proc/net/vlan/config */ | 213 | /* start read of /proc/net/vlan/config */ |
219 | static void *vlan_seq_start(struct seq_file *seq, loff_t *pos) | 214 | static void *vlan_seq_start(struct seq_file *seq, loff_t *pos) |
220 | __acquires(dev_base_lock) | 215 | __acquires(dev_base_lock) |