Index: if_tun.c =================================================================== RCS file: /cvs/src/sys/net/if_tun.c,v retrieving revision 1.189 diff -u -p -r1.189 if_tun.c --- if_tun.c 12 Sep 2019 01:28:29 -0000 1.189 +++ if_tun.c 12 Sep 2019 01:37:36 -0000 @@ -1008,9 +1008,6 @@ tun_dev_poll(struct tun_softc *tp, int e * * The tun driver uses an array of tun_softc's based on the minor number * of the device. kn->kn_hook gets set to the specific tun_softc. - * - * filt_tunread() sets kn->kn_data to the iface qsize - * filt_tunwrite() sets kn->kn_data to the MTU size */ int tunkqfilter(dev_t dev, struct knote *kn) @@ -1082,7 +1079,6 @@ filt_tunread(struct knote *kn, long hint { struct tun_softc *tp; struct ifnet *ifp; - unsigned int len; if (kn->kn_status & KN_DETACHED) { kn->kn_data = 0; @@ -1092,16 +1088,9 @@ filt_tunread(struct knote *kn, long hint tp = (struct tun_softc *)kn->kn_hook; ifp = &tp->tun_if; - len = IFQ_LEN(&ifp->if_snd); - if (len > 0) { - kn->kn_data = len; + kn->kn_data = ifq_hdatalen(&ifp->if_snd); - TUNDEBUG(("%s: tunkqread q=%d\n", ifp->if_xname, - IFQ_LEN(&ifp->if_snd))); - return (1); - } - TUNDEBUG(("%s: tunkqread waiting\n", ifp->if_xname)); - return (0); + return (kn->kn_data > 0); } void @@ -1131,7 +1120,7 @@ filt_tunwrite(struct knote *kn, long hin tp = (struct tun_softc *)kn->kn_hook; ifp = &tp->tun_if; - kn->kn_data = ifp->if_mtu; + kn->kn_data = ifp->if_hdrlen + ifp->if_hardmtu; return (1); }