1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00

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.
This commit is contained in:
Alexander V. Chernikov 2020-04-19 07:27:12 +00:00
parent 72a600a7a1
commit d98351e13c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360090

View File

@ -362,7 +362,7 @@ fib6_check_urpf(uint32_t fibnum, const struct in6_addr *dst6,
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 *dst6,
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