public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 2/5] udp: Validate that we have a unicast source address
Date: Mon, 13 Jul 2026 15:38:53 +1000	[thread overview]
Message-ID: <20260713053856.1329271-3-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20260713053856.1329271-1-david@gibson.dropbear.id.au>

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 <david@gibson.dropbear.id.au>
---
 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


  parent reply	other threads:[~2026-07-13  5:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  5:38 [PATCH v2 0/5] Fix bug 209 David Gibson
2026-07-13  5:38 ` [PATCH v2 1/5] fwd: Clarify semantics of --host-lo-to-ns-lo David Gibson
2026-07-13  5:38 ` David Gibson [this message]
2026-07-13  5:38 ` [PATCH v2 3/5] fwd: Rework default address logic for inbound flows David Gibson
2026-07-13  5:38 ` [PATCH v2 4/5] fwd: Reorder DNAPT and SNAT steps in fwd_nat_from_host() David Gibson
2026-07-13  5:38 ` [PATCH v2 5/5] fwd: Don't rewrite inbound multicast destinations David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260713053856.1329271-3-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).