svn commit: r360090 - head/sys/netinet6

Alexander V. Chernikov melifaro at FreeBSD.org
Sun Apr 19 07:27:13 UTC 2020


Author: melifaro
Date: Sun Apr 19 07:27:12 2020
New Revision: 360090
URL: https://svnweb.freebsd.org/changeset/base/360090

Log:
  Fix lookup key generation in fib6_check_urpf().
  
  The version introduced in r359823 assumed D23051
   had been in tree already. As this is not the case yet,
   revert to sockaddr.

Modified:
  head/sys/netinet6/in6_fib.c

Modified: head/sys/netinet6/in6_fib.c
==============================================================================
--- head/sys/netinet6/in6_fib.c	Sun Apr 19 02:49:05 2020	(r360089)
+++ head/sys/netinet6/in6_fib.c	Sun Apr 19 07:27:12 2020	(r360090)
@@ -362,7 +362,7 @@ fib6_check_urpf(uint32_t fibnum, const struct in6_addr
 	struct rib_head *rh;
 	struct radix_node *rn;
 	struct rtentry *rt;
-	struct in6_addr addr;
+	struct sockaddr_in6 sin6;
 	int ret;
 
 	KASSERT((fibnum < rt_numfibs), ("fib6_check_urpf: bad fibnum"));
@@ -370,13 +370,18 @@ fib6_check_urpf(uint32_t fibnum, const struct in6_addr
 	if (rh == NULL)
 		return (0);
 
-	addr = *dst6;
+	/* TODO: radix changes */
+	/* Prepare lookup key */
+	memset(&sin6, 0, sizeof(sin6));
+	sin6.sin6_len = sizeof(struct sockaddr_in6);
+	sin6.sin6_addr = *dst6;
+
 	/* Assume scopeid is valid and embed it directly */
 	if (IN6_IS_SCOPE_LINKLOCAL(dst6))
-		addr.s6_addr16[1] = htons(scopeid & 0xffff);
+		sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff);
 
 	RIB_RLOCK(rh);
-	rn = rh->rnh_matchaddr((void *)&addr, &rh->head);
+	rn = rh->rnh_matchaddr((void *)&sin6, &rh->head);
 	if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
 		rt = RNTORT(rn);
 #ifdef	RADIX_MPATH


More information about the svn-src-all mailing list