Changeset View
Changeset View
Standalone View
Standalone View
sys/net/pfil.c
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | else if (rv == PFIL_REALLOCED) { | ||||
realloc = true; | realloc = true; | ||||
} | } | ||||
} | } | ||||
if (realloc && rv == PFIL_PASS) | if (realloc && rv == PFIL_PASS) | ||||
rv = PFIL_REALLOCED; | rv = PFIL_REALLOCED; | ||||
return (rv); | return (rv); | ||||
} | } | ||||
static __always_inline int | |||||
pfil_mbuf_common(pfil_chain_t *pch, pfil_packet_t p, struct ifnet *ifp, | |||||
int flags, struct inpcb *inp) | |||||
{ | |||||
struct pfil_link *link; | |||||
pfil_return_t rv; | |||||
NET_EPOCH_ASSERT(); | |||||
KASSERT(flags == PFIL_IN || flags == PFIL_OUT, | |||||
("%s: unsupported flags %d", __func__, flags)); | |||||
rv = PFIL_PASS; | |||||
CK_STAILQ_FOREACH(link, pch, link_chain) { | |||||
rv = (*link->link_func)(p, ifp, flags, link->link_ruleset, inp); | |||||
if (rv == PFIL_DROPPED || rv == PFIL_CONSUMED) | |||||
break; | |||||
} | |||||
return (rv); | |||||
} | |||||
int | |||||
pfil_mbuf_in(struct pfil_head *head, pfil_packet_t p, struct ifnet *ifp, | |||||
struct inpcb *inp) | |||||
{ | |||||
return (pfil_mbuf_common(&head->head_in, p, ifp, PFIL_IN, inp)); | |||||
} | |||||
int | |||||
pfil_mbuf_out(struct pfil_head *head, pfil_packet_t p, struct ifnet *ifp, | |||||
struct inpcb *inp) | |||||
{ | |||||
return (pfil_mbuf_common(&head->head_out, p, ifp, PFIL_OUT, inp)); | |||||
} | |||||
/* | /* | ||||
* pfil_head_register() registers a pfil_head with the packet filter hook | * pfil_head_register() registers a pfil_head with the packet filter hook | ||||
* mechanism. | * mechanism. | ||||
*/ | */ | ||||
pfil_head_t | pfil_head_t | ||||
pfil_head_register(struct pfil_head_args *pa) | pfil_head_register(struct pfil_head_args *pa) | ||||
{ | { | ||||
struct pfil_head *head, *list; | struct pfil_head *head, *list; | ||||
▲ Show 20 Lines • Show All 467 Lines • Show Last 20 Lines |