diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bridge.c | 2 | ||||
-rw-r--r-- | sys/net/pfil.c | 12 | ||||
-rw-r--r-- | sys/net/pfil.h | 9 |
3 files changed, 12 insertions, 11 deletions
diff --git a/sys/net/bridge.c b/sys/net/bridge.c index 1d4472e..75f7c30 100644 --- a/sys/net/bridge.c +++ b/sys/net/bridge.c @@ -1009,7 +1009,7 @@ bdg_forward(struct mbuf *m0, struct ifnet *dst) ip->ip_len = ntohs(ip->ip_len); ip->ip_off = ntohs(ip->ip_off); - if (pfil_run_hooks(&inet_pfil_hook, &m0, src, PFIL_IN) != 0) { + if (pfil_run_hooks(&inet_pfil_hook, &m0, src, PFIL_IN, NULL) != 0) { /* NB: hook should consume packet */ return NULL; } diff --git a/sys/net/pfil.c b/sys/net/pfil.c index 942607c..f5fff2a 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -52,7 +52,7 @@ MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_head_list lock", MTX_DEF); static int pfil_list_add(pfil_list_t *, struct packet_filter_hook *, int); static int pfil_list_remove(pfil_list_t *, - int (*)(void *, struct mbuf **, struct ifnet *, int), void *); + int (*)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *); LIST_HEAD(, pfil_head) pfil_head_list = LIST_HEAD_INITIALIZER(&pfil_head_list); @@ -113,7 +113,7 @@ PFIL_WUNLOCK(struct pfil_head *ph) */ int pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, struct ifnet *ifp, - int dir) + int dir, struct inpcb *inp) { struct packet_filter_hook *pfh; struct mbuf *m = *mp; @@ -126,7 +126,7 @@ pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, struct ifnet *ifp, for (pfh = pfil_hook_get(dir, ph); pfh != NULL; pfh = TAILQ_NEXT(pfh, pfil_link)) { if (pfh->pfil_func != NULL) { - rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir); + rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir, inp); if (rv != 0 || m == NULL) break; } @@ -233,7 +233,7 @@ pfil_head_get(int type, u_long val) * PFIL_WAITOK OK to call malloc with M_WAITOK. */ int -pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int), +pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *arg, int flags, struct pfil_head *ph) { struct packet_filter_hook *pfh1 = NULL; @@ -305,7 +305,7 @@ error: * hook list. */ int -pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int), +pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *arg, int flags, struct pfil_head *ph) { int err = 0; @@ -361,7 +361,7 @@ pfil_list_add(pfil_list_t *list, struct packet_filter_hook *pfh1, int flags) */ static int pfil_list_remove(pfil_list_t *list, - int (*func)(void *, struct mbuf **, struct ifnet *, int), void *arg) + int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *arg) { struct packet_filter_hook *pfh; diff --git a/sys/net/pfil.h b/sys/net/pfil.h index 5400a72..ed5a3d0 100644 --- a/sys/net/pfil.h +++ b/sys/net/pfil.h @@ -40,6 +40,7 @@ struct mbuf; struct ifnet; +struct inpcb; /* * The packet filter hooks are designed for anything to call them to @@ -47,7 +48,7 @@ struct ifnet; */ struct packet_filter_hook { TAILQ_ENTRY(packet_filter_hook) pfil_link; - int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int); + int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *); void *pfil_arg; int pfil_flags; }; @@ -84,12 +85,12 @@ struct pfil_head { }; int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, - int); + int, struct inpcb *inp); int pfil_add_hook(int (*func)(void *, struct mbuf **, - struct ifnet *, int), void *, int, struct pfil_head *); + struct ifnet *, int, struct inpcb *), void *, int, struct pfil_head *); int pfil_remove_hook(int (*func)(void *, struct mbuf **, - struct ifnet *, int), void *, int, struct pfil_head *); + struct ifnet *, int, struct inpcb *), void *, int, struct pfil_head *); int pfil_head_register(struct pfil_head *); int pfil_head_unregister(struct pfil_head *); |