diff options
-rw-r--r-- | net/8021q/vlan.c | 14 | ||||
-rw-r--r-- | net/8021q/vlan.h | 4 | ||||
-rw-r--r-- | net/8021q/vlanproc.c | 7 |
3 files changed, 16 insertions, 9 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 541542e2a2c..5cacad0671d 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -52,9 +52,6 @@ static char vlan_version[] = DRV_VERSION; | |||
52 | static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; | 52 | static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; |
53 | static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; | 53 | static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; |
54 | 54 | ||
55 | /* Determines interface naming scheme. */ | ||
56 | unsigned short vlan_name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD; | ||
57 | |||
58 | static struct packet_type vlan_packet_type = { | 55 | static 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; |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 7258357db84..5229a72c7ea 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/if_vlan.h> | 4 | #include <linux/if_vlan.h> |
5 | 5 | ||
6 | extern unsigned short vlan_name_type; | ||
7 | |||
8 | #define VLAN_GRP_HASH_SHIFT 5 | 6 | #define VLAN_GRP_HASH_SHIFT 5 |
9 | #define VLAN_GRP_HASH_SIZE (1 << VLAN_GRP_HASH_SHIFT) | 7 | #define VLAN_GRP_HASH_SIZE (1 << VLAN_GRP_HASH_SHIFT) |
10 | #define VLAN_GRP_HASH_MASK (VLAN_GRP_HASH_SIZE - 1) | 8 | #define VLAN_GRP_HASH_MASK (VLAN_GRP_HASH_SIZE - 1) |
@@ -59,6 +57,8 @@ struct vlan_net { | |||
59 | struct proc_dir_entry *proc_vlan_dir; | 57 | struct proc_dir_entry *proc_vlan_dir; |
60 | /* /proc/net/vlan/config */ | 58 | /* /proc/net/vlan/config */ |
61 | struct proc_dir_entry *proc_vlan_conf; | 59 | struct proc_dir_entry *proc_vlan_conf; |
60 | /* Determines interface naming scheme. */ | ||
61 | unsigned short name_type; | ||
62 | }; | 62 | }; |
63 | 63 | ||
64 | #endif /* !(__BEN_VLAN_802_1Q_INC__) */ | 64 | #endif /* !(__BEN_VLAN_802_1Q_INC__) */ |
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index cc17b722078..daad0064e2c 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -260,13 +260,16 @@ static void vlan_seq_stop(struct seq_file *seq, void *v) | |||
260 | 260 | ||
261 | static int vlan_seq_show(struct seq_file *seq, void *v) | 261 | static int vlan_seq_show(struct seq_file *seq, void *v) |
262 | { | 262 | { |
263 | struct net *net = seq_file_net(seq); | ||
264 | struct vlan_net *vn = net_generic(net, vlan_net_id); | ||
265 | |||
263 | if (v == SEQ_START_TOKEN) { | 266 | if (v == SEQ_START_TOKEN) { |
264 | const char *nmtype = NULL; | 267 | const char *nmtype = NULL; |
265 | 268 | ||
266 | seq_puts(seq, "VLAN Dev name | VLAN ID\n"); | 269 | seq_puts(seq, "VLAN Dev name | VLAN ID\n"); |
267 | 270 | ||
268 | if (vlan_name_type < ARRAY_SIZE(vlan_name_type_str)) | 271 | if (vn->name_type < ARRAY_SIZE(vlan_name_type_str)) |
269 | nmtype = vlan_name_type_str[vlan_name_type]; | 272 | nmtype = vlan_name_type_str[vn->name_type]; |
270 | 273 | ||
271 | seq_printf(seq, "Name-Type: %s\n", | 274 | seq_printf(seq, "Name-Type: %s\n", |
272 | nmtype ? nmtype : "UNKNOWN"); | 275 | nmtype ? nmtype : "UNKNOWN"); |