Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Skip the scope test for loopback addresses in n...
details: https://anonhg.NetBSD.org/src/rev/b49b227746ef
branches: trunk
changeset: 826625:b49b227746ef
user: christos <christos%NetBSD.org@localhost>
date: Sun Sep 17 17:35:10 2017 +0000
description:
Skip the scope test for loopback addresses in non-loopback interfaces.
While this test is also done in in6_setscope, testing here allows us
to log an error for other callers.
diffstat:
sys/netinet6/in6_src.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r b5a8d38eaeaa -r b49b227746ef sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c Sun Sep 17 15:30:08 2017 +0000
+++ b/sys/netinet6/in6_src.c Sun Sep 17 17:35:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_src.c,v 1.80 2017/08/27 12:34:21 christos Exp $ */
+/* $NetBSD: in6_src.c,v 1.81 2017/09/17 17:35:10 christos Exp $ */
/* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */
/*
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.80 2017/08/27 12:34:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.81 2017/09/17 17:35:10 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -204,6 +204,12 @@
continue;
}
src = ia->ia_addr.sin6_addr;
+
+ /* Skip the scope test in impossible cases */
+ if (!(ifp->if_flags & IFF_LOOPBACK) &&
+ IN6_IS_ADDR_LOOPBACK(&src))
+ continue;
+
if (in6_setscope(&src, ifp, &osrczone) ||
in6_setscope(&src, ifp1, &srczone) ||
osrczone != srczone) {
@@ -614,11 +620,11 @@
dstsock->sin6_addr.s6_addr32[1] == 0 &&
!IN6_IS_ADDR_LOOPBACK(&dstsock->sin6_addr)) {
char ip6buf[INET6_ADDRSTRLEN];
- printf("in6_selectroute: strange destination %s\n",
+ printf("%s: strange destination %s\n", __func__,
IN6_PRINT(ip6buf, &dstsock->sin6_addr));
} else {
char ip6buf[INET6_ADDRSTRLEN];
- printf("in6_selectroute: destination = %s%%%d\n",
+ printf("%s: destination = %s%%%d\n", __func__,
IN6_PRINT(ip6buf, &dstsock->sin6_addr),
dstsock->sin6_scope_id); /* for debug */
}
Home |
Main Index |
Thread Index |
Old Index