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 CA0EE5A026D for ; Thu, 5 Oct 2023 05:44:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1696477489; bh=54HssPfhKXyMhpixwS068SLN34/Y/PAOst1cXbGSPo8=; h=From:To:Cc:Subject:Date:From; b=Sk5ZE0SJQOCeqclqbuhILi4knNLOi3+8qbU9bQXcdQn7ta7KFtoTkcejmdVWS9Ut1 rV0HDdpcJSzqOd0DJDGETUeFs5HMT2k2XSrS4CClwFDr5GidNaceNCTBhy3NJuOYU2 eLNf94RzpR9OxHZGrFZlyHWetiYhWE4NAQ2Wp/VQ= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4S1HW50rQhz4xT8; Thu, 5 Oct 2023 14:44:49 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 0/9] Clean ups to automatic port forwarding Date: Thu, 5 Oct 2023 14:44:36 +1100 Message-ID: <20231005034445.2015303-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 3NT4D6PKSWMA5UG5CJI5D7U2FQAPZEVI X-Message-ID-Hash: 3NT4D6PKSWMA5UG5CJI5D7U2FQAPZEVI 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: This contains an assortment of cleanups to the code supporting the automatic port forwarding more for past - specifically get_bound_ports() and related functions. This shouldn't mae any functional changes. Based on the series with fixes for new cppcheck-2.12 warnings. David Gibson (9): conf: Cleaner initialisation of default forwarding modes port_fwd: Move automatic port forwarding code to port_fwd.[ch] port_fwd: Better parameterise procfs_scan_listen() util: Add open_in_ns() helper port_fwd: Pre-open /proc/net/* files rather than on-demand port_fwd: Don't NS_CALL get_bound_ports() port_fwd: Split TCP and UDP cases for get_bound_ports() port_fwd: Move port scanning /proc fds into struct port_fwd port_fwd: Simplify get_bound_ports_*() to port_fwd_scan_*() Makefile | 2 +- conf.c | 113 +++++-------------------------------------- conf.h | 1 - passt.h | 5 -- port_fwd.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++ port_fwd.h | 9 ++++ tcp.c | 39 +-------------- util.c | 104 +++++++++++++++------------------------ util.h | 3 +- 9 files changed, 204 insertions(+), 211 deletions(-) create mode 100644 port_fwd.c -- 2.41.0