]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: move the interface hint up the stack
authorRoy Marples <roy@marples.name>
Mon, 16 Apr 2018 08:37:04 +0000 (09:37 +0100)
committerRoy Marples <roy@marples.name>
Mon, 16 Apr 2018 08:37:04 +0000 (09:37 +0100)
This probably isn't needed, but allows us to hint the interface
when not directly setting IFP.

src/if-bsd.c

index 7cd61903f25890169e9131dfa92db6802a6d1c4d..c3c95ba6b054e447a547ac69fa7a2ccd9bf6cf43 100644 (file)
@@ -499,6 +499,7 @@ if_route(unsigned char cmd, const struct rt *rt)
                if (!(rtm->rtm_flags & RTF_REJECT) &&
                    !sa_is_loopback(&rt->rt_gateway))
                {
+                       rtm->rtm_index = (unsigned short)rt->rt_ifp->index;
                        if (!gateway_unspec)
                                rtm->rtm_addrs |= RTA_IFP;
                        if (!sa_is_unspecified(&rt->rt_ifa))
@@ -572,10 +573,8 @@ if_route(unsigned char cmd, const struct rt *rt)
        if (rtm->rtm_addrs & RTA_NETMASK)
                ADDSA(&rt->rt_netmask);
 
-       if (rtm->rtm_addrs & RTA_IFP) {
-               rtm->rtm_index = (unsigned short)rt->rt_ifp->index;
+       if (rtm->rtm_addrs & RTA_IFP)
                ADDSA((struct sockaddr *)&sdl);
-       }
 
        if (rtm->rtm_addrs & RTA_IFA)
                ADDSA(&rt->rt_ifa);