if (argc == 0) {
printf(
"usage: vlan mode set <mode>\n"
+ "0 - disabled\n"
"1 - basic port based\n"
"2 - advanced port based\n"
"3 - basic 802.1Q\n"
}
mode = strtoul(argv[0], NULL, 0);
- if (mode < 1 || mode > 4) {
+ if (mode < VLAN_DISABLED || mode > VLAN_DOT_ADV) {
printf("mode out of range\n");
return 1;
}
*t = VLAN_DISABLED;
- if (attr->first != NULL) {
- at = attr->first->data;
- *t =(int)*(char*)at->data;
+ if (attr->first == NULL) {
+ ret = ERR_INVARG;
+ goto end;
}
-
+ at = attr->first->data;
+ *t =(int)*(char*)at->data;
end:
destroyList(attr, (void(*)(void*))freeAttr);
List *attr;
- if (nga == NULL || t < 1 || t > 4)
+ if (nga == NULL || t < VLAN_DISABLED || t > VLAN_DOT_ADV)
return ERR_INVARG;
else if (nga->current == NULL)
return ERR_NOTLOG;