changeset 4912:ef5e02dc19be draft dhcpcd-7

inet: Allow forcing a host route from an interface without a lease
author Roy Marples <roy@marples.name>
date Tue, 31 Dec 2019 14:06:40 +0000
parents cc40e6ce1d5a
children f9341cac877d
files src/ipv4.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv4.c	Fri Dec 20 22:09:20 2019 +0000
+++ b/src/ipv4.c	Tue Dec 31 14:06:40 2019 +0000
@@ -417,7 +417,10 @@
 		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;