diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-05-26 11:36:27 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-05-26 11:36:27 +0000 |
commit | c131d7b17ae570506fe74b23bf380bbf5e896a70 (patch) | |
tree | efc53dd51c347a252220fcc0c3874a664121cff2 /sys | |
parent | 0e54373f96ecf85bcf89415c5a719a6cf29d6f0e (diff) |
move add_net_randomness from ether_input to the if_input task.
change it from feeding the ethertype of the packet (which is almost
certainly an ip packet or vlan packet, so not that variable) to the
number of packets about to be processed.
ok deraadt@ mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 6 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 9 | ||||
-rw-r--r-- | sys/net/if_tun.c | 5 | ||||
-rw-r--r-- | sys/net/netisr.h | 3 |
4 files changed, 8 insertions, 15 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index b740c41467a..7f6a88e0bc5 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.333 2015/05/20 08:28:54 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.334 2015/05/26 11:36:26 dlg Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -81,6 +81,8 @@ #include <sys/sysctl.h> #include <sys/task.h> +#include <dev/rndvar.h> + #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> @@ -523,6 +525,8 @@ if_input_process(void *xmq) if (ml_empty(&ml)) return; + add_net_randomness(ml_len(&ml)); + KERNEL_LOCK(); s = splnet(); while ((m = ml_dequeue(&ml)) != NULL) { diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 1d023091a48..3fe86227a93 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.199 2015/05/19 11:09:24 mpi Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.200 2015/05/26 11:36:26 dlg Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -99,8 +99,6 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>. #include <netinet/if_ether.h> #include <netinet/ip_ipsp.h> -#include <dev/rndvar.h> - #if NBPFILTER > 0 #include <net/bpf.h> #endif @@ -476,11 +474,6 @@ ether_input(struct mbuf *m, void *hdr) etype = ntohs(eh->ether_type); - if (!(netisr & (1 << NETISR_RND_DONE))) { - add_net_randomness(etype); - atomic_setbits_int(&netisr, (1 << NETISR_RND_DONE)); - } - #if NBRIDGE > 0 /* * Tap the packet off here for a bridge, if configured and diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index c66c95b9c1a..c4ea429615c 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.143 2015/05/20 08:28:54 mpi Exp $ */ +/* $OpenBSD: if_tun.c,v 1.144 2015/05/26 11:36:26 dlg Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -882,9 +882,6 @@ 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)); - s = splnet(); ether_input_mbuf(ifp, top); splx(s); diff --git a/sys/net/netisr.h b/sys/net/netisr.h index 9d09d25048b..5aba72daa11 100644 --- a/sys/net/netisr.h +++ b/sys/net/netisr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netisr.h,v 1.40 2014/08/10 07:28:32 guenther Exp $ */ +/* $OpenBSD: netisr.h,v 1.41 2015/05/26 11:36:26 dlg Exp $ */ /* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */ /* @@ -50,7 +50,6 @@ * interrupt used for scheduling the network code to calls * on the lowest level routine of each protocol. */ -#define NETISR_RND_DONE 1 #define NETISR_IP 2 /* same as AF_INET */ #define NETISR_TX 3 /* for if_snd processing */ #define NETISR_MPLS 4 /* AF_MPLS would overflow */ |