HomeFreeBSD

netpfil tests: improve pft_ping.py

Description

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

Details

Provenance
vegeta_tuxpowered.netAuthored on Jan 21 2023, 2:44 AM
kpCommitted on Jan 22 2023, 3:26 AM
Differential Revision
D38122: netpfil tests: Improve pft_ping.py
Parents
rGa39dedeb3105: netpfil tests: improve sniffer.py
Branches
Unknown
Tags
Unknown