Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2018 05:10:37 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342377 - head/sys/contrib/ipfilter/netinet
Message-ID:  <201812230510.wBN5AbZS048560@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Sun Dec 23 05:10:36 2018
New Revision: 342377
URL: https://svnweb.freebsd.org/changeset/base/342377

Log:
  Remove NETBSD_PF. NETBSD_PF is a flag that defines whether the pfil(9)
  framework is available. pfil(9) has been in FreeBSD since FreeBSD 5
  and according to svn log was first committed to HEAD in 2000, therefore
  it is safe to say the check is no longer needed in FreeBSD.
  
  pfil(9) first appeared in NetBSD 1.3 (hence the name NETBSD_PF).
  Therefore it is safe to say that it is supported by every NetBSD system
  today. The framework also exists in illumos.
  
  As ipfilter code is shared and exchanged between FreeBSD and NetBSD, and
  at some point in the future illumos too, and as all three platforms have
  pfil(9), the redundant NETBSD_PF #defines and #ifdefs are removed.
  
  MFC after:	1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_compat.h
  head/sys/contrib/ipfilter/netinet/ip_fil.h
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_compat.h	Sun Dec 23 01:05:52 2018	(r342376)
+++ head/sys/contrib/ipfilter/netinet/ip_compat.h	Sun Dec 23 05:10:36 2018	(r342377)
@@ -146,7 +146,6 @@ struct  ether_addr {
 #  define	COPYIN(a,b,c)	copyin((caddr_t)(a), (caddr_t)(b), (c))
 #  define	COPYOUT(a,b,c)	copyout((caddr_t)(a), (caddr_t)(b), (c))
 
-#   define NETBSD_PF
 # else
 #  include <inttypes.h>
 # endif /* _KERNEL */

Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil.h	Sun Dec 23 01:05:52 2018	(r342376)
+++ head/sys/contrib/ipfilter/netinet/ip_fil.h	Sun Dec 23 05:10:36 2018	(r342377)
@@ -1435,22 +1435,6 @@ typedef	struct	ipftune	{
 # define	CDEV_MAJOR	79
 #endif
 
-/*
- * Post NetBSD 1.2 has the PFIL interface for packet filters.  This turns
- * on those hooks.  We don't need any special mods in non-IP Filter code
- * with this!
- */
-#if (defined(NetBSD) && (NetBSD > 199609) && (NetBSD <= 1991011)) || \
-    (defined(NetBSD1_2) && NetBSD1_2 > 1) || \
-    (defined(__FreeBSD__) && (__FreeBSD_version >= 500043))
-# if (defined(NetBSD) && NetBSD >= 199905)
-#  define PFIL_HOOKS
-# endif
-# ifdef PFIL_HOOKS
-#  define NETBSD_PF
-# endif
-#endif
-
 #ifdef _KERNEL
 # define	FR_VERBOSE(verb_pr)
 # define	FR_DEBUG(verb_pr)

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Sun Dec 23 01:05:52 2018	(r342376)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Sun Dec 23 05:10:36 2018	(r342377)
@@ -97,9 +97,7 @@ VNET_DEFINE(ipf_main_softc_t, ipfmain) = {
 #define	V_ipfmain		VNET(ipfmain)
 
 # include <sys/conf.h>
-# if defined(NETBSD_PF)
 #  include <net/pfil.h>
-# endif /* NETBSD_PF */
 
 static eventhandler_tag ipf_arrivetag, ipf_departtag;
 #if 0
@@ -1336,14 +1334,11 @@ ipf_inject(fin, m)
 }
 
 int ipf_pfil_unhook(void) {
-#if defined(NETBSD_PF) && (__FreeBSD_version >= 500011)
 	struct pfil_head *ph_inet;
-#  ifdef USE_INET6
+#ifdef USE_INET6
 	struct pfil_head *ph_inet6;
-#  endif
 #endif
 
-#ifdef NETBSD_PF
 	ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
 	if (ph_inet != NULL)
 		pfil_remove_hook((void *)ipf_check_wrapper, NULL,
@@ -1354,20 +1349,16 @@ int ipf_pfil_unhook(void) {
 		pfil_remove_hook((void *)ipf_check_wrapper6, NULL,
 		    PFIL_IN|PFIL_OUT|PFIL_WAITOK, ph_inet6);
 # endif
-#endif
 
 	return (0);
 }
 
 int ipf_pfil_hook(void) {
-#if defined(NETBSD_PF) && (__FreeBSD_version >= 500011)
 	struct pfil_head *ph_inet;
-#  ifdef USE_INET6
+#ifdef USE_INET6
 	struct pfil_head *ph_inet6;
-#  endif
 #endif
 
-# ifdef NETBSD_PF
 	ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
 #    ifdef USE_INET6
 	ph_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
@@ -1388,7 +1379,6 @@ int ipf_pfil_hook(void) {
 		pfil_add_hook((void *)ipf_check_wrapper6, NULL,
 				      PFIL_IN|PFIL_OUT|PFIL_WAITOK, ph_inet6);
 #  endif
-# endif
 	return (0);
 }
 



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