]> 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>
Tue, 31 Dec 2019 14:06:40 +0000 (14:06 +0000)
committerRoy Marples <roy@marples.name>
Tue, 31 Dec 2019 14:06:40 +0000 (14:06 +0000)
src/ipv4.c

index 7a39c2c5d0ddd5e8899df6ed98a5cd44b1cbb92b..1c890d36b0e93bcc75374377770daace8f77a882 100644 (file)
@@ -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;