Increase RA default lifetime.
Currently we have 300s..600s RA interval, so ~450 seconds, and a 6 * 600s, ie. 3600s (1h) lifetime. This means on average about 8 RAs during the lifetime. APF's FRACTION_OF_LIFETIME_TO_FILTER is 6, so the first 3600s / 6 = 600s of RAs are filtered out by a hotspot client Android device. This means we really only get 3600s - 600s = 3000s worth of RAs (after the initial one). Hence, the client will get approximately 3000s / 450s = 6.666 RAs. Thus, assuming a clientside DTIM multiplier of just 2, the client phone only needs to fail a 50/50 coin toss 6 times in a row to lose all 6 of those RAs. That's a 1 in 2**6 = 64 chance, and it gets rerolled every ~450s. Per https://www.codechef.com/wiki/tutorial-expectation expected number of coin flips for getting N consecutive heads is: 2**(N+1) - 2 N=6 --> 2**7-2 = 126 126 * ~450s = 56700s = 15.75h This means failure is expected roughly on the order of 16 hours. By doubling the lifetime from 1h to 2h, we effectively double the number of RAs, and lower the failure chance from 1 in 2**6, to 1 in 2**13, which is 1 in 8K and thus much less failure prone. N=13 -> 2**14-2 = 16382 --> failure expected after ~85 days Test: TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I70db3096db5666bca0c248f2d49f801f333514b3
This commit is contained in:
@@ -88,13 +88,13 @@ public class RouterAdvertisementDaemon {
|
|||||||
private static final int MIN_RTR_ADV_INTERVAL_SEC = 300;
|
private static final int MIN_RTR_ADV_INTERVAL_SEC = 300;
|
||||||
private static final int MAX_RTR_ADV_INTERVAL_SEC = 600;
|
private static final int MAX_RTR_ADV_INTERVAL_SEC = 600;
|
||||||
// In general, router, prefix, and DNS lifetimes are all advised to be
|
// In general, router, prefix, and DNS lifetimes are all advised to be
|
||||||
// greater than or equal to 3 * MAX_RTR_ADV_INTERVAL. Here, we double
|
// greater than or equal to 3 * MAX_RTR_ADV_INTERVAL. Here, we quadruple
|
||||||
// that to allow for multicast packet loss.
|
// that to allow for multicast packet loss.
|
||||||
//
|
//
|
||||||
// This MAX_RTR_ADV_INTERVAL_SEC and DEFAULT_LIFETIME are also consistent
|
// This MAX_RTR_ADV_INTERVAL_SEC and DEFAULT_LIFETIME are also consistent
|
||||||
// with the https://tools.ietf.org/html/rfc7772#section-4 discussion of
|
// with the https://tools.ietf.org/html/rfc7772#section-4 discussion of
|
||||||
// "approximately 7 RAs per hour".
|
// "approximately 7 RAs per hour".
|
||||||
private static final int DEFAULT_LIFETIME = 6 * MAX_RTR_ADV_INTERVAL_SEC;
|
private static final int DEFAULT_LIFETIME = 12 * MAX_RTR_ADV_INTERVAL_SEC;
|
||||||
// From https://tools.ietf.org/html/rfc4861#section-10 .
|
// From https://tools.ietf.org/html/rfc4861#section-10 .
|
||||||
private static final int MIN_DELAY_BETWEEN_RAS_SEC = 3;
|
private static final int MIN_DELAY_BETWEEN_RAS_SEC = 3;
|
||||||
// Both initial and final RAs, but also for changes in RA contents.
|
// Both initial and final RAs, but also for changes in RA contents.
|
||||||
|
|||||||
Reference in New Issue
Block a user