aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-02-16 11:40:51 +0000
committerKristof Provost <kp@FreeBSD.org>2021-02-17 08:15:40 +0000
commit8a439f324e9010a122fa4c00426bde70dc373c2f (patch)
tree5b38495c2eb46e6af9e63092493ea598fbb5e017
parent6b7e592c215fb76ea027f25030ddc9a697184fbe (diff)
downloadsrc-8a439f324e9010a122fa4c00426bde70dc373c2f.tar.gz
src-8a439f324e9010a122fa4c00426bde70dc373c2f.zip
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”’)
-rw-r--r--sys/netpfil/pf/pf_ioctl.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index edc8443dcc0a..028938b9aea0 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();