]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't always request classless_static_routes, instead add it to dhcpcd.conf
authorRoy Marples <roy@marples.name>
Sat, 17 Oct 2009 15:31:39 +0000 (15:31 +0000)
committerRoy Marples <roy@marples.name>
Sat, 17 Oct 2009 15:31:39 +0000 (15:31 +0000)
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.

configure.c
dhcp.c
dhcp.h
dhcpcd.conf

index 828a8f9dbdbd672be92d82f9144f52b59fc721d7..982da77bcc92e218887a0b974a03c315a6d70abc 100644 (file)
@@ -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 be08c004c7f9999b4a348d33c1b7ebd5eaa08c33..0bbcf5a42dc28ac03002ba1dcaff2bbc1125966f 100644 (file)
--- 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 a53e292287909b413d9a0cb1d090df3d082a7686..c9ebfd25aa0c4f2984a28c745537e7e78dae5a03 100644 (file)
--- 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 *);
 
index f6a4ebe400fe3995c0be2678245832877e179957..eb625a70cbe835cac5afd9b9ec5d1cf12647839f 100644 (file)
@@ -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.