From: Roy Marples Date: Thu, 2 Jan 2020 11:14:13 +0000 (+0000) Subject: inet: Allow forcing a host route from an interface without a lease X-Git-Tag: v8.1.5~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c95266be7384a6e87aa9c95332e695f0b8eca50f;p=thirdparty%2Fdhcpcd.git inet: Allow forcing a host route from an interface without a lease --- 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) {