From: Roy Marples Date: Tue, 31 Dec 2019 14:06:40 +0000 (+0000) Subject: inet: Allow forcing a host route from an interface without a lease X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ead07a8079eb4863111d1ce8ace76bf0fa53016e;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 7a39c2c5..1c890d36 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -417,7 +417,10 @@ inet_routerhostroute(struct rt_head *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; TAILQ_INSERT_BEFORE(rt, rth, rt_next); } return 0;