| 2423 | #endif /* INVARIANTS */ |
| 2424 | |
| 2425 | static void |
| 2426 | syncookie_reseed(void *arg) |
| 2427 | { |
| 2428 | struct tcp_syncache *sc = arg; |
| 2429 | uint8_t *secbits; |
| 2430 | int secbit; |
| 2431 | |
| 2432 | /* |
| 2433 | * Reseeding the secret doesn't have to be protected by a lock. |
| 2434 | * It only must be ensured that the new random values are visible |
| 2435 | * to all CPUs in a SMP environment. The atomic with release |
| 2436 | * semantics ensures that. |
| 2437 | */ |
| 2438 | secbit = (sc->secret.oddeven & 0x1) ? 0 : 1; |
| 2439 | secbits = sc->secret.key[secbit]; |
| 2440 | arc4rand(secbits, SYNCOOKIE_SECRET_SIZE, 0); |
| 2441 | atomic_add_rel_int(&sc->secret.oddeven, 1); |
| 2442 | |
| 2443 | /* Reschedule ourself. */ |
| 2444 | callout_schedule(&sc->secret.reseed, SYNCOOKIE_LIFETIME * hz); |
| 2445 | } |
| 2446 | |
| 2447 | /* |
| 2448 | * We have overflowed a bucket. Let's pause dealing with the syncache. |
nothing calls this directly
no test coverage detected