]> 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:42 +0000 (11:14 +0000)
src/ipv4.c

index 2d1c24268ebb68fd7324cd4160deaf352d23ed36..50180e85d64dd196139047d4a432e8db539858d1 100644 (file)
@@ -430,7 +430,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) {