From nobody Tue Oct 01 15:30:37 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 4XJ22P40qKz5Y0Yn; Tue, 01 Oct 2024 15:30:37 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XJ22P1zLDz4Cm7; Tue, 1 Oct 2024 15:30:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727796637; 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=lyKzQ1ZOn+kHbJhM65fuPF9pzuxe33U7D6Ui8bt9IYk=; b=wIAjK69jVT4zAbUK6NPwRVdDvdTziIDoltgvVLfReIZMP4VK1mHOKaQa43j8k5QTU/zE1A Uc1Sexm4lkA116lHtt+Vka2K5DUvR3Ox5hxywdfkbMLj+0A4mP7YFLCuwKzfZJ7oMcoQo9 T7daobPwhbBSnYFLrIGbBnVCah28qI8uMGlNCq8Gah3KhjtpF6ah8yTV0Mr+2RBfIFLKbm PcquBGzFoC35g3ANDdBItHWYNM7tJnv++envmvpYydiBqHTdpsYQhvceCKj/vDrXJnBQmK LjMomSz4wUCtDLVyLLFzJ7bRVKshhGeB0xAWdMeHQk8wTQxgvmjxOHSlIIcp8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727796637; 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=lyKzQ1ZOn+kHbJhM65fuPF9pzuxe33U7D6Ui8bt9IYk=; b=U4Y+lBINQ9hI7mwVSE2gdjjD8Zc0KPnsL3L3BhjbcRoVMnI3ZLanPYyRgHQYqSdY+pYAcz WJmeiABMicAznoryvRq5yN2PZ0vP9i75i/ovNawkN6HM4srFmF3HDYV2lsMr3zPMmdIItY ZIjezksQKqmThXZ55K8lyk5sIW3nX5CVXhbvl3s+HzH4X3mB+SygnvEZIzKXPfdFuwV/c2 bEyNF81Cy82ariGDKyWYEfruK1MM2O+qgHWYC4P8P7Fa0MSwNbi/rkeSaBcdeTdhmCTEML zQy5KBnbSwQ76+iLcPX0RIHfQ0sqB63inMfCAB1QJgnh/kfLM1O2LSfHP3gnjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727796637; a=rsa-sha256; cv=none; b=gjGc1VlSPbnuA0mVzpx3eeJ2lYctwL5Jr5/cusqrIIaugIwIDuKCxDG9NFEER86BEJRlAg 60qYZigCwf8zML0a+NS4lLIT+jS6d9AETeYIjeZjYr7BjRBzP/n1/0QZwuM62T4pVw2jB9 +u4+5XodlDPoSMI1dEikoXxuywR/F2KY2CDLhsQVHl3DmirtcYv5F13HE2Vh0ysGs3dj3x v0lz3j4wskxYxmDe/hMfCwriY9exf70JlG9JvnCBcCIFrscDM2eHqFnixeVPlJaZrfog84 Jw+J0T5KBwuu8Mp9xvpenArr9gKEMsh8AI99Ot1Q7VNKAe+vJ912QY19zuMmiA== 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 4XJ22P1HWZzk4p; Tue, 1 Oct 2024 15:30:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 491FUboM067301; Tue, 1 Oct 2024 15:30:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 491FUb7V067298; Tue, 1 Oct 2024 15:30:37 GMT (envelope-from git) Date: Tue, 1 Oct 2024 15:30:37 GMT Message-Id: <202410011530.491FUb7V067298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 7643141e9314 - main - if_enc(4): Make enc_add_hhooks() void 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7643141e9314f1eac0d9ac08457410509e6829ad Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=7643141e9314f1eac0d9ac08457410509e6829ad commit 7643141e9314f1eac0d9ac08457410509e6829ad Author: Zhenlei Huang AuthorDate: 2024-10-01 15:28:37 +0000 Commit: Zhenlei Huang CommitDate: 2024-10-01 15:28:37 +0000 if_enc(4): Make enc_add_hhooks() void As for the consumer `enc_add_hhooks()`, `hhook_add_hook()` will never fail for the given parameters. Meanwhile, to build the module if_enc(4), at least option INET or INET6 is required, so no need for the error EPFNOSUPPORT. No functional change intended. Reviewed by: ae MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D46770 --- sys/net/if_enc.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c index 18587dc1cb46..3c7ae38324c3 100644 --- a/sys/net/if_enc.c +++ b/sys/net/if_enc.c @@ -96,7 +96,7 @@ static int enc_output(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); static int enc_clone_create(struct if_clone *, int, caddr_t); static void enc_clone_destroy(struct ifnet *); -static int enc_add_hhooks(struct enc_softc *); +static void enc_add_hhooks(struct enc_softc *); static void enc_remove_hhooks(struct enc_softc *); static const char encname[] = "enc"; @@ -315,13 +315,12 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void *udata, void *ctx_data, return (0); } -static int +static void enc_add_hhooks(struct enc_softc *sc) { struct hookinfo hki; - int error; + int error __diagused; - error = EPFNOSUPPORT; hki.hook_func = enc_hhook; hki.hook_helper = NULL; hki.hook_udata = sc; @@ -330,28 +329,23 @@ enc_add_hhooks(struct enc_softc *sc) hki.hook_type = HHOOK_TYPE_IPSEC_IN; error = hhook_add_hook(V_ipsec_hhh_in[HHOOK_IPSEC_INET], &hki, HHOOK_WAITOK); - if (error != 0) - return (error); + MPASS(error == 0); hki.hook_type = HHOOK_TYPE_IPSEC_OUT; error = hhook_add_hook(V_ipsec_hhh_out[HHOOK_IPSEC_INET], &hki, HHOOK_WAITOK); - if (error != 0) - return (error); + MPASS(error == 0); #endif #ifdef INET6 hki.hook_id = AF_INET6; hki.hook_type = HHOOK_TYPE_IPSEC_IN; error = hhook_add_hook(V_ipsec_hhh_in[HHOOK_IPSEC_INET6], &hki, HHOOK_WAITOK); - if (error != 0) - return (error); + MPASS(error == 0); hki.hook_type = HHOOK_TYPE_IPSEC_OUT; error = hhook_add_hook(V_ipsec_hhh_out[HHOOK_IPSEC_INET6], &hki, HHOOK_WAITOK); - if (error != 0) - return (error); + MPASS(error == 0); #endif - return (error); } static void @@ -394,8 +388,7 @@ vnet_enc_init_proto(void *unused __unused) { KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); - if (enc_add_hhooks(V_enc_sc) != 0) - enc_clone_destroy(V_enc_sc->sc_ifp); + enc_add_hhooks(V_enc_sc); } VNET_SYSINIT(vnet_enc_init_proto, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, vnet_enc_init_proto, NULL);