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=qzJfJjxp; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 6422B5A026E for ; Fri, 10 Jul 2026 08:56:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202606; t=1783666574; bh=MhYk1cyOAIUebFZwq8aSIYaupbgDyBOQgEOtRYJ6X3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzJfJjxpSpj0anZcbaE5gguAQH+4OIXoRHo3lGIzfa996pYYPTqfxfL5oG4GH9SE5 V4eCkUCxqR0gjFsxtApZFDdPx7OeIx/7fS7mcsM7cp30Gb8mI0gc9/UjiC3Iuvmzjw GCCHi1xHQtc4BlzvWkvSN2yx4wXN6a8z4m8uM8Gy3zH2kCornNeVZglwMXlA9NP83V SxUORhgfTwjrrx4YCjrE/n8LQFYMx7FfweVXC05KfADhVpahr/zg1L1Sran0dKcLm6 byTE6GC2X3k9ycAXmdQn2xNTC8eIPuHDrNEjvz49G0L2PBVX98Ur+WZw2RrmPThcLs 6CE3WkKLDA4OQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gxN0G4PL5z58dS; Fri, 10 Jul 2026 16:56:14 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 2/5] udp: Validate that we have a unicast source address Date: Fri, 10 Jul 2026 16:56:08 +1000 Message-ID: <20260710065611.530947-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260710065611.530947-1-david@gibson.dropbear.id.au> References: <20260710065611.530947-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: RU4LSFV6WUQHLDR33SCZKQIIY6GWM7RG X-Message-ID-Hash: RU4LSFV6WUQHLDR33SCZKQIIY6GWM7RG 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