netpfil tests: improve pft_ping.py
Multiple improvements to pft_ping.py:
- Automatically use IPv6 when IPv6 addresses are used, --ip6 is not needed.
- Building of ping requests and parsing of ping replies is done layer by layer. This way most arguments are available both for IPv6 and IPv4, for ICMP and TCP.
- Use argument groups for improved readability.
- Change ToS and TTL argument name to TC and HL to reflect the modern IPv6 nomenclature. The argument still set related IPv4 header fields properly.
- Instead of sniffing for the very specific case of duplicated packets, allow for sniffing on multiple interfaces.
- Report which sniffer has failed by setting bits of error code.
- Raise meaningful exceptions when irrecoverable errors happen.
- Make IPv4 fragmentation flags configurable.
- Make IPv6 HL / IPv4 TTL configurable.
- Make TCP MSS configurable.
- Make TCP sequence number configurable.
- Make ICMP payload size configurable.
- Add debug output.
- Move command line argument parsing out of network functions.
- Make the code somehow PEP-8 compliant.
MFC after: 1 week
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D38122