Here's another batch of cleanups and tweaks in preparation for the flow table. This set focuses on improved helpers for handling addresses, particularly in the TCP splice path. Based on my other series adding more iovecs to the tap and pcap code, however the only conflicts should be trivial Makefile collisions. Changes since v2: * Minor stylistic and formatting changes based on review * Some clarifying changes to the theory of operation notes on flow lifecycle * Rebased on top of new series cleaning up socket pool error handling. This removes a couple of patches from this series. * Small edits to commit message for improved clarity Changes since v1: * Rebased, and reordered in a way I hope is clearer * Add patch to rename port_fwd.[ch] * Added doc comments to clarify flow life cycle * Added uniform logging of flow start / end to match that lifecycle * union inany_addr typed special address constants * inany based tests for unspecified and multicast addresses, as well as loopback * Dropped patch allowing NULL parameter to inany_from_af(), turned out not to be that useful * Dropped sockaddr_any_init function, turned out not to be very useful in that form * Added patch enforcing no loopback addresses on tap interface * Added logic to sanity check TCP endpoint addresses * Moved socket creation into tcp_splice_connect() * Moved epoll ref parsing into tcp_listen_handler() * Allowed IN4_IS_*() helpers to work on void * addresses David Gibson (20): inany: Helper to test for various address types inany: Add inany_ntop() helper inany: Provide more conveniently typed constants for special addresses inany: Introduce union sockaddr_inany util: Allow IN4_IS_* macros to operate on untyped addresses tcp, udp: Don't precompute port remappings in epoll references flow: Add helper to determine a flow's protocol tcp_splice: Simplify clean up logic tcp_splice: Don't use flow_trace() before setting flow type flow: Clarify flow entry life cycle, introduce uniform logging tcp_splice: More specific variable names in new splice path tcp_splice: Merge tcp_splice_new() into its caller tcp_splice: Make tcp_splice_connect() create its own sockets tcp_splice: Improve error reporting on connect path tcp_splice: Improve logic deciding when to splice tcp, tcp_splice: Parse listening socket epoll ref in tcp_listen_handler() tcp: Validate TCP endpoint addresses tap: Disallow loopback addresses on tap interface port_fwd: Fix copypasta error in port_fwd_scan_udp() comments fwd: Rename port_fwd.[ch] and their contents Makefile | 12 ++-- conf.c | 8 +-- flow.c | 84 ++++++++++++++++++++++- flow.h | 9 +++ port_fwd.c => fwd.c | 32 ++++----- port_fwd.h => fwd.h | 24 +++---- icmp.c | 18 ++--- inany.c | 50 ++++++++++++++ inany.h | 96 ++++++++++++++++++++++---- passt.h | 2 +- tap.c | 19 ++++++ tcp.c | 119 +++++++++++++++++++++++--------- tcp.h | 6 +- tcp_splice.c | 162 +++++++++++++++++++++++++------------------- tcp_splice.h | 7 +- udp.c | 32 +++++---- udp.h | 10 +-- util.h | 8 +-- 18 files changed, 502 insertions(+), 196 deletions(-) rename port_fwd.c => fwd.c (83%) rename port_fwd.h => fwd.h (62%) create mode 100644 inany.c -- 2.43.2