| 211 | |
| 212 | #ifndef FIB_ALGO |
| 213 | static struct nhop_object * |
| 214 | lookup_nhop(uint32_t fibnum, struct in_addr dst, uint32_t scopeid) |
| 215 | { |
| 216 | RIB_RLOCK_TRACKER; |
| 217 | struct rib_head *rh; |
| 218 | struct radix_node *rn; |
| 219 | struct nhop_object *nh; |
| 220 | |
| 221 | KASSERT((fibnum < rt_numfibs), ("fib4_check_urpf: bad fibnum")); |
| 222 | rh = rt_tables_get_rnh(fibnum, AF_INET); |
| 223 | if (rh == NULL) |
| 224 | return (NULL); |
| 225 | |
| 226 | /* Prepare lookup key */ |
| 227 | struct sockaddr_in sin4; |
| 228 | memset(&sin4, 0, sizeof(sin4)); |
| 229 | sin4.sin_len = sizeof(struct sockaddr_in); |
| 230 | sin4.sin_addr = dst; |
| 231 | |
| 232 | nh = NULL; |
| 233 | RIB_RLOCK(rh); |
| 234 | rn = rh->rnh_matchaddr((void *)&sin4, &rh->head); |
| 235 | if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) |
| 236 | nh = RNTORT(rn)->rt_nhop; |
| 237 | RIB_RUNLOCK(rh); |
| 238 | |
| 239 | return (nh); |
| 240 | } |
| 241 | #endif |
| 242 | |
| 243 | /* |
no test coverage detected