We will choose the first one in the list that is large enough to support
the number of hosts chosen. This speeds up scanning small networks considerably:
e.g. /16s can be scanned in <200ms (+ cooldown)
This allows us to lookup an index -> ip address much faster
(16 seconds for ~3.7 billion addresses with sparse blacklist,
vs 65 sec before radix array).
Setting the PREFIX_LEN to /20, as this appears to give a good tradeoff
between radix population time (<1ms), runtime (16s), and memory footprint (4MB).
ICMP responses (e.g. DEST_UNREACH) to UDP probes (generally)
contain the IP/UDP packet that ellicited the response, though
they do not have to come from the host we sent them to (e.g.
NETWORK_UNREACH). We will "correct" this by switching the saddr
fieldset to be the host we WOULD have received a response from
There is probably a slight performance hit, but if you're
scanning with ZMap through a VPN, you probably don't care THAT
much about performance anyway...(also we only add a memcpy for
all accepted packets)
When a user specifies a `-i tun0` flag for a VPN interface,
this interface expects raw IP packets, not ethernet frames.
The --vpn option allows you to send only IP packets to the
specified interface, and also performs some hacks on the receive
end to ensure we can process the results.
TODO: malloc a fake ethernet header for probe_modules.process_packet
(or better yet, make process_packet always take an IP packet, they
all seem to be implicitly doing that anyway).