From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 4CD6E5A0278 for ; Wed, 28 Feb 2024 12:25:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1709119522; bh=aor9G5V31sIewdrzW0ij2r41q+WjMnGx8pIPDuPcs7Y=; h=From:To:Cc:Subject:Date:From; b=GJdX7RRWnDteJV9sZDjOnYWl7p58Wv/sAGANT6pv8RhXlh40JMhuPA9jahcZBJJdB WKoXA9onP3Htl17lZSyNKfkt2/VLh9A8lIXyHibjPo1mH+RtEcVnsiGy/4eVNkjzI0 dGhLFO8tr+oAhW4uP4NL/tplUeiL65bKUXSxMYhnKb+yaH1sazAgWN6zRaW4PQdFYi yBEzCxGIJZmR9EEJHQ4xclOyUoTGpKpRQT57mjXwptgnHj8mYaRbjKaAHZNhhmvI3z RdFEuzBIkngkHwT66X8XuFNymykh+2k7hFooFTZuK0nD8B9GuG3uEdXSf8yiGoOTD8 sg4xU3A0lTs8A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TlBq64H9fz4wby; Wed, 28 Feb 2024 22:25:22 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 00/20] More flow table preliminaries: address handling improvements Date: Wed, 28 Feb 2024 22:25:00 +1100 Message-ID: <20240228112520.2078220-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.2 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: EE6FAPSVMZIZ3D65BOUAAEWARCONGSNG X-Message-ID-Hash: EE6FAPSVMZIZ3D65BOUAAEWARCONGSNG X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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