Skip to content

Commit 2de751b

Browse files
authored
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.
1 parent a16c625 commit 2de751b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ipv4.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ inet_dhcproutes(rb_tree_t *routes, struct interface *ifp, bool *have_default)
291291
int n;
292292

293293
state = D_CSTATE(ifp);
294-
if (state == NULL || state->state != DHS_BOUND || !state->added)
294+
if (state == NULL || !(state->added & STATE_ADDED))
295295
return 0;
296296

297297
/* An address does have to exist. */
@@ -359,6 +359,8 @@ inet_dhcproutes(rb_tree_t *routes, struct interface *ifp, bool *have_default)
359359
rt->rt_mtu = mtu;
360360
if (!(rt->rt_dflags & RTDF_STATIC))
361361
rt->rt_dflags |= RTDF_DHCP;
362+
if (state->added & STATE_FAKE)
363+
rt->rt_dflags |= RTDF_FAKE;
362364
sa_in_init(&rt->rt_ifa, &state->addr->addr);
363365
if (rb_tree_insert_node(routes, rt) != rt) {
364366
rt_free(rt);

0 commit comments

Comments
 (0)