summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-01-02 11:14:13 +0000
committerRoy Marples <roy@marples.name>2020-01-02 11:14:13 +0000
commitc95266be7384a6e87aa9c95332e695f0b8eca50f (patch)
tree161cabf85eb11c524f3888631f14a146a388bd8f
parent51880d726a2b15039f0b4f8a052c9b3254eb0691 (diff)
downloaddhcpcd-c95266be7384a6e87aa9c95332e695f0b8eca50f.tar.xz
inet: Allow forcing a host route from an interface without a lease
-rw-r--r--src/ipv4.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ipv4.c b/src/ipv4.c
index 53550696..961054c3 100644
--- a/src/ipv4.c
+++ b/src/ipv4.c
@@ -429,7 +429,10 @@ inet_routerhostroute(rb_tree_t *routes, struct interface *ifp)
in.s_addr = INADDR_ANY;
sa_in_init(&rth->rt_gateway, &in);
rth->rt_mtu = dhcp_get_mtu(ifp);
- sa_in_init(&rth->rt_ifa, &state->addr->addr);
+ if (state->addr != NULL)
+ sa_in_init(&rth->rt_ifa, &state->addr->addr);
+ else
+ rth->rt_ifa.sa_family = AF_UNSPEC;
/* We need to insert the host route just before the router. */
while ((rtp = RB_TREE_MAX(routes)) != NULL) {