From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 961705A0370 for ; Fri, 3 May 2024 03:11:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1714698697; bh=VWtmyRB5bWXa+9R50+Km2a7BmO5jhTOWOHwIBsFT32o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bVfh5yrCmchi4FTk+1HAIlWwmEc7Db6PAn9amo+bbSOSlg94hn08OWbzdq19+j75e 4OnlQ1YMjmTahya58cauVK8hxwI+ZADO+hV7J8HyYg660Zku7p8k4H/y0ujVvwtJJy FQ+5Lo6RDofewVv6eTzMEgCbaNsDHEF/rCQDuiYClzYD0JR+GKn9wsAv/BeptN3Yzm gNryJ/gEeCu5VxgDFtDtifcJMA7l6R1IRO2sivoTQ3poKGeAGYznRZnsb6GbRNkwn4 6EPzVs4JrbNyAhSpHnpOmTXCemAe7mMvq6WXImfTSgK1qqcZ3GsvCun7hHa25+VGaM Q6VrP4v2fCnvA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4VVt6x6nXcz4xPd; Fri, 3 May 2024 11:11:37 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v4 16/16] flow, icmp: Use general flow forwarding rules for ICMP Date: Fri, 3 May 2024 11:11:35 +1000 Message-ID: <20240503011135.2924437-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503011135.2924437-1-david@gibson.dropbear.id.au> References: <20240503011135.2924437-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: NFGNQZ4RXUGYNSLG4DHQZUXL2OXVS4HF X-Message-ID-Hash: NFGNQZ4RXUGYNSLG4DHQZUXL2OXVS4HF 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: Current ICMP hard codes its forwarding rules, and never applies any translations. Change it to use the fwd_nat_flow() function, so that it's translated the same as TCP (excluding TCP specific port redirection). This means that gw mapping now applies to ICMP so "ping " will now ping the host's loopback instead of the actual gw machine. This removes the surprising behaviour that the target you ping might not be the same as you connect to with TCP. Signed-off-by: David Gibson --- icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icmp.c b/icmp.c index 6a76d05..c960abf 100644 --- a/icmp.c +++ b/icmp.c @@ -172,7 +172,7 @@ static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c, return NULL; flowside_from_af(tapside, pif, af, daddr, id, saddr, id); - flowside_from_af(sockside, PIF_HOST, af, NULL, 0, daddr, 0); + fwd_nat_flow(c, flow_proto[flowtype], tapside, sockside); pingf = FLOW_START(flow, flowtype, ping, TAPSIDE); -- 2.44.0