]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only bits 1 and 2 are used in the DHCP overload option, so when we encounter
authorRoy Marples <roy@marples.name>
Wed, 30 Jul 2014 08:58:42 +0000 (08:58 +0000)
committerRoy Marples <roy@marples.name>
Wed, 30 Jul 2014 08:58:42 +0000 (08:58 +0000)
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

diff --git a/dhcp.c b/dhcp.c
index fefb549d740c6b1dc38b078a1e15491ff7a4293e..13a5759272475c05ab5162adce95b3a2a493be36 100644 (file)
--- 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++;