Index: net/if.c =================================================================== RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.367 diff -u -p -r1.367 if.c --- net/if.c 10 Sep 2015 14:06:43 -0000 1.367 +++ net/if.c 10 Sep 2015 14:36:49 -0000 @@ -488,7 +488,9 @@ if_input(struct ifnet *ifp, struct mbuf_ struct ifih { struct srpl_entry ifih_next; - int (*ifih_input)(struct ifnet *, struct mbuf *); + int (*ifih_input)(void *, struct ifnet *, + struct mbuf *); + void *ifih_ctx; int ifih_refcnt; int ifih_srpcnt; }; @@ -499,7 +501,8 @@ void if_ih_unref(void *, void *); struct srpl_rc ifih_rc = SRPL_RC_INITIALIZER(if_ih_ref, if_ih_unref, NULL); void -if_ih_insert(struct ifnet *ifp, int (*input)(struct ifnet *, struct mbuf *)) +if_ih_insert(struct ifnet *ifp, + int (*input)(void *, struct ifnet *, struct mbuf *), void *ctx) { struct ifih *ifih; @@ -507,7 +510,7 @@ if_ih_insert(struct ifnet *ifp, int (*in KERNEL_ASSERT_LOCKED(); SRPL_FOREACH_LOCKED(ifih, &ifp->if_inputs, ifih_next) { - if (ifih->ifih_input == input) { + if (ifih->ifih_input == input && ifih->ifih_ctx == ctx) { ifih->ifih_refcnt++; break; } @@ -517,6 +520,7 @@ if_ih_insert(struct ifnet *ifp, int (*in ifih = malloc(sizeof(*ifih), M_DEVBUF, M_WAITOK); ifih->ifih_input = input; + ifih->ifih_ctx = ctx; ifih->ifih_refcnt = 1; ifih->ifih_srpcnt = 0; SRPL_INSERT_HEAD_LOCKED(&ifih_rc, &ifp->if_inputs, @@ -542,7 +546,8 @@ if_ih_unref(void *null, void *i) } void -if_ih_remove(struct ifnet *ifp, int (*input)(struct ifnet *, struct mbuf *)) +if_ih_remove(struct ifnet *ifp, + int (*input)(void *, struct ifnet *, struct mbuf *), void *ctx) { struct sleep_state sls; struct ifih *ifih; @@ -552,7 +557,7 @@ if_ih_remove(struct ifnet *ifp, int (*in KERNEL_ASSERT_LOCKED(); SRPL_FOREACH_LOCKED(ifih, &ifp->if_inputs, ifih_next) { - if (ifih->ifih_input == input) + if (ifih->ifih_input == input && ifih->ifih_ctx == ctx) break; } @@ -617,7 +622,7 @@ if_input_process(void *xmq) * interface until it is consumed. */ SRPL_FOREACH(ifih, &ifp->if_inputs, &i, ifih_next) { - if ((*ifih->ifih_input)(ifp, m)) + if ((*ifih->ifih_input)(ifih->ifih_ctx, ifp, m)) break; } SRPL_LEAVE(&i, ifih); Index: net/if_bridge.c =================================================================== RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.262 diff -u -p -r1.262 if_bridge.c --- net/if_bridge.c 10 Sep 2015 13:32:19 -0000 1.262 +++ net/if_bridge.c 10 Sep 2015 14:36:50 -0000 @@ -223,7 +223,7 @@ bridge_clone_create(struct if_clone *ifc DLT_EN10MB, ETHER_HDR_LEN); #endif - if_ih_insert(ifp, ether_input); + if_ih_insert(ifp, ether_input, NULL); return (0); } @@ -248,7 +248,7 @@ bridge_clone_destroy(struct ifnet *ifp) /* Undo pseudo-driver changes. */ if_deactivate(ifp); - if_ih_remove(ifp, ether_input); + if_ih_remove(ifp, ether_input, NULL); KASSERT(SRPL_EMPTY_LOCKED(&ifp->if_inputs)); Index: net/if_ethersubr.c =================================================================== RCS file: /cvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.222 diff -u -p -r1.222 if_ethersubr.c --- net/if_ethersubr.c 10 Sep 2015 13:32:19 -0000 1.222 +++ net/if_ethersubr.c 10 Sep 2015 14:36:50 -0000 @@ -284,7 +284,7 @@ bad: * the ether header, which is provided separately. */ int -ether_input(struct ifnet *ifp, struct mbuf *m) +ether_input(void *null, struct ifnet *ifp, struct mbuf *m) { struct ether_header *eh; struct niqueue *inq; @@ -506,7 +506,7 @@ ether_ifattach(struct ifnet *ifp) ifp->if_mtu = ETHERMTU; ifp->if_output = ether_output; - if_ih_insert(ifp, ether_input); + if_ih_insert(ifp, ether_input, NULL); if (ifp->if_hardmtu == 0) ifp->if_hardmtu = ETHERMTU; @@ -528,7 +528,7 @@ ether_ifdetach(struct ifnet *ifp) /* Undo pseudo-driver changes. */ if_deactivate(ifp); - if_ih_remove(ifp, ether_input); + if_ih_remove(ifp, ether_input, NULL); KASSERT(SRPL_EMPTY_LOCKED(&ifp->if_inputs)); Index: net/if_mpw.c =================================================================== RCS file: /cvs/src/sys/net/if_mpw.c,v retrieving revision 1.4 diff -u -p -r1.4 if_mpw.c --- net/if_mpw.c 10 Sep 2015 13:32:19 -0000 1.4 +++ net/if_mpw.c 10 Sep 2015 14:36:50 -0000 @@ -62,7 +62,7 @@ int mpw_ioctl(struct ifnet *, u_long, ca int mpw_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); void mpw_start(struct ifnet *); -int mpw_input(struct ifnet *, struct mbuf *); +int mpw_input(void *, struct ifnet *, struct mbuf *); #if NVLAN > 0 struct mbuf *mpw_vlan_handle(struct mbuf *, struct mpw_softc *); #endif /* NVLAN */ @@ -109,7 +109,7 @@ mpw_clone_create(struct if_clone *ifc, i sc->sc_smpls.smpls_len = sizeof(sc->sc_smpls); sc->sc_smpls.smpls_family = AF_MPLS; - if_ih_insert(ifp, mpw_input); + if_ih_insert(ifp, mpw_input, NULL); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, ETHER_HDR_LEN); @@ -133,7 +133,7 @@ mpw_clone_destroy(struct ifnet *ifp) splx(s); } - if_ih_remove(ifp, mpw_input); + if_ih_remove(ifp, mpw_input, NULL); if_detach(ifp); free(sc, M_DEVBUF, sizeof(*sc)); @@ -142,7 +142,7 @@ mpw_clone_destroy(struct ifnet *ifp) } int -mpw_input(struct ifnet *ifp, struct mbuf *m) +mpw_input(void *null, struct ifnet *ifp, struct mbuf *m) { /* Don't have local broadcast. */ m_freem(m); Index: net/if_trunk.c =================================================================== RCS file: /cvs/src/sys/net/if_trunk.c,v retrieving revision 1.110 diff -u -p -r1.110 if_trunk.c --- net/if_trunk.c 10 Sep 2015 13:32:19 -0000 1.110 +++ net/if_trunk.c 10 Sep 2015 14:36:50 -0000 @@ -75,7 +75,7 @@ int trunk_ether_delmulti(struct trunk_s void trunk_ether_purgemulti(struct trunk_softc *); int trunk_ether_cmdmulti(struct trunk_port *, u_long); int trunk_ioctl_allports(struct trunk_softc *, u_long, caddr_t); -int trunk_input(struct ifnet *, struct mbuf *); +int trunk_input(void *, struct ifnet *, struct mbuf *); void trunk_start(struct ifnet *); void trunk_init(struct ifnet *); void trunk_stop(struct ifnet *); @@ -344,7 +344,7 @@ trunk_port_create(struct trunk_softc *tr ifp->if_type = IFT_IEEE8023ADLAG; /* Change input handler of the physical interface. */ - if_ih_insert(ifp, trunk_input); + if_ih_insert(ifp, trunk_input, NULL); ifp->if_tp = (caddr_t)tp; tp->tp_ioctl = ifp->if_ioctl; @@ -437,7 +437,7 @@ trunk_port_destroy(struct trunk_port *tp ifp->if_type = tp->tp_iftype; /* Restore previous input handler. */ - if_ih_remove(ifp, trunk_input); + if_ih_remove(ifp, trunk_input, NULL); ifp->if_watchdog = tp->tp_watchdog; ifp->if_ioctl = tp->tp_ioctl; @@ -1079,7 +1079,7 @@ trunk_watchdog(struct ifnet *ifp) } int -trunk_input(struct ifnet *ifp, struct mbuf *m) +trunk_input(void *ctx, struct ifnet *ifp, struct mbuf *m) { struct trunk_softc *tr; struct trunk_port *tp; Index: net/if_var.h =================================================================== RCS file: /cvs/src/sys/net/if_var.h,v retrieving revision 1.36 diff -u -p -r1.36 if_var.h --- net/if_var.h 10 Sep 2015 13:32:19 -0000 1.36 +++ net/if_var.h 10 Sep 2015 14:36:50 -0000 @@ -408,7 +408,7 @@ void if_input(struct ifnet *, struct mbu void ether_ifattach(struct ifnet *); void ether_ifdetach(struct ifnet *); int ether_ioctl(struct ifnet *, struct arpcom *, u_long, caddr_t); -int ether_input(struct ifnet *, struct mbuf *); +int ether_input(void *, struct ifnet *, struct mbuf *); int ether_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); char *ether_sprintf(u_char *); @@ -440,8 +440,10 @@ void ifa_del(struct ifnet *, struct ifad void ifa_update_broadaddr(struct ifnet *, struct ifaddr *, struct sockaddr *); -void if_ih_insert(struct ifnet *, int (*)(struct ifnet *, struct mbuf *)); -void if_ih_remove(struct ifnet *, int (*)(struct ifnet *, struct mbuf *)); +void if_ih_insert(struct ifnet *, + int (*)(void *, struct ifnet *, struct mbuf *), void *); +void if_ih_remove(struct ifnet *, + int (*)(void *, struct ifnet *, struct mbuf *), void *); void if_rxr_init(struct if_rxring *, u_int, u_int); u_int if_rxr_get(struct if_rxring *, u_int); Index: net/if_vlan.c =================================================================== RCS file: /cvs/src/sys/net/if_vlan.c,v retrieving revision 1.136 diff -u -p -r1.136 if_vlan.c --- net/if_vlan.c 10 Sep 2015 13:32:19 -0000 1.136 +++ net/if_vlan.c 10 Sep 2015 14:36:50 -0000 @@ -79,7 +79,7 @@ u_long vlan_tagmask, svlan_tagmask; LIST_HEAD(vlan_taghash, ifvlan) *vlan_tagh, *svlan_tagh; -int vlan_input(struct ifnet *, struct mbuf *); +int vlan_input(void *, struct ifnet *, struct mbuf *); void vlan_start(struct ifnet *ifp); int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); int vlan_unconfig(struct ifnet *ifp, struct ifnet *newp); @@ -255,7 +255,7 @@ vlan_start(struct ifnet *ifp) * vlan_input() returns 1 if it has consumed the packet, 0 otherwise. */ int -vlan_input(struct ifnet *ifp, struct mbuf *m) +vlan_input(void *null, struct ifnet *ifp, struct mbuf *m) { struct ifvlan *ifv; struct ether_vlan_header *evl; @@ -429,7 +429,7 @@ vlan_config(struct ifvlan *ifv, struct i splx(s); /* Change input handler of the physical interface. */ - if_ih_insert(p, vlan_input); + if_ih_insert(p, vlan_input, NULL); return (0); } @@ -457,7 +457,7 @@ vlan_unconfig(struct ifnet *ifp, struct splx(s); /* Restore previous input handler. */ - if_ih_remove(p, vlan_input); + if_ih_remove(p, vlan_input, NULL); hook_disestablish(p->if_linkstatehooks, ifv->lh_cookie); hook_disestablish(p->if_detachhooks, ifv->dh_cookie); Index: netinet/ip_carp.c =================================================================== RCS file: /cvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.265 diff -u -p -r1.265 ip_carp.c --- netinet/ip_carp.c 10 Sep 2015 13:32:19 -0000 1.265 +++ netinet/ip_carp.c 10 Sep 2015 14:36:51 -0000 @@ -193,7 +193,7 @@ void carp_hmac_generate(struct carp_vhos unsigned char *, u_int8_t); int carp_hmac_verify(struct carp_vhost_entry *, u_int32_t *, unsigned char *); -int carp_input(struct ifnet *ifp, struct mbuf *); +int carp_input(void *, struct ifnet *ifp, struct mbuf *); void carp_proto_input_c(struct mbuf *, struct carp_header *, int, sa_family_t); void carpattach(int); @@ -864,7 +864,7 @@ carpdetach(struct carp_softc *sc) return; /* Restore previous input handler. */ - if_ih_remove(ifp, carp_input); + if_ih_remove(ifp, carp_input, NULL); s = splnet(); if (sc->lh_cookie != NULL) @@ -1411,7 +1411,7 @@ carp_ourether(void *v, u_int8_t *ena) } int -carp_input(struct ifnet *ifp0, struct mbuf *m) +carp_input(void *ifctx, struct ifnet *ifp0, struct mbuf *m) { struct carp_softc *sc; struct ether_header *eh; @@ -1719,7 +1719,7 @@ carp_set_ifp(struct carp_softc *sc, stru carp_carpdev_state, ifp); /* Change input handler of the physical interface. */ - if_ih_insert(ifp, carp_input); + if_ih_insert(ifp, carp_input, NULL); s = splnet(); carp_carpdev_state(ifp);