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 443E85A0272 for ; Tue, 6 Feb 2024 02:17:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707182259; bh=c8ClfN81ZYuThzH8OHvK0evs0FbUuvCd7IcWdah241U=; h=From:To:Cc:Subject:Date:From; b=mHiYcqdI/skaojX/9SjlLuiiEyxUSYczU5yShqGUrhSVVthOQUca9KPzSBsQcbyea Phi/AqC1bOYUeEc+nOG5k+3bE3eN5bqLNiGXHj33UAJmSmKbpPtKP1XR6CCg4BKBLJ yx1YEVLLYI/V8BNLjAWlN5KKv2v6EJJJGFwYuEWd8+DYHFRFGL1p72twK6XvQEprjS c4lc329AS+pcndd5qXl6TTZ2zxF8Zb7waqRfF2VKHbS8nuHo+86z143fkIwT7vYsQl i7cxkAO9v61cHjfIQZXcxkqKo0Z5/8oFXC/b2nic+xprAbm9bIFsPi0WmjbtIR8TxD i0CVUw78K2xdg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TTQN36b0Qz4wp3; Tue, 6 Feb 2024 12:17:39 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 00/22] More flow table preliminaries: address handling improvements Date: Tue, 6 Feb 2024 12:17:12 +1100 Message-ID: <20240206011734.884138-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: ELYDGROCUPMQLKKMSFZ35FY2TZ325TSP X-Message-ID-Hash: ELYDGROCUPMQLKKMSFZ35FY2TZ325TSP 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. 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 (22): treewide: Use sa_family_t for address family variables 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, tcp_splice: Helpers for getting sockets from the pools 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 | 14 +-- conf.c | 8 +- flow.c | 83 +++++++++++++++++- flow.h | 9 ++ port_fwd.c => fwd.c | 32 +++---- port_fwd.h => fwd.h | 24 +++--- icmp.c | 24 ++---- icmp.h | 4 +- inany.c | 50 +++++++++++ inany.h | 99 ++++++++++++++++++--- passt.h | 2 +- tap.c | 19 ++++ tcp.c | 158 ++++++++++++++++++++++++--------- tcp.h | 8 +- tcp_conn.h | 4 +- tcp_splice.c | 206 +++++++++++++++++++++++++------------------- tcp_splice.h | 7 +- udp.c | 34 ++++---- udp.h | 12 +-- util.c | 2 +- util.h | 10 +-- 21 files changed, 569 insertions(+), 240 deletions(-) rename port_fwd.c => fwd.c (83%) rename port_fwd.h => fwd.h (62%) create mode 100644 inany.c -- 2.43.0