summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-05-26 14:58:56 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-05-26 14:58:56 +0000
commitaefa54cee75b424651419b62d606a4bcfe14859b (patch)
tree41864e37e2d85fa4755a42ffa9dd372155e5d20a /sys/net/if.c
parent251ec88e8e0c79792066e10548ef4fd68aad0aac (diff)
Extract more randomness from mbuf flow
Input bits of the mbuf list head to enqueue_randomness(). While the set of mbufs in circulation is relatively stable, the order in which they reach if_input_process() is unpredictable. Shuffling can happen in many subsystems, such as the network stack, device drivers, and memory management. OK deraadt@ mpi@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 176fcf849fd..b3a4e857598 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.603 2020/04/12 07:04:03 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.604 2020/05/26 14:58:55 visa Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -85,6 +85,7 @@
#include <sys/atomic.h>
#include <sys/percpu.h>
#include <sys/proc.h>
+#include <sys/stdint.h> /* uintptr_t */
#include <dev/rndvar.h>
@@ -924,7 +925,7 @@ if_input_process(struct ifnet *ifp, struct mbuf_list *ml)
return;
if (!ISSET(ifp->if_xflags, IFXF_CLONED))
- enqueue_randomness(ml_len(ml));
+ enqueue_randomness(ml_len(ml) ^ (uintptr_t)MBUF_LIST_FIRST(ml));
/*
* We grab the NET_LOCK() before processing any packet to