summaryrefslogtreecommitdiff
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-05-07 05:51:13 +0000
committerMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-05-07 05:51:13 +0000
commit2a4b30b87039ac2f778756d352f7935d8317f8cd (patch)
tree838fe3d2c9b7eccb32786f4725455f2d83f295c2 /sys/net/if_tun.c
parent8370a3080477e7b676b11cf6420090354ccc2e6a (diff)
Prevent virtual interfaces from adding to the random pool.
Also move the sampling into ether_input() where it can happen at the interrupt and not within splnet() processing, which might be less random. Discussed with mickey. OK markus@, mcbride@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 390a1b16ae3..417c350a13f 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.92 2008/05/06 07:18:09 krw Exp $ */
+/* $OpenBSD: if_tun.c,v 1.93 2008/05/07 05:51:12 mpf Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -857,6 +857,9 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
#endif
if (tp->tun_flags & TUN_LAYER2) {
+ /* quirk to not add randomness from a virtual device */
+ atomic_setbits_int(&netisr, (1 << NETISR_RND_DONE));
+
ether_input_mbuf(ifp, top);
ifp->if_ipackets++; /* ibytes are counted in ether_input */
return (0);