changeset 4256:4cc5f8d94727 draft

BSD: move the interface hint up the stack This probably isn't needed, but allows us to hint the interface when not directly setting IFP.
author Roy Marples <roy@marples.name>
date Mon, 16 Apr 2018 09:37:04 +0100
parents 8524a8375483
children 29971caaafc9
files src/if-bsd.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-bsd.c	Sun Apr 15 13:36:36 2018 +0000
+++ b/src/if-bsd.c	Mon Apr 16 09:37:04 2018 +0100
@@ -499,6 +499,7 @@
 		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 (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);