]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
IPv4: Ignore DHCP state when building routes (#557)
authorRoy Marples <roy@marples.name>
Thu, 4 Dec 2025 09:26:57 +0000 (09:26 +0000)
committerGitHub <noreply@github.com>
Thu, 4 Dec 2025 09:26:57 +0000 (09:26 +0000)
* IPv4: Ignore DHCP state when building routes

As this will change periodically.
We only care if the state (address) has been added.

Fixes #440 thanks to JognSmit.

src/ipv4.c

index bc7e36342b0986d659892c4c575200ec3a1d43bd..4137e326aeb74e90e06c02a88fff0c2b2f296385 100644 (file)
@@ -291,7 +291,7 @@ inet_dhcproutes(rb_tree_t *routes, struct interface *ifp, bool *have_default)
        int n;
 
        state = D_CSTATE(ifp);
-       if (state == NULL || state->state != DHS_BOUND || !state->added)
+       if (state == NULL || !(state->added & STATE_ADDED))
                return 0;
 
        /* An address does have to exist. */
@@ -359,6 +359,8 @@ inet_dhcproutes(rb_tree_t *routes, struct interface *ifp, bool *have_default)
                rt->rt_mtu = mtu;
                if (!(rt->rt_dflags & RTDF_STATIC))
                        rt->rt_dflags |= RTDF_DHCP;
+               if (state->added & STATE_FAKE)
+                       rt->rt_dflags |= RTDF_FAKE;
                sa_in_init(&rt->rt_ifa, &state->addr->addr);
                if (rb_tree_insert_node(routes, rt) != rt) {
                        rt_free(rt);