From nobody Wed Jan 10 18:44:37 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T9GtZ1gDRz55ckw; Wed, 10 Jan 2024 18:44:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T9GtZ15KBz4NPk; Wed, 10 Jan 2024 18:44:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704912278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+FTdJaAIp8lcgQDof/17jumRgOh9ZglPDie4vMzO2kw=; b=gnnl5QyjtFtrpjiU1FE9dzJ9I2Z6ygjH4J6s9u+TOMfAhh2BcqszqDctJ1Io/HYnFJoQ5c FpyiHKWPYmlxOqMMEpz81RqbDAVUXxL9fu/GLFOA3vy0QTVUjmOEn8Z/i4UbQ4Qo4ArSse LUK9nALF5glrdrxFGUZLiLUxdiqitq0h2xLypgUkI3zfv9h3cTXi9hOPQISdhf8tOuAnTz hAwPAjggzshyvOlKw51uGo+byEKWx9gtmb1xFdB4GGGOx8lg++DDJEHCBnvexhO4P5rFoe MVTHNCYTBAfseWes4iGcuk687f16PEZrpvXDK5KRgpkOlxlKwntvZpiwcTYESw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704912278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+FTdJaAIp8lcgQDof/17jumRgOh9ZglPDie4vMzO2kw=; b=l1skBrvg7N7Rw0trMyQw6mfJHQLPACyAQZbgDijuDIBE2xQEo6s2XmxtrJOYCf69CWb0BS FxB1iTZEURF+FhR7XuK9cK8c3Krb2BNAjhpnrADzbdpQeAUJQyB63dkQTPM8GNroCSuGg5 qDGsW3xvlLkB5ugQcnrXqDKVTxn5IIrd6J7n57+dYRtzXXgKgk9caan6RE0I0pJqT00+2/ OQHXZvBSBMvCkQzDcbKx4oJU0g8kf0AJYtmlERPjgG25Jbg05+1lcUMO2X3MLqGX9jQgyY xdAPz862khjbfkbapBdcRIJr2XIREIFEqto2APp4LDTkSPYYohyGcb5O3WJ89A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704912278; a=rsa-sha256; cv=none; b=ZC6H2v3cpXLx4rSO8sbWY5vRvTpAFOafzKXoE7Tfk1236RbCvp7ipCMEeoEhYJODK3dAvC vtmy3fzu+x5WOGcDYxVjrGuwRHm2LvdkoccxyPzlPcY5ypavvtmLiHBwhMpf4qItZDE9pa nIvgDrVOQFVt7tQ63VG4+rYJMhQ/hvUrgU1blx4vkCYTZ9TMh3rPXoBeD4YHu5QDm3+qfs wzO9UJH66WdiFRaveyRqgbgHsOuGweWk/NsvmN8nQhiff53xSDz8jctP5KQxRcNLtw1dvl FqI6EsFJ1vM0QF0lNX+Qr7h6dAeFNLrA4S8o6mRjpp64pFWtXrGv+arXpNRYmA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T9GtZ05SWzmtW; Wed, 10 Jan 2024 18:44:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40AIib3s093673; Wed, 10 Jan 2024 18:44:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40AIibCk093670; Wed, 10 Jan 2024 18:44:37 GMT (envelope-from git) Date: Wed, 10 Jan 2024 18:44:37 GMT Message-Id: <202401101844.40AIibCk093670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 3159e314f194 - stable/14 - Fix udp IPv4-mapped address List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3159e314f194bd8db98dd4516f46350b2fbe44f0 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3159e314f194bd8db98dd4516f46350b2fbe44f0 commit 3159e314f194bd8db98dd4516f46350b2fbe44f0 Author: Richard Kümmel AuthorDate: 2023-12-15 11:49:45 +0000 Commit: Ed Maste CommitDate: 2024-01-10 16:37:44 +0000 Fix udp IPv4-mapped address Do not use the cached route if the destination isn't the same. This fix a problem where an UDP packet will be sent via the wrong route and interface if a previous one was sent via them. PR: 275774 Reviewed by: glebius, tuexen Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 7df9da47e8f04267330e1baa751f07c0c4aaf2ac) --- sys/netinet/udp_usrreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 708a4e6b730d..75dec9d5f5aa 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1055,6 +1055,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, uint16_t cscov = 0; uint32_t flowid = 0; uint8_t flowtype = M_HASHTYPE_NONE; + bool use_cached_route; inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_send: inp == NULL")); @@ -1091,9 +1092,8 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, * We will need network epoch in either case, to safely lookup into * pcb hash. */ - if (sin == NULL || - (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0) || - (flags & PRUS_IPV6) != 0) + use_cached_route = sin == NULL || (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0); + if (use_cached_route || (flags & PRUS_IPV6) != 0) INP_WLOCK(inp); else INP_RLOCK(inp); @@ -1443,7 +1443,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, else UDP_PROBE(send, NULL, inp, &ui->ui_i, inp, &ui->ui_u); error = ip_output(m, inp->inp_options, - INP_WLOCKED(inp) ? &inp->inp_route : NULL, ipflags, + use_cached_route ? &inp->inp_route : NULL, ipflags, inp->inp_moptions, inp); INP_UNLOCK(inp); NET_EPOCH_EXIT(et);