MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pf_routable

Function pf_routable

freebsd/netpfil/pf/pf.c:5426–5462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5424}
5425
5426int
5427pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif,
5428 int rtableid)
5429{
5430 struct ifnet *ifp;
5431
5432 /*
5433 * Skip check for addresses with embedded interface scope,
5434 * as they would always match anyway.
5435 */
5436 if (af == AF_INET6 && IN6_IS_SCOPE_EMBED(&addr->v6))
5437 return (1);
5438
5439 if (af != AF_INET && af != AF_INET6)
5440 return (0);
5441
5442 /* Skip checks for ipsec interfaces */
5443 if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC)
5444 return (1);
5445
5446 ifp = (kif != NULL) ? kif->pfik_ifp : NULL;
5447
5448 switch (af) {
5449#ifdef INET6
5450 case AF_INET6:
5451 return (fib6_check_urpf(rtableid, &addr->v6, 0, NHR_NONE,
5452 ifp));
5453#endif
5454#ifdef INET
5455 case AF_INET:
5456 return (fib4_check_urpf(rtableid, addr->v4, 0, NHR_NONE,
5457 ifp));
5458#endif
5459 }
5460
5461 return (0);
5462}
5463
5464#ifdef INET
5465static void

Callers

nothing calls this directly

Calls 2

fib6_check_urpfFunction · 0.85
fib4_check_urpfFunction · 0.85

Tested by

no test coverage detected