]> git.sur5r.net Git - ngadmin/blobdiff - raw/src/attr.c
Fix network configuration modification
[ngadmin] / raw / src / attr.c
index 70f3a18760d21cd434dd5f27da82cb59daa10926..aec75843bd1ad4af4e04a4283614924e918bcc62 100644 (file)
@@ -556,8 +556,16 @@ static int processAttr (struct attr *at, bool encode)
                return 0;
        
        case ATTR_DHCP:
-               if (at->size != 2)
+               /* 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
+                */
+               if (at->size == 1) {
+                       *byte = (*byte != 0);
+                       return 0;
+               } else if (at->size > 2) {
                        return -EMSGSIZE;
+               }
                
                if (!encode)
                        *word = ntohs(*word);