X-Git-Url: https://git.sur5r.net/?p=ngadmin;a=blobdiff_plain;f=raw%2Fsrc%2Fattr.c;h=aec75843bd1ad4af4e04a4283614924e918bcc62;hp=70f3a18760d21cd434dd5f27da82cb59daa10926;hb=192160f19d388901b44ef62e9265a59282a06ad9;hpb=e45068f68f416238be6b204d22781fe9d4c3b06f diff --git a/raw/src/attr.c b/raw/src/attr.c index 70f3a18..aec7584 100644 --- a/raw/src/attr.c +++ b/raw/src/attr.c @@ -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);