summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-05-15 10:15:13 +0000
committermpi <mpi@openbsd.org>2015-05-15 10:15:13 +0000
commit3bb4b50d4a90ee1eb825171d28c0626cd543c8a5 (patch)
tree87b9277a549f3f0ec8ed231d21dd6b03a5a82242 /sys/net/if_tun.c
parentRemove a NULL check in carp_set_ifp() as we always pass a valid ifp (diff)
downloadwireguard-openbsd-3bb4b50d4a90ee1eb825171d28c0626cd543c8a5.tar.xz
wireguard-openbsd-3bb4b50d4a90ee1eb825171d28c0626cd543c8a5.zip
Introduce if_output(), a function do to the last steps before enqueuing
a packet on the sending queue of an interface. Tested by many, thanks a lot! ok dlg@, claudio@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 5bb0bb26ca8..5316d6d2485 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.139 2015/04/30 15:19:50 mpi Exp $ */
+/* $OpenBSD: if_tun.c,v 1.140 2015/05/15 10:15:13 mpi Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -529,7 +529,7 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
struct rtentry *rt)
{
struct tun_softc *tp = ifp->if_softc;
- int s, len, error;
+ int s, error;
u_int32_t *af;
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
@@ -570,16 +570,13 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
}
#endif
- len = m0->m_pkthdr.len;
- IFQ_ENQUEUE(&ifp->if_snd, m0, NULL, error);
+ error = if_output(ifp, m0);
if (error) {
- splx(s);
ifp->if_collisions++;
return (error);
}
+
splx(s);
- ifp->if_opackets++;
- ifp->if_obytes += len;
tun_wakeup(tp);
return (0);