]> git.sur5r.net Git - ngadmin/commitdiff
Merge remote-tracking branch 'upstream/master' master
authorAlkorin <github@alkorin.fr>
Wed, 5 Oct 2016 18:00:33 +0000 (20:00 +0200)
committerAlkorin <github@alkorin.fr>
Wed, 5 Oct 2016 18:00:33 +0000 (20:00 +0200)
cli/src/com_netconf.c
lib/src/network.c
lib/src/ports.c

index 277d750c5fb1e561fb06811687a07c5de23d0d52..9831be76e324734c7249e1bebb3cb9e1b6809b1e 100644 (file)
@@ -55,7 +55,7 @@ int do_netconf_set (int argc, const char **argv, struct ngadmin *nga)
                        if (strcasecmp(argv[k + 1], "yes") == 0) {
                                nc.dhcp = true;
                        } else if (strcasecmp(argv[k + 1], "no") == 0) {
-                               nc.dhcp = 1;
+                               nc.dhcp = false;
                        } else {
                                printf("Incorrect DHCP value\n");
                                ret = 1;
index f53b4756d5914a8c05706ffd2eef1cd948ff6db5..eae74965b30aceeafb32027f0d216a3115dea836 100644 (file)
@@ -371,10 +371,15 @@ int extractSwitchAttributes (struct swi_attr *sa, const List *l)
                        break;
                
                case ATTR_DHCP:
-                       /* Note: DHCP attribute is special, it is 2 two bytes long when sent
-                        * by the switch but only 1 byte long when sent by the client
+                       /* Note: DHCP attribute is special, on read request some
+                        * switches send a 2 two bytes attribute and others a
+                        * 1 byte attribute, while all seem to accept a 1 byte
+                        * attribute on write request
                         */
-                       sa->nc.dhcp = (at->size == 2) && ((*(unsigned short*)at->data) == 1);
+                       if (at->size == 1)
+                               sa->nc.dhcp = ((*(unsigned char*)at->data) == 1);
+                       else if (at->size == 2)
+                               sa->nc.dhcp = ((*(unsigned short*)at->data) == 1);
                        break;
                
                case ATTR_FIRM_VER:
index 99f8b48aedf91ba10eba454e5fde7b7f86af8348..f5243e576d2291847ebde0fd82a7d12060669056 100644 (file)
@@ -187,7 +187,6 @@ end:
 int ngadmin_getLoopDetectionState (struct ngadmin *nga, int *s)
 {
        List *attr;
-       ListNode *ln;
        struct attr *at;
        int ret = ERR_OK;