From f53e7bdce8527d4879102f8953f486ef6dd8c5eb Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 30 Jul 2014 08:58:42 +0000 Subject: [PATCH] Only bits 1 and 2 are used in the DHCP overload option, so when we encounter the option set the last bit as well to ensure servername and bootfile are only checked once as their check unsets bits 1 and 2. Thanks to Tobias Stoeckmann. --- dhcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dhcp.c b/dhcp.c index fefb549d..13a57592 100644 --- a/dhcp.c +++ b/dhcp.c @@ -203,9 +203,12 @@ get_option(struct dhcpcd_ctx *ctx, goto exit; break; case DHO_OPTIONSOVERLOADED: - /* Ensure we only get this option once */ + /* Ensure we only get this option once by setting + * the last bit as well as the value. + * This is valid because only the first two bits + * actually mean anything in RFC2132 Section 9.3 */ if (!overl) - overl = p[1]; + overl = 0x80 | p[1]; break; } l = *p++; -- 2.47.3