If we lower the pltime for privacy addresses skew it by
authorflorian <florian@openbsd.org>
Sun, 9 Jul 2017 08:41:47 +0000 (08:41 +0000)
committerflorian <florian@openbsd.org>
Sun, 9 Jul 2017 08:41:47 +0000 (08:41 +0000)
ND6_PRIV_MAX_DESYNC_FACTOR like RFC 4941 tells us to.
Toss in a arc4random_uniform for good measure like the kernel always
did.

sbin/slaacd/engine.c

index d71b36a..6640240 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: engine.c,v 1.4 2017/07/06 15:02:53 florian Exp $      */
+/*     $OpenBSD: engine.c,v 1.5 2017/07/09 08:41:47 florian Exp $      */
 
 /*
  * Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -1708,7 +1708,8 @@ gen_address_proposal(struct slaacd_iface *iface, struct radv *ra, struct
                        addr_proposal->vltime = prefix->vltime;
 
                if (prefix->pltime > ND6_PRIV_PREFERRED_LIFETIME)
-                       addr_proposal->pltime = ND6_PRIV_PREFERRED_LIFETIME;
+                       addr_proposal->pltime = ND6_PRIV_PREFERRED_LIFETIME
+                           - arc4random_uniform(ND6_PRIV_MAX_DESYNC_FACTOR);
                else
                        addr_proposal->pltime = prefix->pltime;
        } else {