From owner-dev-commits-src-branches@freebsd.org Wed Feb 24 13:01:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C82E55C44D; Wed, 24 Feb 2021 13:01:29 +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 4DlwzF3ZRDz3Dw0; Wed, 24 Feb 2021 13:01:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6DC502C96C; Wed, 24 Feb 2021 13:01:29 +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 11OD1TLX054478; Wed, 24 Feb 2021 13:01:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11OD1TeX054477; Wed, 24 Feb 2021 13:01:29 GMT (envelope-from git) Date: Wed, 24 Feb 2021 13:01:29 GMT Message-Id: <202102241301.11OD1TeX054477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ef160e5cb919 - stable/13 - pf: Remove unused return value from (de)hook_pf() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ef160e5cb919659951b3d4f70a966e58d5dce56f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2021 13:01:29 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ef160e5cb919659951b3d4f70a966e58d5dce56f commit ef160e5cb919659951b3d4f70a966e58d5dce56f Author: Kristof Provost AuthorDate: 2021-02-16 11:40:51 +0000 Commit: Kristof Provost CommitDate: 2021-02-24 08:03:43 +0000 pf: Remove unused return value from (de)hook_pf() These functions always return 0, which is good, because the code calling them doesn't handle this error gracefully. As the functions always succeed remove their return value, and the code handling their errors (because it was never executed anyway). MFC after: 1 week Sponsored by: Rubicon Communications, LLC (“Netgate”’) (cherry picked from commit 8a439f324e9010a122fa4c00426bde70dc373c2f) --- sys/netpfil/pf/pf_ioctl.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index bd8896cfb772..97be46509acc 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -213,8 +213,8 @@ static pfil_return_t pf_check6_out(struct mbuf **m, struct ifnet *ifp, int flags, void *ruleset __unused, struct inpcb *inp); #endif -static int hook_pf(void); -static int dehook_pf(void); +static void hook_pf(void); +static void dehook_pf(void); static int shutdown_pf(void); static int pf_load(void); static void pf_unload(void); @@ -1814,12 +1814,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td else { int cpu; - error = hook_pf(); - if (error) { - DPFPRINTF(PF_DEBUG_MISC, - ("pf: pfil registration failed\n")); - break; - } + hook_pf(); V_pf_status.running = 1; V_pf_status.since = time_second; @@ -1836,12 +1831,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td error = ENOENT; else { V_pf_status.running = 0; - error = dehook_pf(); - if (error) { - V_pf_status.running = 1; - DPFPRINTF(PF_DEBUG_MISC, - ("pf: pfil unregistration failed\n")); - } + dehook_pf(); V_pf_status.since = time_second; DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } @@ -4565,14 +4555,14 @@ VNET_DEFINE_STATIC(pfil_hook_t, pf_ip6_out_hook); #define V_pf_ip6_out_hook VNET(pf_ip6_out_hook) #endif -static int +static void hook_pf(void) { struct pfil_hook_args pha; struct pfil_link_args pla; if (V_pf_pfil_hooked) - return (0); + return; pha.pa_version = PFIL_VERSION; pha.pa_modname = "pf"; @@ -4620,15 +4610,14 @@ hook_pf(void) #endif V_pf_pfil_hooked = 1; - return (0); } -static int +static void dehook_pf(void) { if (V_pf_pfil_hooked == 0) - return (0); + return; #ifdef INET pfil_remove_hook(V_pf_ip4_in_hook); @@ -4640,7 +4629,6 @@ dehook_pf(void) #endif V_pf_pfil_hooked = 0; - return (0); } static void @@ -4688,20 +4676,10 @@ pf_load(void) static void pf_unload_vnet(void) { - int error; V_pf_vnet_active = 0; V_pf_status.running = 0; - error = dehook_pf(); - if (error) { - /* - * Should not happen! - * XXX Due to error code ESRCH, kldunload will show - * a message like 'No such process'. - */ - printf("%s : pfil unregisteration fail\n", __FUNCTION__); - return; - } + dehook_pf(); PF_RULES_WLOCK(); shutdown_pf();