]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
inet: Allow forcing a host route from an interface without a lease
authorRoy Marples <roy@marples.name>
Thu, 2 Jan 2020 11:14:13 +0000 (11:14 +0000)
committerRoy Marples <roy@marples.name>
Thu, 2 Jan 2020 11:14:13 +0000 (11:14 +0000)
src/ipv4.c

index 53550696048b55cf94225ab61f5b4d36a87320df..961054c39c6b29a10ec80895cad643f615fa1d35 100644 (file)
@@ -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) {