mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-22 10:10:14 -04:00
Replace the two-pass "random start index and wrap around" logic in fctx_getaddresses_nameservers() with a statistically sound Fisher-Yates shuffle. The previous implementation picked a random starting node and did two passes over the linked list to find query candidates. The new logic extracts the available nameservers into a bounded, stack-allocated array of dns_rdata_t structures. This array is then randomized in-place using a Fisher-Yates shuffle. Finally, the shuffled array is traversed sequentially to launch fetches until the dynamic quota (fctx->pending_running >= fetches_allowed) is reached. This guarantees a fair random distribution for outbound queries while properly respecting dynamic query limits, entirely within O(1) memory and without the overhead of linked-list pointer shuffling or multiple dataset traversals. |
||
|---|---|---|
| .. | ||
| dns | ||
| isc | ||
| isccc | ||
| isccfg | ||
| ns | ||
| .gitignore | ||
| meson.build | ||