Module Name: src
Committed By: ozaki-r
Date: Thu Feb 20 08:06:15 UTC 2020
Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c
Log Message:
shmif: use cprng_strong32 to generate random bytes for a MAC address
cprng_fast32 sometimes returns indentical bytes, which look
"20:0e:11:33" in a MAC address, on different rump_server instances.
That leads MAC address duplications resulting in a test failure.
Fix it by using cprng_strong32 instead of cprng_fast32. However
we should rather fix cprng_fast32 (or rump itself) somehow.
The fix mitigates PR kern/54897 but test failures due to other
causes still remain.
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/rump/net/lib/libshmif/if_shmem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.77 src/sys/rump/net/lib/libshmif/if_shmem.c:1.78
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.77 Sat Feb 1 22:38:31 2020
+++ src/sys/rump/net/lib/libshmif/if_shmem.c Thu Feb 20 08:06:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_shmem.c,v 1.77 2020/02/01 22:38:31 thorpej Exp $ */
+/* $NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.77 2020/02/01 22:38:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -166,7 +166,7 @@ allocif(int unit, struct shmif_sc **scp)
uint32_t randnum;
int error;
- randnum = cprng_fast32();
+ randnum = cprng_strong32();
memcpy(&enaddr[2], &randnum, sizeof(randnum));
sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);