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=202606 header.b=aPRsJ0C6; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 9177A5A0626 for ; Mon, 13 Jul 2026 07:39:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202606; t=1783921140; bh=MhYk1cyOAIUebFZwq8aSIYaupbgDyBOQgEOtRYJ6X3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPRsJ0C6LIibGWwj42IMbGVLMxuIZaUwmwadwNLMXBwgqy2vJ3GeJbRB3x8sWySD9 wr+xHfibpOrJHFQbzjWilbpLS6AID/d6g7ixBFSyxOqMV/g7SE2fNWamBaEsXIuqVw 5ArvwUltEuXf6aqvL6VKv3Rd5DNFk/PzcmPJZ974Xua5WJBYGYYp09SdqQ++SwCVUc tHyqcW8seLcjoWWdzLh7W/KpDbDedCdcMb7hNeLfwA29wpe3WRUCYK4F/oWTGB8Rn7 4iJY8JWqJBpihS1nVQ6O0+zvukQyaQ2XJYGE+OQsPPg16e14Wc5njKuxWVAoLaWtGS HGYYdiWo3tH9g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gzB7m2VKRz4wJG; Mon, 13 Jul 2026 15:39:00 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 2/5] udp: Validate that we have a unicast source address Date: Mon, 13 Jul 2026 15:38:53 +1000 Message-ID: <20260713053856.1329271-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260713053856.1329271-1-david@gibson.dropbear.id.au> References: <20260713053856.1329271-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: RPMGRB4QKG5G3P26QJI5J4MIJMHICW4H X-Message-ID-Hash: RPMGRB4QKG5G3P26QJI5J4MIJMHICW4H 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: When creating a UDP flow from a socket we, correctly, check that the source address is unicast - multicast addresses are not valid as a source address. However, when creating a flow from tap we only check the source address is specified, not that it is unicast. Correct this. Signed-off-by: David Gibson --- udp_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udp_flow.c b/udp_flow.c index 5a59f7f3..f59649f6 100644 --- a/udp_flow.c +++ b/udp_flow.c @@ -307,7 +307,7 @@ flow_sidx_t udp_flow_from_tap(const struct ctx *c, ini = flow_initiate_af(flow, PIF_TAP, af, saddr, srcport, daddr, dstport); - if (inany_is_unspecified(&ini->eaddr) || ini->eport == 0 || + if (!inany_is_unicast(&ini->eaddr) || ini->eport == 0 || inany_is_unspecified(&ini->oaddr) || ini->oport == 0) { flow_dbg(flow, "Invalid endpoint on UDP packet"); flow_alloc_cancel(flow); -- 2.55.0