From c95266be7384a6e87aa9c95332e695f0b8eca50f Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 2 Jan 2020 11:14:13 +0000 Subject: [PATCH] inet: Allow forcing a host route from an interface without a lease --- src/ipv4.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ipv4.c b/src/ipv4.c index 53550696..961054c3 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -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) { -- 2.47.2