]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix type for NetBIOS scope, and escape unknown options such as vendor extended options.
authorRoy Marples <roy@marples.name>
Mon, 14 Apr 2008 13:29:11 +0000 (13:29 +0000)
committerRoy Marples <roy@marples.name>
Mon, 14 Apr 2008 13:29:11 +0000 (13:29 +0000)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index 18ef96cfcf36e898b12ee010135140ec31ee8194..d328acb1ee71e4fef2d88055003583550d393605 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -105,7 +105,7 @@ const struct dhcp_option dhcp_options[] = {
        { DHCP_NETBIOSNAMESERVER,       IPV4,   "NETBIOSNAMESERVER" },
        { DHCP_NETBIOSDGRAMSERVER,      IPV4,   "NETBIOSDGRAMSERVER" },
        { DHCP_NETBIOSNODETYPE,         UINT8,  "NETBIOSNODETYPE" },
-       { DHCP_NETBIOSSCOPE,            0,      "NETBIOSSCOPE" },
+       { DHCP_NETBIOSSCOPE,            STRING, "NETBIOSSCOPE" },
        { DHCP_XFONTSERVER,             IPV4,   "XFONTSERVER" },
        { DHCP_XDISPLAYMANAGER,         IPV4,   "XDISPLAYMANAGER" },
        { DHCP_NISPLUSDOMAIN,           IPV4,   "NISPLUSDOMAIN" },
@@ -884,6 +884,19 @@ write_options(FILE *f, const struct dhcp_message *dhcp)
 
                retval += fprintf(f, "%s='", dhcp_options[i].var);
 
+               /* Unknown type, so just print escape codes */
+               if (dhcp_options[i].type == 0) {
+                       p = get_option(dhcp, dhcp_options[i].option);
+                       if (p) {
+                               u8 = *p++;
+                               e = p + u8;
+                               while (p < e) {
+                                       u8 = *p++;
+                                       retval += fprintf(f, "\\%03d", u8);
+                               }
+                       }
+               }
+
                if (dhcp_options[i].type & STRING) {
                        s = get_option_string(dhcp, dhcp_options[i].option);
                        if (s) {