From nobody Tue Apr 09 01:34:26 2024 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 4VD7mM0Vxmz5GGj3; Tue, 9 Apr 2024 01:34:27 +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 4VD7mL5jgYz4lxK; Tue, 9 Apr 2024 01:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712626466; 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=waQqG+P1YulAqT7piS19SBefFQ3WHCPm9AA7c3C0rTA=; b=vErwmpV+qTLlQV/hhVtBzv++5GrqccMagY/vHDrtI9KPKM07J5JkE0N9dCOAu/SYj33O2u 7Y6MTOWbpZAdAnWvCVmu750fKuY30dxhgpoMGinUbUS1c0LzQnRd1wAa8BFo/ihnY3do7y pvECtN5i6AK9eWzoY8toK37RCAwnXPpN27yXtu55W6Kkxv1uwqA/grML4PgPO7fO5IGWaf iiR4FfVTK1ohfvMfVq0HWRQxooH+sVpl5z6A5q4N7oF2H91bj1Ah2yh2eG9zee98JRkaSB 5f3ve/pCSYA7xtegNuJpfAcPd0yOrkx79S47rp4ZBkVdd2IwheZBHSWcXeWuUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712626466; a=rsa-sha256; cv=none; b=c/9j0QzlTVKQhf5cOCBZTvHULVu+3Jm30wUwdE8vWlzeFQtOhrraaEak/LolsGWS+RLNlZ hmAp0bCjVVwxYgDrscKN4rXRePSJ1/YbCPCz3MLGOn+WPrXnqfcfcD1R2tCP01I/33Ngpk hTGoTaC6IQolxQOLdDYlVIbpy+r+qPe9n1KAJoyHp/lPdqA/lqTrz3XkHOk1sH/KOd5kuh pHqcVNtxal9WRpINnRRWFuBrUnQ4FG8CuuhZoTHV9PQGRAvrRaOS+CS0Y1TaflVFn/3nZN G87iMcWjVLJQupvfY/8DQgwN65x2plNsIF+lXSqQPTusljeHoeGc0eOXXMybyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712626466; 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=waQqG+P1YulAqT7piS19SBefFQ3WHCPm9AA7c3C0rTA=; b=SCmgtP9eRhuud8NRXK3Ni/CfLmKclhZ95kDHfPjvMyestIxRjsijpJjkFoBMonDOvQm56l Ao09Qgs8Ouvrs46m8z/dhkM1APr2JnlYhMo3oWg48wM1MknUh2wzX0LkPqZMZMoNQoL2Po D+IAQL37y5w9NN/EMdv1PPvySmy6r+UaCqsyE+5TC/hSOMN6CVi9LtJy46k5y+NvRaDMAd buBhy329tZBJ6v8ZY+SAWWSKstYL6hbYptuqyxJYgsA90Se501Hn2OlkrYjHoXpTUevD4N o3fraGWgGJPVslvsHnb/4UJwyM+uc00UoGCzQGdMjVTyNGYosiKxmyQaJDNvJQ== 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 4VD7mL5JnszbR3; Tue, 9 Apr 2024 01:34:26 +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 4391YQCB066903; Tue, 9 Apr 2024 01:34:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4391YQXV066900; Tue, 9 Apr 2024 01:34:26 GMT (envelope-from git) Date: Tue, 9 Apr 2024 01:34:26 GMT Message-Id: <202404090134.4391YQXV066900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Stephen J. Kiernan" Subject: git: 81b4d1c4d487 - main - sockets: Add hhook in sonewconn for inheriting OSD specific data 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: stevek X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81b4d1c4d487099d0d81c50f9a9c62459ec33752 Auto-Submitted: auto-generated The branch main has been updated by stevek: URL: https://cgit.FreeBSD.org/src/commit/?id=81b4d1c4d487099d0d81c50f9a9c62459ec33752 commit 81b4d1c4d487099d0d81c50f9a9c62459ec33752 Author: Stephen J. Kiernan AuthorDate: 2024-04-09 01:31:34 +0000 Commit: Stephen J. Kiernan CommitDate: 2024-04-09 01:31:34 +0000 sockets: Add hhook in sonewconn for inheriting OSD specific data Added HHOOK_SOCKET_NEWCONN and bumped HHOOK_SOCKET_LAST Reviewed by: glebius, tuexen Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D44632 --- sys/kern/uipc_socket.c | 7 +++++++ sys/sys/socketvar.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ce618eeba3ba..c040bdf4d3eb 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -769,6 +769,13 @@ solisten_clone(struct socket *head) so->so_fibnum = head->so_fibnum; so->so_proto = head->so_proto; so->so_cred = crhold(head->so_cred); + if (V_socket_hhh[HHOOK_SOCKET_NEWCONN]->hhh_nhooks > 0) { + if (hhook_run_socket(so, head, HHOOK_SOCKET_NEWCONN)) { + sodealloc(so); + log(LOG_DEBUG, "%s: hhook run failed\n", __func__); + return (NULL); + } + } #ifdef MAC mac_socket_newconn(head, so); #endif diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index cba7dd655aa0..15d770721361 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -414,7 +414,8 @@ MALLOC_DECLARE(M_SONAME); #define HHOOK_FILT_SOREAD 4 #define HHOOK_FILT_SOWRITE 5 #define HHOOK_SOCKET_CLOSE 6 -#define HHOOK_SOCKET_LAST HHOOK_SOCKET_CLOSE +#define HHOOK_SOCKET_NEWCONN 7 +#define HHOOK_SOCKET_LAST HHOOK_SOCKET_NEWCONN struct socket_hhook_data { struct socket *so;