From: Roy Marples Date: Sat, 17 Oct 2009 15:31:39 +0000 (+0000) Subject: Don't always request classless_static_routes, instead add it to dhcpcd.conf X-Git-Tag: v5.1.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae92a9b5bb894e2aadd68c97b4904b3fd9075447;p=thirdparty%2Fdhcpcd.git Don't always request classless_static_routes, instead add it to dhcpcd.conf as a default option. Add a debug message when adding classless_static_routes. This is because some DHCP servers have this option badly setup and it could not be otherwise disabled. --- diff --git a/configure.c b/configure.c index 828a8f9d..982da77b 100644 --- a/configure.c +++ b/configure.c @@ -547,7 +547,7 @@ get_routes(const struct interface *iface) return nrt; } - return get_option_routes(iface->state->new); + return get_option_routes(iface->name, iface->state->new); } static struct rt * diff --git a/dhcp.c b/dhcp.c index be08c004..0bbcf5a4 100644 --- a/dhcp.c +++ b/dhcp.c @@ -71,7 +71,7 @@ static const struct dhcp_opt const dhcp_opts[] = { /* RFC 3442 states that the CSR has to come before all other * routes. For completeness, we also specify static routes, * then routers. */ - { 121, RFC3442 | REQUEST, "classless_static_routes" }, + { 121, RFC3442, "classless_static_routes" }, { 249, RFC3442, "ms_classless_static_routes" }, { 33, IPV4 | ARRAY | REQUEST, "static_routes" }, { 3, IPV4 | ARRAY | REQUEST, "routers" }, @@ -701,7 +701,7 @@ route_netmask(uint32_t ip_in) * If we have a CSR then we only use that. * Otherwise we add static routes and then routers. */ struct rt * -get_option_routes(const struct dhcp_message *dhcp) +get_option_routes(const char *ifname, const struct dhcp_message *dhcp) { const uint8_t *p; const uint8_t *e; @@ -716,8 +716,11 @@ get_option_routes(const struct dhcp_message *dhcp) p = get_option(dhcp, DHO_MSCSR, &len, NULL); if (p) { routes = decode_rfc3442_rt(len, p); - if (routes) + if (routes) { + syslog(LOG_DEBUG, "%s: using Classless Static Routes (RFC3442)", + ifname); return routes; + } } /* OK, get our static routes first. */ diff --git a/dhcp.h b/dhcp.h index a53e2922..c9ebfd25 100644 --- a/dhcp.h +++ b/dhcp.h @@ -184,7 +184,7 @@ int get_option_uint8(uint8_t *, const struct dhcp_message *, uint8_t); #define is_bootp(m) (m && \ !IN_LINKLOCAL(htonl((m)->yiaddr)) && \ get_option_uint8(NULL, m, DHO_MESSAGETYPE) == -1) -struct rt *get_option_routes(const struct dhcp_message *); +struct rt *get_option_routes(const char *, const struct dhcp_message *); ssize_t configure_env(char **, const char *, const struct dhcp_message *, const struct if_options *); diff --git a/dhcpcd.conf b/dhcpcd.conf index f6a4ebe4..eb625a70 100644 --- a/dhcpcd.conf +++ b/dhcpcd.conf @@ -10,6 +10,7 @@ hostname # A list of options to request from the DHCP server. option domain_name_servers, domain_name, domain_search, host_name +option classless_static_routes # Most distributions have NTP support. option ntp_servers # Respect the network MTU.