changeset 4972:c38657775fb4 draft

BSD: Disable checking rtm_pid and comment why. It's because we turn off SO_USELOOPBACK. Also note that this trick does NOT work for addresses.
author Roy Marples <roy@marples.name>
date Thu, 16 Jan 2020 21:56:35 +0000
parents d050161827d1
children 61580c15b4fb
files src/if-bsd.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-bsd.c	Thu Jan 16 21:47:27 2020 +0000
+++ b/src/if-bsd.c	Thu Jan 16 21:56:35 2020 +0000
@@ -1250,10 +1250,14 @@
 	if (ctx->ps_root_pid != 0) {
 		if (rtm->rtm_pid == ctx->ps_root_pid)
 			return 0;
-	} else
+	}
 #endif
-		if (rtm->rtm_pid == getpid())
-			return 0;
+
+#if 0
+	/* Not needed because we turn off SO_USELOOPBACK. */
+	if (rtm->rtm_pid == getpid())
+		return 0;
+#endif
 
 	if (if_copyrt(ctx, &rt, rtm) == -1)
 		return errno == ENOTSUP ? 0 : -1;
@@ -1303,6 +1307,8 @@
 			return 0;
 	} else
 #endif
+		/* address management is done via ioctl, so SO_USELOOPBACK
+		 * has no effect, so we do need to check the pid. */
 		if (ifam->ifam_pid == getpid())
 			return 0;
 	pid = ifam->ifam_pid;