Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Dec 2009 22:13:19 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw
Message-ID:  <200912272213.nBRMDJAC069043@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luigi
Date: Sun Dec 27 22:13:19 2009
New Revision: 201063
URL: http://svn.freebsd.org/changeset/base/201063

Log:
  use a less obfuscated construct to call the hook/unhook functions

Modified:
  user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c	Sun Dec 27 21:58:48 2009	(r201062)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c	Sun Dec 27 22:13:19 2009	(r201063)
@@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi
 static int
 ipfw_hook(int onoff, int pf)
 {
+	const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK;
 	struct pfil_head *pfh;
-	int (*fn)(int (*pfil_func)(void *, struct mbuf **,
-		    struct ifnet *, int, struct inpcb *),
-		   void *, int, struct pfil_head *);
-
 
 	pfh = pfil_head_get(PFIL_TYPE_AF, pf);
 	if (pfh == NULL)
 		return ENOENT;
 
-	fn = (onoff) ? pfil_add_hook : pfil_remove_hook;
-	(void)fn(ipfw_check_hook, NULL, PFIL_IN | PFIL_OUT | PFIL_WAITOK, pfh);
+	if (onoff)
+		(void)pfil_add_hook(ipfw_check_hook, NULL, arg, pfh);
+	else
+		(void)pfil_remove_hook(ipfw_check_hook, NULL, arg, pfh);
 
 	return 0;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912272213.nBRMDJAC069043>