From: Roy Marples Date: Thu, 4 Dec 2025 09:26:57 +0000 (+0000) Subject: IPv4: Ignore DHCP state when building routes (#557) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2de751b3691642151a4fdc49e444d6b4dc364e98;p=thirdparty%2Fdhcpcd.git IPv4: Ignore DHCP state when building routes (#557) * 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. --- diff --git a/src/ipv4.c b/src/ipv4.c index bc7e3634..4137e326 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -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);