From 86cc815886aae143342c2b4270ad34075906a0f9 Mon Sep 17 00:00:00 2001 From: cy Date: Sun, 30 Dec 2018 04:37:49 +0000 Subject: [PATCH] MFC r342377: 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. git-svn-id: svn://svn.freebsd.org/base/stable/10@342607 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/contrib/ipfilter/netinet/ip_compat.h | 1 - sys/contrib/ipfilter/netinet/ip_fil.h | 16 ---------------- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 14 ++------------ 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h index 6184319ef..0ace2088b 100644 --- a/sys/contrib/ipfilter/netinet/ip_compat.h +++ b/sys/contrib/ipfilter/netinet/ip_compat.h @@ -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 # endif /* _KERNEL */ diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h index 54b043c03..8b1287cb1 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.h +++ b/sys/contrib/ipfilter/netinet/ip_fil.h @@ -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) diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index c39fdb3c3..8e1222610 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -100,9 +100,7 @@ int ipf_locks_done = 0; ipf_main_softc_t ipfmain; # include -# if defined(NETBSD_PF) # include -# endif /* NETBSD_PF */ /* * We provide the ipf_checkp name just to minimize changes later. */ @@ -1358,14 +1356,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, @@ -1376,20 +1371,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); @@ -1410,7 +1401,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); } -- 2.45.0