aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-16 03:54:39 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-16 03:56:18 -0400
commit7a17a2f79f54a988d08ffa33ec9e1038bffec42b (patch)
tree3d65b49a2d8b76851eb97a47c69e6481a884c8dc /net/8021q/vlan.c
parent80de2d982156b5f6f50ff97175dc94ccfe3d093f (diff)
[VLAN]: Make the vlan_name_type per-net.
This includes moving one on the struct vlan_net and s/vlan_name_type/vn->name_type/ over the code. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 541542e2a2c1..5cacad0671db 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -52,9 +52,6 @@ static char vlan_version[] = DRV_VERSION;
52static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; 52static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
53static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; 53static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
54 54
55/* Determines interface naming scheme. */
56unsigned short vlan_name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
57
58static struct packet_type vlan_packet_type = { 55static struct packet_type vlan_packet_type = {
59 .type = __constant_htons(ETH_P_8021Q), 56 .type = __constant_htons(ETH_P_8021Q),
60 .func = vlan_skb_recv, /* VLAN receive method */ 57 .func = vlan_skb_recv, /* VLAN receive method */
@@ -299,6 +296,8 @@ static int register_vlan_device(struct net_device *real_dev,
299 unsigned short VLAN_ID) 296 unsigned short VLAN_ID)
300{ 297{
301 struct net_device *new_dev; 298 struct net_device *new_dev;
299 struct net *net = dev_net(real_dev);
300 struct vlan_net *vn = net_generic(net, vlan_net_id);
302 char name[IFNAMSIZ]; 301 char name[IFNAMSIZ];
303 int err; 302 int err;
304 303
@@ -310,7 +309,7 @@ static int register_vlan_device(struct net_device *real_dev,
310 return err; 309 return err;
311 310
312 /* Gotta set up the fields for the device. */ 311 /* Gotta set up the fields for the device. */
313 switch (vlan_name_type) { 312 switch (vn->name_type) {
314 case VLAN_NAME_TYPE_RAW_PLUS_VID: 313 case VLAN_NAME_TYPE_RAW_PLUS_VID:
315 /* name will look like: eth1.0005 */ 314 /* name will look like: eth1.0005 */
316 snprintf(name, IFNAMSIZ, "%s.%.4i", real_dev->name, VLAN_ID); 315 snprintf(name, IFNAMSIZ, "%s.%.4i", real_dev->name, VLAN_ID);
@@ -580,7 +579,10 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
580 break; 579 break;
581 if ((args.u.name_type >= 0) && 580 if ((args.u.name_type >= 0) &&
582 (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) { 581 (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
583 vlan_name_type = args.u.name_type; 582 struct vlan_net *vn;
583
584 vn = net_generic(net, vlan_net_id);
585 vn->name_type = args.u.name_type;
584 err = 0; 586 err = 0;
585 } else { 587 } else {
586 err = -EINVAL; 588 err = -EINVAL;
@@ -642,6 +644,8 @@ static int vlan_init_net(struct net *net)
642 if (err < 0) 644 if (err < 0)
643 goto err_assign; 645 goto err_assign;
644 646
647 vn->name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
648
645 err = vlan_proc_init(net); 649 err = vlan_proc_init(net);
646 if (err < 0) 650 if (err < 0)
647 goto err_proc; 651 goto err_proc;