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 7EC8B5A0274 for ; Wed, 28 Feb 2024 06:39:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1709098773; bh=j9ZLNjpBIBHKw2m5/NPfgOEZyQElrxa0M4fEGpofObo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ofCBp++t+Z20UZj+OgluSn9oqTASXuMIK73onSe1mtT0K0IVJZvrThJL5v7QkVaKa RV5QSDOcRjiU6yIAeJezZQnr/37gf8hME0g/MN+Uonfs/dtuxAVHKkrAuX1lIERAEV vb2SEUYAKdY5B+IWUvzWiC+mD2nuiQW+n7Y9h2gnQwhl2F2/l/lK67xF929GMoJbh6 JxHBGYXW8VOAZ9TqQlDbbnRH4j9NLsEBjApma2MQjw0Qm21ec/t4Q71eCIrdCEWP4z FnWgEH6Ggi4Y3b1cGtSAQ4/qTLERAZpcyJ7ZSRDOAK4RlovXKziwPuvV1reZ5CQsOU WcYHgKD8WLCvA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Tl3853VwXz4wyY; Wed, 28 Feb 2024 16:39:33 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top, Laurent Vivier Subject: [PATCH v2 5/5] udp: Remove unnecessary test for unspecified addr_out Date: Wed, 28 Feb 2024 16:39:29 +1100 Message-ID: <20240228053929.1570254-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228053929.1570254-1-david@gibson.dropbear.id.au> References: <20240228053929.1570254-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: BW5NAE3ZMPDRMOUTRWQNSLLAGITTN6L2 X-Message-ID-Hash: BW5NAE3ZMPDRMOUTRWQNSLLAGITTN6L2 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: If the configured output address is unspecified, we don't set the bind address to it when creating a new socket in udp_tap_handler(). That sounds sensible, but what we're leaving the bind address as is, exactly, the unspecified address, so this test makes no difference. Remove it. Signed-off-by: David Gibson --- udp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/udp.c b/udp.c index d55a6827..5b7778eb 100644 --- a/udp.c +++ b/udp.c @@ -878,8 +878,7 @@ int udp_tap_handler(struct ctx *c, uint8_t pif, if (!IN4_IS_ADDR_LOOPBACK(&s_in.sin_addr)) bind_if = c->ip4.ifname_out; - if (!IN4_IS_ADDR_UNSPECIFIED(&c->ip4.addr_out) && - !IN4_IS_ADDR_LOOPBACK(&s_in.sin_addr)) + if (!IN4_IS_ADDR_LOOPBACK(&s_in.sin_addr)) bind_addr = c->ip4.addr_out; s = sock_l4(c, AF_INET, IPPROTO_UDP, &bind_addr, @@ -930,8 +929,7 @@ int udp_tap_handler(struct ctx *c, uint8_t pif, if (!IN6_IS_ADDR_LOOPBACK(&s_in6.sin6_addr)) bind_if = c->ip6.ifname_out; - if (!IN6_IS_ADDR_UNSPECIFIED(&c->ip6.addr_out) && - !IN6_IS_ADDR_LOOPBACK(&s_in6.sin6_addr) && + if (!IN6_IS_ADDR_LOOPBACK(&s_in6.sin6_addr) && !IN6_IS_ADDR_LINKLOCAL(&s_in6.sin6_addr)) bind_addr = &c->ip6.addr_out; -- 2.43.2