50 |
#define VLAN_GROUP_ARRAY_LEN 4096 |
#define VLAN_GROUP_ARRAY_LEN 4096 |
51 |
#define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ |
#define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ |
52 |
|
|
53 |
/* On entry, table points to the length of the current string plus |
/* On entry, table points to the length of the current string |
54 |
* nul terminator plus data length for the subsequent entry. The |
* plus NUL terminator plus data length for the subsequent entry. |
55 |
* return value is the last data entry for the matching string. */ |
* The return value is the last data entry for the matching string. */ |
56 |
static const char *xfind_str(const char *table, const char *str) |
static const char *xfind_str(const char *table, const char *str) |
57 |
{ |
{ |
58 |
while (strcasecmp(str, table+1) != 0) { |
while (strcasecmp(str, table+1) != 0) { |
59 |
if (!*(table += table[0])) { |
table += table[0]; |
60 |
|
if (!*table) { |
61 |
bb_show_usage(); |
bb_show_usage(); |
62 |
} |
} |
63 |
} |
} |
122 |
/* Will die if 802.1q is not present */ |
/* Will die if 802.1q is not present */ |
123 |
xopen(conf_file_name, O_RDONLY); |
xopen(conf_file_name, O_RDONLY); |
124 |
|
|
125 |
memset(&ifr, 0, sizeof(struct vlan_ioctl_args)); |
memset(&ifr, 0, sizeof(ifr)); |
126 |
|
|
127 |
++argv; |
++argv; |
128 |
p = xfind_str(cmds+2, *argv); |
p = xfind_str(cmds+2, *argv); |
134 |
if (ifr.cmd == SET_VLAN_NAME_TYPE_CMD) { /* set_name_type */ |
if (ifr.cmd == SET_VLAN_NAME_TYPE_CMD) { /* set_name_type */ |
135 |
ifr.u.name_type = *xfind_str(name_types+1, argv[1]); |
ifr.u.name_type = *xfind_str(name_types+1, argv[1]); |
136 |
} else { |
} else { |
137 |
strncpy(ifr.device1, argv[1], IFNAMSIZ); |
strncpy_IFNAMSIZ(ifr.device1, argv[1]); |
138 |
p = argv[2]; |
p = argv[2]; |
139 |
|
|
140 |
/* I suppose one could try to combine some of the function calls below, |
/* I suppose one could try to combine some of the function calls below, |