changeset 4467:4e3feb48fffb draft

sun: Set RTA_IFP and RTA_IFA again for default routes Note that RTA_IFA doesn't actually work with the kernel and RTA_SRC doesn't work with RTF_GATEWAY which is more important.
author Roy Marples <roy@marples.name>
date Sun, 21 Apr 2019 20:14:42 +0000
parents bbc28f477a10
children 714f593946d5
files src/if-sun.c
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-sun.c	Sun Apr 21 00:11:05 2019 +0300
+++ b/src/if-sun.c	Sun Apr 21 20:14:42 2019 +0000
@@ -547,15 +547,16 @@
 
 		rtm->rtm_flags |= RTF_UP;
 		if (!(rtm->rtm_flags & RTF_REJECT) &&
-		    !sa_is_loopback(&rt->rt_gateway) &&
-		    /* Solaris doesn't like interfaces on default routes. */
-		    !sa_is_unspecified(&rt->rt_dest))
+		    !sa_is_loopback(&rt->rt_gateway))
 		{
 			rtm->rtm_addrs |= RTA_IFP;
-#if 0
+			/* RTA_IFA is currently ignored by the kernel.
+			 * RTA_SRC and RTF_SETSRC look like what we want,
+			 * but they don't work with RTF_GATEWAY.
+			 * We set RTA_IFA just in the hope that the
+			 * kernel will one day support this. */
 			if (!sa_is_unspecified(&rt->rt_ifa))
 				rtm->rtm_addrs |= RTA_IFA;
-#endif
 		}
 
 		if (netmask_bcast)
@@ -594,14 +595,13 @@
 		ADDSA((struct sockaddr *)&sdl);
 	}
 
-	if (rtm->rtm_addrs & RTA_IFA) {
+	if (rtm->rtm_addrs & RTA_IFA)
 		ADDSA(&rt->rt_ifa);
-		rtm->rtm_addrs |= RTA_SRC;
-	}
+
+#if 0
 	if (rtm->rtm_addrs & RTA_SRC)
 		ADDSA(&rt->rt_ifa);
-
-#undef ADDSA
+#endif
 
 	rtm->rtm_msglen = (unsigned short)(bp - (char *)rtm);
 }