| 220 | |
| 221 | #ifndef FIB_ALGO |
| 222 | static struct nhop_object * |
| 223 | lookup_nhop(uint32_t fibnum, const struct in6_addr *dst6, |
| 224 | uint32_t scopeid) |
| 225 | { |
| 226 | RIB_RLOCK_TRACKER; |
| 227 | struct rib_head *rh; |
| 228 | struct radix_node *rn; |
| 229 | struct nhop_object *nh; |
| 230 | |
| 231 | KASSERT((fibnum < rt_numfibs), ("fib6_check_urpf: bad fibnum")); |
| 232 | rh = rt_tables_get_rnh(fibnum, AF_INET6); |
| 233 | if (rh == NULL) |
| 234 | return (NULL); |
| 235 | |
| 236 | /* Prepare lookup key */ |
| 237 | struct sockaddr_in6 sin6 = { |
| 238 | .sin6_len = sizeof(struct sockaddr_in6), |
| 239 | .sin6_addr = *dst6, |
| 240 | }; |
| 241 | |
| 242 | /* Assume scopeid is valid and embed it directly */ |
| 243 | if (IN6_IS_SCOPE_LINKLOCAL(dst6)) |
| 244 | sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); |
| 245 | |
| 246 | nh = NULL; |
| 247 | RIB_RLOCK(rh); |
| 248 | rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); |
| 249 | if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) |
| 250 | nh = RNTORT(rn)->rt_nhop; |
| 251 | RIB_RUNLOCK(rh); |
| 252 | |
| 253 | return (nh); |
| 254 | } |
| 255 | #endif |
| 256 | |
| 257 | /* |
no test coverage detected