Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/net/lib/libshmif shmif: use cprng_strong32 to gener...



details:   https://anonhg.NetBSD.org/src/rev/58c8bd887a7b
branches:  trunk
changeset: 744991:58c8bd887a7b
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Feb 20 08:06:15 2020 +0000

description:
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.

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 938d87774339 -r 58c8bd887a7b sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Thu Feb 20 08:02:26 2020 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Thu Feb 20 08:06:15 2020 +0000
@@ -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 @@
        uint32_t randnum;
        int error;
 
-       randnum = cprng_fast32();
+       randnum = cprng_strong32();
        memcpy(&enaddr[2], &randnum, sizeof(randnum));
 
        sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);



Home | Main Index | Thread Index | Old Index