]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: RTM_MISS doesn't always have a gateway
authorRoy Marples <roy@marples.name>
Mon, 2 Sep 2019 11:07:03 +0000 (12:07 +0100)
committerRoy Marples <roy@marples.name>
Mon, 2 Sep 2019 11:07:03 +0000 (12:07 +0100)
And thus no interface to bind to.
Use lo0 in this case.

src/if-bsd.c

index 2a7d677dfc422f5e1885667248d87db2650024c0..8348d42dcfae67b6794360fe90f8bf0f778d5b83 100644 (file)
@@ -707,6 +707,9 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct rt *rt, const struct rt_msghdr *rtm)
        else
                rt->rt_ifp = if_findsa(ctx, rti_info[RTAX_DST]);
 
+       if (rt->rt_ifp == NULL && rtm->rtm_type == RTM_MISS)
+               rt->rt_ifp = if_find(ctx->ifaces, "lo0");
+
        if (rt->rt_ifp == NULL) {
                errno = ESRCH;
                return -1;