diff options
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index e94bcb0d31a..25bd417031d 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.224 2020/07/10 13:26:42 patrick Exp $ */ +/* $OpenBSD: if_tun.c,v 1.225 2020/07/22 02:16:02 dlg Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -115,7 +115,7 @@ int tun_dev_poll(dev_t, int, struct proc *); int tun_dev_kqfilter(dev_t, struct knote *); int tun_ioctl(struct ifnet *, u_long, caddr_t); -int tun_input(struct ifnet *, struct mbuf *, void *); +void tun_input(struct ifnet *, struct mbuf *); int tun_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); int tun_enqueue(struct ifnet *, struct mbuf *); @@ -240,6 +240,7 @@ tun_create(struct if_clone *ifc, int unit, int flags) if_counters_alloc(ifp); if ((flags & TUN_LAYER2) == 0) { + ifp->if_input = tun_input; ifp->if_output = tun_output; ifp->if_mtu = ETHERMTU; ifp->if_flags = (IFF_POINTOPOINT|IFF_MULTICAST); @@ -253,8 +254,6 @@ tun_create(struct if_clone *ifc, int unit, int flags) #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t)); #endif - - if_ih_insert(ifp, tun_input, NULL); } else { sc->sc_flags |= TUN_LAYER2; ether_fakeaddr(ifp); @@ -320,9 +319,7 @@ tun_clone_destroy(struct ifnet *ifp) klist_invalidate(&sc->sc_wsel.si_note); splx(s); - if (!ISSET(sc->sc_flags, TUN_LAYER2)) - if_ih_remove(ifp, tun_input, NULL); - else + if (ISSET(sc->sc_flags, TUN_LAYER2)) ether_ifdetach(ifp); if_detach(ifp); @@ -880,8 +877,8 @@ put: return (error); } -int -tun_input(struct ifnet *ifp, struct mbuf *m0, void *cookie) +void +tun_input(struct ifnet *ifp, struct mbuf *m0) { uint32_t af; @@ -909,8 +906,6 @@ tun_input(struct ifnet *ifp, struct mbuf *m0, void *cookie) m_freem(m0); break; } - - return (1); } /* |