]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't mark statically configured IPv4 routes as DHCP.
authorRoy Marples <roy@marples.name>
Mon, 9 Oct 2017 19:21:05 +0000 (20:21 +0100)
committerRoy Marples <roy@marples.name>
Mon, 9 Oct 2017 19:21:05 +0000 (20:21 +0100)
src/dhcp.c
src/ipv4.c
src/route.h

index 6be689fd8a4e51fe9a68390134c93214a6cf0da9..75bcddc793390772b5d563a8215963c73a697b21 100644 (file)
@@ -428,7 +428,6 @@ decode_rfc3442_rt(struct rt_head *routes, struct interface *ifp,
 
                if ((rt = rt_new(ifp)) == NULL)
                        return -1;
-               rt->rt_dflags |= RTDF_DHCP;
 
                /* If we have ocets then we have a destination and netmask */
                dest.s_addr = 0;
@@ -633,7 +632,6 @@ get_option_routes(struct rt_head *routes, struct interface *ifp,
                                continue;
                        if ((rt = rt_new(ifp)) == NULL)
                                return -1;
-                       rt->rt_dflags |= RTDF_DHCP;
 
                        /* A host route is normally set by having the
                         * gateway match the destination or assigned address */
@@ -666,7 +664,6 @@ get_option_routes(struct rt_head *routes, struct interface *ifp,
                while (p < e) {
                        if ((rt = rt_new(ifp)) == NULL)
                                return -1;
-                       rt->rt_dflags |= RTDF_DHCP;
                        memcpy(&gateway.s_addr, p, sizeof(gateway.s_addr));
                        p += 4;
                        sa_in_init(&rt->rt_dest, &dest);
index eb8e62f297b799d610c69f72197a407009374276..116fa009e5d1558ca0ac3f97e31abb06c01d0f56 100644 (file)
@@ -266,7 +266,7 @@ inet_dhcproutes(struct rt_head *routes, struct interface *ifp)
        /* First, add a subnet route. */
        if (!(ifp->flags & IFF_POINTOPOINT) &&
 #ifndef BSD
-               /* BSD adds a route in this instance */
+           /* BSD adds a route in this instance */
            state->addr->mask.s_addr != INADDR_BROADCAST &&
 #endif
            state->addr->mask.s_addr != INADDR_ANY)
@@ -291,6 +291,7 @@ inet_dhcproutes(struct rt_head *routes, struct interface *ifp)
                                break;
                        if ((rt = rt_new(ifp)) == NULL)
                                return -1;
+                       rt->rt_dflags = RTDF_STATIC;
                        memcpy(rt, r, sizeof(*rt));
                        TAILQ_INSERT_TAIL(&nroutes, rt, rt_next);
                }
@@ -319,6 +320,8 @@ inet_dhcproutes(struct rt_head *routes, struct interface *ifp)
        n = 0;
        TAILQ_FOREACH(rt, &nroutes, rt_next) {
                rt->rt_mtu = mtu;
+               if (!(rt->rt_dflags & RTDF_STATIC))
+                       rt->rt_dflags |= RTDF_DHCP;
                sa_in_init(&rt->rt_ifa, &state->addr->addr);
                n++;
        }
index 6080c9d988e8e9d376e1a06d718c7b83189f3e19..9fcd31a8bb12b253fa6f698dea7e40848b8b37fd 100644 (file)
@@ -77,6 +77,7 @@ struct rt {
 #define        RTDF_FAKE               0x04            /* Maybe us on lease reboot  */
 #define        RTDF_RA                 0x08            /* Router Advertisement */
 #define        RTDF_DHCP               0x10            /* DHCP route */
+#define        RTDF_STATIC             0x20            /* Configured in dhcpcd */
 };
 TAILQ_HEAD(rt_head, rt);