From: darkcoven Date: Sun, 6 Oct 2013 10:03:41 +0000 (+0200) Subject: Add the possibility to totally disable VLANs X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=59dec95577af618f0a275233a079eb98c070f6ea;p=ngadmin Add the possibility to totally disable VLANs --- diff --git a/cli/com_vlan.c b/cli/com_vlan.c index 3496815..0baa1d5 100644 --- a/cli/com_vlan.c +++ b/cli/com_vlan.c @@ -339,6 +339,7 @@ int do_vlan_mode_set (int argc, const char **argv, struct ngadmin *nga) if (argc == 0) { printf( "usage: vlan mode set \n" + "0 - disabled\n" "1 - basic port based\n" "2 - advanced port based\n" "3 - basic 802.1Q\n" @@ -353,7 +354,7 @@ int do_vlan_mode_set (int argc, const char **argv, struct ngadmin *nga) } 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; } diff --git a/lib/src/vlan.c b/lib/src/vlan.c index dda8ce5..2e6b2f6 100644 --- a/lib/src/vlan.c +++ b/lib/src/vlan.c @@ -31,11 +31,12 @@ int ngadmin_getVLANType (struct ngadmin *nga, int *t) *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); @@ -50,7 +51,7 @@ int ngadmin_setVLANType (struct ngadmin *nga, int t) 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; diff --git a/wireshark/nsdp.lua b/wireshark/nsdp.lua index 52a94b2..53aea70 100644 --- a/wireshark/nsdp.lua +++ b/wireshark/nsdp.lua @@ -61,6 +61,7 @@ local bitrates_codes = { local vlan_type_codes = { + [0] = "disabled", [1] = "port basic", [2] = "port advanced", [3] = "802.1Q basic",