From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 1EBDE5A026F for ; Mon, 18 Dec 2023 08:40:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1702885220; bh=Rpqrch8LZDlo6R54xyE3SQI/Zs7KzYaMM2n+wwcX5cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9V7qOcGzemARhMpH2Ln8JgDnMckr9hvfnBa9o2bt0neu0m2fj6eIPg0qclTTMTRb 3fTGi9XlWyq+ASrm12E3xmWn65zbDz8WxaCpteo7IPhMQpoksMFFM3xjXPMygL1Ynw 8D1Xtwsu6HdYlKtCoSe1NVnWiLGUND5OwLlh+lqiGtJ9pn6l6njUw2T9G79LBMDiYC Y4zuus3GioOSMznxD5yvsascjstBWNGEAc1TbItE5gWAWdCeDXPukjLjSzGIdcxUdE 1mcMDD4roB5fTeZuZeJ4uOfsaPDvISzd6HFygGX+rZfxN9gSamw5V7sr+YaB64XQ91 M6iIdBo8rkqEA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4StsDh1sCpz4xdK; Mon, 18 Dec 2023 18:40:20 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 02/11] icmp: Don't set "port" on destination sockaddr for ping sockets Date: Mon, 18 Dec 2023 18:40:08 +1100 Message-ID: <20231218074017.985092-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218074017.985092-1-david@gibson.dropbear.id.au> References: <20231218074017.985092-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: OXXPSJAXLBNGK66JUUUT6D3HIUTNCE63 X-Message-ID-Hash: OXXPSJAXLBNGK66JUUUT6D3HIUTNCE63 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: We set the port to the ICMP id on the sendto() address when using ICMP ping sockets. However, this has no effect: the ICMP id the kernel uses is determined only by the "port" on the socket's *bound* address (which is constructed inside sock_l4(), using the id we also pass to it). Signed-off-by: David Gibson --- icmp.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/icmp.c b/icmp.c index 325dfb0..d3e5bc6 100644 --- a/icmp.c +++ b/icmp.c @@ -182,8 +182,6 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif, int af, if (ih->type != ICMP_ECHO && ih->type != ICMP_ECHOREPLY) return 1; - sa.sin_port = ih->un.echo.id; - iref.id = id = ntohs(ih->un.echo.id); if ((s = icmp_id_map[V4][id].sock) <= 0) { @@ -229,8 +227,6 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif, int af, if (ih->icmp6_type != 128 && ih->icmp6_type != 129) return 1; - sa.sin6_port = ih->icmp6_identifier; - iref.id = id = ntohs(ih->icmp6_identifier); if ((s = icmp_id_map[V6][id].sock) <= 0) { s = sock_l4(c, AF_INET6, IPPROTO_ICMPV6, -- 2.43.0