From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202510 header.b=wxxQDToR; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 1BFDE5A0274 for ; Wed, 19 Nov 2025 05:26:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1763526396; bh=m1p4aHRY066Kio+M/51mJKZ9St1zxoV/wuup6L2N2Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wxxQDToRQLAaymHvWoBfQAFgal3/A58lWOBNF/FNjXgYhvOYFyYkkdUu5r0cUUsmp liJGeEpdnjAVtRXnc/QPfzR8KtxS8UjxMgOKDaYUq9j7mWV/IOyZPBkbJoIDrV4aop sGljUnfzhIUkt21jXLC7lKmsPmFIJagGNMvQgoUvqcpPhwy0EM4Uliq8v5+un4obZd kFhkQMsi+j6r50IPLPYXFcJ/0XD4g9Pkfz35gj4sIOoxrmhyzVa9ZERNAtz2uV/qEE XB+3llDwN0UTtiKSe22gcQBHdDumk4r/PBOCf+5VEFrXKxo8cLtmwOh+t862CjvDEo dyOfeExEOk8yg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dB7j86P5Gz4wH2; Wed, 19 Nov 2025 15:26:36 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 3/3] fwd: Don't explicitly exclude reverse-direction TCP ports for UDP Date: Wed, 19 Nov 2025 15:26:34 +1100 Message-ID: <20251119042634.2978171-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251119042634.2978171-1-david@gibson.dropbear.id.au> References: <20251119042634.2978171-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 7GOVFO7PW637NJDRCPGJBYJACCRV54PD X-Message-ID-Hash: 7GOVFO7PW637NJDRCPGJBYJACCRV54PD 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: In auto-forwarding mode, we forward UDP ports for which there isn't (yet) a listening UDP port on the other side, but where there is a listening TCP socket for the same port number. This is useful for certain protocols such as iperf3. Correspondinly, when excluding ports from forwarding, we also exclude TCP ports from the other direction. That sounds like it makes sense, but is unnecessary: for the purposes of exclusion, we don't care why we have a listening UDP socket for that port, just whether we have one. That is already incorporated into the UDP bitmap alone. Signed-off-by: David Gibson --- fwd.c | 6 ++---- util.c | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fwd.c b/fwd.c index c7a880eb..c417e0f5 100644 --- a/fwd.c +++ b/fwd.c @@ -410,10 +410,8 @@ static void fwd_scan_ports(struct ctx *c) memcpy(excl_tcp_out, c->tcp.fwd_in.map, sizeof(excl_tcp_out)); memcpy(excl_tcp_in, c->tcp.fwd_out.map, sizeof(excl_tcp_in)); - bitmap_or(excl_udp_out, PORT_BITMAP_SIZE, - c->udp.fwd_in.map, c->tcp.fwd_in.map); - bitmap_or(excl_udp_in, PORT_BITMAP_SIZE, - c->udp.fwd_out.map, c->tcp.fwd_out.map); + memcpy(excl_udp_out, c->udp.fwd_in.map, sizeof(excl_udp_out)); + memcpy(excl_udp_in, c->udp.fwd_out.map, sizeof(excl_udp_in)); fwd_scan_ports_tcp(&c->tcp.fwd_out, excl_tcp_out); fwd_scan_ports_tcp(&c->tcp.fwd_in, excl_tcp_in); diff --git a/util.c b/util.c index 7944a495..ab23463b 100644 --- a/util.c +++ b/util.c @@ -338,6 +338,7 @@ bool bitmap_isset(const uint8_t *map, unsigned bit) * @a: First operand * @b: Second operand */ +/* cppcheck-suppress unusedFunction */ void bitmap_or(uint8_t *dst, size_t size, const uint8_t *a, const uint8_t *b) { unsigned long *dw = (unsigned long *)dst; -- 2.51.1