Skip to content

Commit 170f528

Browse files
committed
Document limitations of --randomize-hosts
1 parent c491bdc commit 170f528

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,16 @@ This property can be useful in practice, since some routers will accept SNMP or
136136
DNS queries on the zero network address, but answer with their primary IPv6.
137137

138138
Example: scan `3fff:1234:1234:44xx::` -> response from `3fff:1234:1234:44a3:e2a:86ff:fe12:3456`
139+
140+
### Target randomization
141+
142+
The way fi6s randomizes the scanned IPs (`--randomize-hosts 1`, which is the default)
143+
is not perfect.
144+
145+
It will:
146+
* shuffle IPs in batches of 8192
147+
* evenly distribute multiple targets over the duration of the scan (like round-robin)
148+
* however still traverse subnets *sequentially*
149+
150+
For example if you scan `3fff::/108` the order of `3fff::1`, `3fff::20` and `3fff::300` will be random.
151+
But all addresses in `3fff::0:*` will be scanned before `3fff::1:*`, before `3fff::2:*` and so on.

util/ci-test4.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,21 @@ cmp_out expected_out.txt
9494

9595
##
9696

97-
notee=1 try --print-hosts 2c0f::xxxx
98-
check_out "^2c0f::$"
99-
check_out "^2c0f::1$"
100-
check_out "^2c0f::7fff$"
101-
check_out "^2c0f::fffe$"
102-
check_out "^2c0f::ffff$"
97+
for opt in 1 0; do
98+
99+
notee=1 try --randomize-hosts $opt --print-hosts 2c0f::xxxx
100+
check_out "^2c0f::$"
101+
check_out "^2c0f::1$"
102+
check_out "^2c0f::7fff$"
103+
check_out "^2c0f::fffe$"
104+
check_out "^2c0f::ffff$"
105+
106+
if [ $(wc -l <out.txt) -ne $(sort -u out.txt | wc -l) ]; then
107+
echo "duplicates found!"
108+
exit 1
109+
fi
110+
111+
done
103112

104113
##
105114

0 commit comments

Comments
 (0)