Lines 677-682
Link Here
|
677 |
if (error) |
677 |
if (error) |
678 |
return (error); |
678 |
return (error); |
679 |
} |
679 |
} |
|
|
680 |
switch (tunp->type) { |
681 |
case IFT_PPP: |
682 |
break; |
683 |
/* |
684 |
* NOTE! - Add more types only when the code has |
685 |
* been modified to also reserve the appropriate |
686 |
* data structures. Otherwise any operation on |
687 |
* the device WILL panic() the system due to |
688 |
* a page fault while in kernel mode. |
689 |
*/ |
690 |
default: |
691 |
return (ENODEV); |
692 |
break; |
693 |
} |
680 |
mtx_lock(&tp->tun_mtx); |
694 |
mtx_lock(&tp->tun_mtx); |
681 |
TUN2IFP(tp)->if_mtu = tunp->mtu; |
695 |
TUN2IFP(tp)->if_mtu = tunp->mtu; |
682 |
TUN2IFP(tp)->if_type = tunp->type; |
696 |
TUN2IFP(tp)->if_type = tunp->type; |
Lines 939-952
Link Here
|
939 |
struct tun_softc *tp = dev->si_drv1; |
953 |
struct tun_softc *tp = dev->si_drv1; |
940 |
struct ifnet *ifp = TUN2IFP(tp); |
954 |
struct ifnet *ifp = TUN2IFP(tp); |
941 |
int revents = 0; |
955 |
int revents = 0; |
942 |
struct mbuf *m; |
|
|
943 |
|
956 |
|
944 |
TUNDEBUG(ifp, "tunpoll\n"); |
957 |
TUNDEBUG(ifp, "tunpoll\n"); |
945 |
|
958 |
|
946 |
if (events & (POLLIN | POLLRDNORM)) { |
959 |
if (events & (POLLIN | POLLRDNORM)) { |
947 |
IFQ_LOCK(&ifp->if_snd); |
960 |
IFQ_LOCK(&ifp->if_snd); |
948 |
IFQ_POLL_NOLOCK(&ifp->if_snd, m); |
961 |
if (!IFQ_IS_EMPTY(&ifp->if_snd)) { |
949 |
if (m != NULL) { |
|
|
950 |
TUNDEBUG(ifp, "tunpoll q=%d\n", ifp->if_snd.ifq_len); |
962 |
TUNDEBUG(ifp, "tunpoll q=%d\n", ifp->if_snd.ifq_len); |
951 |
revents |= events & (POLLIN | POLLRDNORM); |
963 |
revents |= events & (POLLIN | POLLRDNORM); |
952 |
} else { |
964 |
} else { |