summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2018-12-11 01:34:10 +0000
committerdlg <dlg@openbsd.org>2018-12-11 01:34:10 +0000
commit64dc423e660d21c457fbdbb5b37c99e4811b57c5 (patch)
treeab62faf1bcc12128f2a36d75458142eb2ce4ba79
parentdocument ifq_hdatalen() (diff)
downloadwireguard-openbsd-64dc423e660d21c457fbdbb5b37c99e4811b57c5.tar.xz
wireguard-openbsd-64dc423e660d21c457fbdbb5b37c99e4811b57c5.zip
use ifq_hdatalen for handling the FIONREAD ioctl
ok stsp@
-rw-r--r--sys/net/if_tun.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index e08bb61a52d..5675650c7b3 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.182 2018/11/12 06:35:37 dlg Exp $ */
+/* $OpenBSD: if_tun.c,v 1.183 2018/12/11 01:34:10 dlg Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -670,8 +670,7 @@ tun_dev_ioctl(struct tun_softc *tp, u_long cmd, caddr_t data, int flag,
tp->tun_flags &= ~TUN_ASYNC;
break;
case FIONREAD:
- *(int *)data = ifq_empty(&tp->tun_if.if_snd) ?
- 0 : tp->tun_if.if_mtu;
+ *(int *)data = ifq_hdatalen(&tp->tun_if.if_snd);
break;
case TIOCSPGRP:
tp->tun_pgid = *(int *)data;