From nobody Wed Dec 07 19:52:01 2022 X-Original-To: dev-commits-src-main@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 4NS7GV2dvXz4jghB; Wed, 7 Dec 2022 19:52:02 +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 4NS7GV0PVjz3Mny; Wed, 7 Dec 2022 19:52:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670442722; 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=N87nRyx8ERj6EvEYd162tIYYTYnDS6s6F9FIruKpbbA=; b=CUTn2sHk+59PEYcMI56/sjJWTiYte+gq56fmP5E9MgReX6l4HRfy0XrQTHhiQ9NgQX3Hea 2sl231Tk9A1A1U+RfUidkMgrhUCgqo5LcDwytjAajpmc+PUGsTNJx2mWOBwdQLkQKHsPgd PKHwFMmKvxcxh4ugqlN/J6MUxnIGmBC2faNk59mY2i5mqyK5GxcnovvoWnVySLOdJ1cKfN cAz6K37LsJbXwWdWv10JrbmVAot2R4aNoG8gai877pnrSqqzRcEI0U590yXMO7zBhu0Xh0 2vwrH9y1prQjVOcyvuR0f6pcm5V1KxvgaZZ0J/N0GFeZIo4c5prRsDmrjlDZnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670442722; 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=N87nRyx8ERj6EvEYd162tIYYTYnDS6s6F9FIruKpbbA=; b=RDa3gAMnxMec7wVcxd9oRs279hpee0O8vXOMhvyuq+lSgAZXhbx2AapxB8NZqTsQxQWlV2 Pdk61NiQ99xG0IcQwsfWLnPnV4RTB90699fOOjKvkHM+wVMN/vHSGBNUO3mH80O4Z0peF9 DKwfsthWuBYLHLFdHlrAEWVP9s7FK+D9YEXLy2eZ8HEiCWS25+w6uotC+tMdP7ApXN0rps OgDmlxpYYwSYhDK9uRsyEI19oGODYf5luKsi5XEF1IboE44uXYOVjRQZAkism7JUiMVRZ2 xehTmzownzFL8x1EgDrPnS2JMhFuhOFy3jWLyGOm0fDtRXMskw/Cx8AGcpQU2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670442722; a=rsa-sha256; cv=none; b=OvAB+HlcjFBa7xkkJBGSBZQsbeN6pwSMjllmMQP4kTORIixIqMxoJHV/PyS7BicaHQ2U0a sGbuQC4neAAUwoxbZ6zal6piI0RmDeHF0dLBw/emNTz5wSYiDUAvTGkQwvTtrESP765Bci INRr9FpyEgelb1VUkeYQhEWiER1CCuIOxYbi+bwUAJwuVSSG9mvz48prJPssQWv5389aKK KEHVHQJghUFOjQodDMqx6qIyh8hnAEU95v4FA2e1w0pFaEqJKRBOhcYq0QbH07YcOemUHK jPjSXFVUp5n1KQ0KT31JD/EIq4dlLAv1kvGLS06qyc156XspzHa44nmYMwJVcA== 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 4NS7GT6cyZzV1Y; Wed, 7 Dec 2022 19:52:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2B7Jq1LN028248; Wed, 7 Dec 2022 19:52:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B7Jq1tt028247; Wed, 7 Dec 2022 19:52:01 GMT (envelope-from git) Date: Wed, 7 Dec 2022 19:52:01 GMT Message-Id: <202212071952.2B7Jq1tt028247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 5bfc014f2345 - main - udp6: inline udp6_output() into udp6_send() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bfc014f23452367c9ddcabc5a183b4ee975932d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=5bfc014f23452367c9ddcabc5a183b4ee975932d commit 5bfc014f23452367c9ddcabc5a183b4ee975932d Author: Gleb Smirnoff AuthorDate: 2022-12-07 19:51:48 +0000 Commit: Gleb Smirnoff CommitDate: 2022-12-07 19:51:48 +0000 udp6: inline udp6_output() into udp6_send() --- sys/netinet6/udp6_usrreq.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 2d309d938056..79fe7d4cc0fb 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -657,7 +657,7 @@ SYSCTL_PROC(_net_inet6_udp6, OID_AUTO, getcred, "Get the xucred of a UDP6 connection"); static int -udp6_output(struct socket *so, int flags_arg, struct mbuf *m, +udp6_send(struct socket *so, int flags_arg, struct mbuf *m, struct sockaddr *addr6, struct mbuf *control, struct thread *td) { struct inpcb *inp; @@ -673,7 +673,19 @@ udp6_output(struct socket *so, int flags_arg, struct mbuf *m, u_short fport; uint8_t nxt; - /* addr6 has been validated in udp6_send(). */ + if (addr6) { + error = 0; + if (addr6->sa_family != AF_INET6) + error = EAFNOSUPPORT; + else if (addr6->sa_len != sizeof(struct sockaddr_in6)) + error = EINVAL; + if (__predict_false(error != 0)) { + m_freem(control); + m_freem(m); + return (error); + } + } + sin6 = (struct sockaddr_in6 *)addr6; /* @@ -1243,32 +1255,6 @@ udp6_disconnect(struct socket *so) return (0); } -static int -udp6_send(struct socket *so, int flags, struct mbuf *m, - struct sockaddr *addr, struct mbuf *control, struct thread *td) -{ - int error; - - if (addr) { - if (addr->sa_len != sizeof(struct sockaddr_in6)) { - error = EINVAL; - goto bad; - } - if (addr->sa_family != AF_INET6) { - error = EAFNOSUPPORT; - goto bad; - } - } - - return (udp6_output(so, flags, m, addr, control, td)); - -bad: - if (control) - m_freem(control); - m_freem(m); - return (error); -} - #define UDP6_PROTOSW \ .pr_type = SOCK_DGRAM, \ .pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, \