From: Roy Marples Date: Mon, 14 Apr 2008 13:29:11 +0000 (+0000) Subject: Fix type for NetBIOS scope, and escape unknown options such as vendor extended options. X-Git-Tag: v4.0.2~492 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74d7286f46726aa29522dd0320ebd01eed6b28ce;p=thirdparty%2Fdhcpcd.git Fix type for NetBIOS scope, and escape unknown options such as vendor extended options. --- diff --git a/dhcp.c b/dhcp.c index 18ef96cf..d328acb1 100644 --- 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) {