[Midnightbsd-cvs] src [10404] trunk/sys: update os checks
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jun 3 23:52:12 EDT 2018
Revision: 10404
http://svnweb.midnightbsd.org/src/?rev=10404
Author: laffer1
Date: 2018-06-03 23:52:12 -0400 (Sun, 03 Jun 2018)
Log Message:
-----------
update os checks
Modified Paths:
--------------
trunk/sys/contrib/altq/altq/altq_cbq.c
trunk/sys/contrib/altq/altq/altq_cdnr.c
trunk/sys/contrib/altq/altq/altq_hfsc.c
trunk/sys/contrib/altq/altq/altq_priq.c
trunk/sys/contrib/altq/altq/altq_red.c
trunk/sys/contrib/altq/altq/altq_rio.c
trunk/sys/contrib/altq/altq/altq_rmclass.c
trunk/sys/contrib/altq/altq/altq_subr.c
trunk/sys/contrib/altq/altq/altq_var.h
trunk/sys/contrib/altq/altq/if_altq.h
trunk/sys/contrib/ipfilter/netinet/fil.c
trunk/sys/contrib/ipfilter/netinet/ip_auth.c
trunk/sys/contrib/ipfilter/netinet/ip_compat.h
trunk/sys/contrib/ipfilter/netinet/ip_fil.h
trunk/sys/contrib/ipfilter/netinet/ip_htable.c
trunk/sys/contrib/ipfilter/netinet/ip_log.c
trunk/sys/contrib/ipfilter/netinet/ip_lookup.c
trunk/sys/contrib/ipfilter/netinet/ip_nat.c
trunk/sys/contrib/ipfilter/netinet/ip_rules.c
trunk/sys/contrib/ipfilter/netinet/ip_scan.c
trunk/sys/contrib/ipfilter/netinet/ip_sync.c
trunk/sys/contrib/ngatm/netnatm/api/cc_dump.c
trunk/sys/contrib/ngatm/netnatm/api/ccpriv.h
trunk/sys/contrib/ngatm/netnatm/saal/sscfu.h
trunk/sys/contrib/ngatm/netnatm/saal/sscfupriv.h
trunk/sys/contrib/ngatm/netnatm/saal/sscop.h
trunk/sys/contrib/ngatm/netnatm/saal/sscoppriv.h
trunk/sys/contrib/ngatm/netnatm/sig/unipriv.h
trunk/sys/contrib/ngatm/netnatm/unimsg.h
trunk/sys/contrib/octeon-sdk/cvmx-abi.h
trunk/sys/contrib/octeon-sdk/cvmx-access-native.h
trunk/sys/contrib/octeon-sdk/cvmx-asm.h
trunk/sys/contrib/octeon-sdk/cvmx-atomic.h
trunk/sys/contrib/octeon-sdk/cvmx-bootmem.c
trunk/sys/contrib/octeon-sdk/cvmx-clock.c
trunk/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
trunk/sys/contrib/octeon-sdk/cvmx-dma-engine.c
trunk/sys/contrib/octeon-sdk/cvmx-ebt3000.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-board.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-cfg.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-errata.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-ilk.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-jtag.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-loop.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-npi.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-spi.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-srio.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-util.c
trunk/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
trunk/sys/contrib/octeon-sdk/cvmx-helper.c
trunk/sys/contrib/octeon-sdk/cvmx-ilk.c
trunk/sys/contrib/octeon-sdk/cvmx-ipd.c
trunk/sys/contrib/octeon-sdk/cvmx-l2c.c
trunk/sys/contrib/octeon-sdk/cvmx-malloc/malloc.c
trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.c
trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.h
trunk/sys/contrib/octeon-sdk/cvmx-pko.c
trunk/sys/contrib/octeon-sdk/cvmx-platform.h
trunk/sys/contrib/octeon-sdk/cvmx-pow.h
trunk/sys/contrib/octeon-sdk/cvmx-qlm-tables.c
trunk/sys/contrib/octeon-sdk/cvmx-qlm.c
trunk/sys/contrib/octeon-sdk/cvmx-spi.c
trunk/sys/contrib/octeon-sdk/cvmx-utils.h
trunk/sys/contrib/octeon-sdk/cvmx.h
trunk/sys/contrib/octeon-sdk/octeon-feature.h
trunk/sys/contrib/octeon-sdk/octeon-model.h
trunk/sys/contrib/pf/net/if_pflog.c
trunk/sys/contrib/pf/net/if_pflog.h
trunk/sys/contrib/pf/net/if_pflow.h
trunk/sys/contrib/pf/net/if_pfsync.c
trunk/sys/contrib/pf/net/if_pfsync.h
trunk/sys/contrib/pf/net/pf.c
trunk/sys/contrib/pf/net/pf_if.c
trunk/sys/contrib/pf/net/pf_ioctl.c
trunk/sys/contrib/pf/net/pf_lb.c
trunk/sys/contrib/pf/net/pf_norm.c
trunk/sys/contrib/pf/net/pf_osfp.c
trunk/sys/contrib/pf/net/pf_ruleset.c
trunk/sys/contrib/pf/net/pf_table.c
trunk/sys/contrib/pf/net/pfvar.h
trunk/sys/contrib/v4l/videodev2.h
trunk/sys/contrib/xz-embedded/linux/include/linux/xz.h
trunk/sys/net/bpf.h
Modified: trunk/sys/contrib/altq/altq/altq_cbq.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_cbq.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_cbq.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -32,13 +32,13 @@
* These notices must be retained in any copies of any part of this software.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#ifdef ALTQ_CBQ /* cbq is enabled by ALTQ_CBQ option in opt_altq.h */
#include <sys/param.h>
Modified: trunk/sys/contrib/altq/altq/altq_cdnr.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_cdnr.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_cdnr.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -28,13 +28,13 @@
* SUCH DAMAGE.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#include <sys/param.h>
#include <sys/malloc.h>
Modified: trunk/sys/contrib/altq/altq/altq_hfsc.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_hfsc.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_hfsc.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -43,13 +43,13 @@
* a class whose fit-time exceeds the current time.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#ifdef ALTQ_HFSC /* hfsc is enabled by ALTQ_HFSC option in opt_altq.h */
Modified: trunk/sys/contrib/altq/altq/altq_priq.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_priq.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_priq.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -30,13 +30,13 @@
* priority queue
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#ifdef ALTQ_PRIQ /* priq is enabled by ALTQ_PRIQ option in opt_altq.h */
Modified: trunk/sys/contrib/altq/altq/altq_red.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_red.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_red.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -61,13 +61,13 @@
* SUCH DAMAGE.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#ifdef ALTQ_RED /* red is enabled by ALTQ_RED option in opt_altq.h */
#include <sys/param.h>
Modified: trunk/sys/contrib/altq/altq/altq_rio.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_rio.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_rio.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -60,13 +60,13 @@
* SUCH DAMAGE.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#ifdef ALTQ_RIO /* rio is enabled by ALTQ_RIO option in opt_altq.h */
#include <sys/param.h>
Modified: trunk/sys/contrib/altq/altq/altq_rmclass.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_rmclass.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_rmclass.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -39,13 +39,13 @@
*
* @(#)rm_class.c 1.48 97/12/05 SMI
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#ifdef ALTQ_CBQ /* cbq is enabled by ALTQ_CBQ option in opt_altq.h */
#include <sys/param.h>
@@ -1552,7 +1552,7 @@
* a 'backstop' to restart this class.
*/
if (delay > tick * 2) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* FreeBSD rounds up the tick */
t = hzto(&cl->undertime_);
#else
Modified: trunk/sys/contrib/altq/altq/altq_subr.c
===================================================================
--- trunk/sys/contrib/altq/altq/altq_subr.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_subr.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -28,13 +28,13 @@
* SUCH DAMAGE.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__MidnightBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet6.h"
#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
+#endif /* __MidnightBSD__ || __NetBSD__ */
#include <sys/param.h>
#include <sys/malloc.h>
@@ -53,7 +53,7 @@
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/if_types.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/vnet.h>
#endif
@@ -74,7 +74,7 @@
#endif
/* machine dependent clock related includes */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/eventhandler.h>
@@ -83,7 +83,7 @@
#if defined(__amd64__) || defined(__i386__)
#include <machine/cpufunc.h> /* for pentium tsc */
#include <machine/specialreg.h> /* for CPUID_TSC */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <machine/md_var.h> /* for cpu_feature */
#elif defined(__NetBSD__) || defined(__OpenBSD__)
#include <machine/cpu.h> /* for cpu_feature */
@@ -97,7 +97,7 @@
int (*altq_input)(struct mbuf *, int) = NULL;
static struct mbuf *tbr_dequeue(struct ifaltq *, int);
static int tbr_timer = 0; /* token bucket regulator timer */
-#if !defined(__FreeBSD__) || (__FreeBSD_version < 600000)
+#if !defined(__MidnightBSD__) || (__FreeBSD_version < 600000)
static struct callout tbr_callout = CALLOUT_INITIALIZER;
#else
static struct callout tbr_callout;
@@ -445,7 +445,7 @@
tbr_timeout(arg)
void *arg;
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_ITERATOR_DECL(vnet_iter);
#endif
struct ifnet *ifp;
@@ -457,7 +457,7 @@
#else
s = splimp();
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
IFNET_RLOCK_NOSLEEP();
VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
@@ -473,7 +473,7 @@
ifp->if_start != NULL)
(*ifp->if_start)(ifp);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK_NOSLEEP();
@@ -969,7 +969,7 @@
#if (!defined(__amd64__) && !defined(__i386__)) || defined(ALTQ_NOPCC)
machclk_usepcc = 0;
#endif
-#if defined(__FreeBSD__) && defined(SMP)
+#if defined(__MidnightBSD__) && defined(SMP)
machclk_usepcc = 0;
#endif
#if defined(__NetBSD__) && defined(MULTIPROCESSOR)
@@ -977,7 +977,7 @@
#endif
#if defined(__amd64__) || defined(__i386__)
/* check if TSC is available */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((cpu_feature & CPUID_TSC) == 0 ||
atomic_load_acq_64(&tsc_freq) == 0)
#else
@@ -1013,7 +1013,7 @@
* accessible, just use it.
*/
#if defined(__amd64__) || defined(__i386__)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
machclk_freq = atomic_load_acq_64(&tsc_freq);
#elif defined(__NetBSD__)
machclk_freq = (u_int32_t)cpu_tsc_freq;
Modified: trunk/sys/contrib/altq/altq/altq_var.h
===================================================================
--- trunk/sys/contrib/altq/altq/altq_var.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/altq_var.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -202,7 +202,7 @@
#define CALLOUT_STOP(c) untimeout((c)->c_func,(c)->c_arg)
#define CALLOUT_INITIALIZER { NULL, NULL }
#endif
-#if !defined(__FreeBSD__)
+#if !defined(__MidnightBSD__)
typedef void (timeout_t)(void *);
#endif
Modified: trunk/sys/contrib/altq/altq/if_altq.h
===================================================================
--- trunk/sys/contrib/altq/altq/if_altq.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/altq/altq/if_altq.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -30,7 +30,7 @@
#ifndef _ALTQ_IF_ALTQ_H_
#define _ALTQ_IF_ALTQ_H_
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/lock.h> /* XXX */
#include <sys/mutex.h> /* XXX */
#include <sys/event.h> /* XXX */
@@ -52,7 +52,7 @@
int ifq_len;
int ifq_maxlen;
int ifq_drops;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct mtx ifq_mtx;
#endif
Modified: trunk/sys/contrib/ipfilter/netinet/fil.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/fil.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/fil.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -216,7 +216,7 @@
struct ipftuneable *,
ipftuneval_t *));
#if !defined(_KERNEL) || (!defined(__NetBSD__) && !defined(__OpenBSD__) && \
- !defined(__FreeBSD__)) || \
+ !defined(__MidnightBSD__)) || \
FREEBSD_LT_REV(501000) || NETBSD_LT_REV(105000000) || \
OPENBSD_LT_REV(200006)
static int ppsratecheck(struct timeval *, int *, int);
@@ -5451,7 +5451,7 @@
#if !defined(_KERNEL) || (!defined(__NetBSD__) && !defined(__OpenBSD__) && \
- !defined(__FreeBSD__)) || \
+ !defined(__MidnightBSD__)) || \
FREEBSD_LT_REV(501000) || NETBSD_LT_REV(105000000) || \
OPENBSD_LT_REV(200006)
/*
@@ -6132,7 +6132,7 @@
char *buffer;
{
static char namebuf[LIFNAMSIZ];
-# if defined(MENTAT) || defined(__FreeBSD__) || defined(__osf__) || \
+# if defined(MENTAT) || defined(__MidnightBSD__) || defined(__osf__) || \
defined(__sgi) || defined(linux) || defined(_AIX51) || \
(defined(sun) && !defined(__SVR4) && !defined(__svr4__))
int unit, space;
@@ -6144,7 +6144,7 @@
buffer = namebuf;
(void) strncpy(buffer, ifp->if_name, LIFNAMSIZ);
buffer[LIFNAMSIZ - 1] = '\0';
-# if defined(MENTAT) || defined(__FreeBSD__) || defined(__osf__) || \
+# if defined(MENTAT) || defined(__MidnightBSD__) || defined(__osf__) || \
defined(__sgi) || defined(_AIX51) || \
(defined(sun) && !defined(__SVR4) && !defined(__svr4__))
for (s = buffer; *s; s++)
Modified: trunk/sys/contrib/ipfilter/netinet/ip_auth.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_auth.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_auth.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -113,7 +113,7 @@
#include "netinet/ip_auth.h"
#if !defined(MENTAT) && !defined(linux)
# include <net/netisr.h>
-# ifdef __FreeBSD__
+# ifdef __MidnightBSD__
# include <machine/cpufunc.h>
# endif
#endif
Modified: trunk/sys/contrib/ipfilter/netinet/ip_compat.h
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_compat.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_compat.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -460,7 +460,7 @@
#ifdef USE_INET6
-# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
+# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MidnightBSD__) || \
defined(__osf__) || defined(linux)
# include <netinet/ip6.h>
# include <netinet/icmp6.h>
@@ -484,11 +484,11 @@
# define COPYBACK m_copyback
# endif
# if (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105180000)) || \
- defined(__FreeBSD__) || (defined(OpenBSD) && (OpenBSD < 200206)) || \
+ defined(__MidnightBSD__) || (defined(OpenBSD) && (OpenBSD < 200206)) || \
defined(_BSDI_VERSION)
# include <vm/vm.h>
# endif
-# if !defined(__FreeBSD__) || FREEBSD_GE_REV(300000)
+# if !defined(__MidnightBSD__) || FREEBSD_GE_REV(300000)
# if NETBSD_GE_REV(105180000) || OPENBSD_GE_REV(200111)
# include <uvm/uvm_extern.h>
# else
@@ -496,9 +496,9 @@
extern vm_map_t kmem_map;
# endif
# include <sys/proc.h>
-# else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
+# else /* !__MidnightBSD__ || (__MidnightBSD__ && __FreeBSD_version >= 300000) */
# include <vm/vm_kern.h>
-# endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
+# endif /* !__MidnightBSD__ || (__MidnightBSD__ && __FreeBSD_version >= 300000) */
# ifdef IPFILTER_M_IPFILTER
# include <sys/malloc.h>
Modified: trunk/sys/contrib/ipfilter/netinet/ip_fil.h
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_fil.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_fil.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -1447,7 +1447,7 @@
*/
#if (defined(NetBSD) && (NetBSD > 199609) && (NetBSD <= 1991011)) || \
(defined(NetBSD1_2) && NetBSD1_2 > 1) || \
- (defined(__FreeBSD__) && (__FreeBSD_version >= 500043))
+ (defined(__MidnightBSD__) && (__FreeBSD_version >= 500043))
# if (defined(NetBSD) && NetBSD >= 199905)
# define PFIL_HOOKS
# endif
Modified: trunk/sys/contrib/ipfilter/netinet/ip_htable.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_htable.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_htable.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -31,7 +31,7 @@
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
# include <sys/malloc.h>
#endif
-#if defined(__FreeBSD__)
+#if defined(__MidnightBSD__)
# include <sys/cdefs.h>
# include <sys/proc.h>
#endif
Modified: trunk/sys/contrib/ipfilter/netinet/ip_log.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_log.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_log.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -16,7 +16,7 @@
# define KERNEL 1
# define _KERNEL 1
#endif
-#if defined(__FreeBSD__) && !defined(_KERNEL)
+#if defined(__MidnightBSD__) && !defined(_KERNEL)
# include <osreldate.h>
#endif
#ifndef SOLARIS
@@ -788,7 +788,7 @@
return EIO;
}
-# if (defined(BSD) && (BSD >= 199101)) || defined(__FreeBSD__) || \
+# if (defined(BSD) && (BSD >= 199101)) || defined(__MidnightBSD__) || \
defined(__osf__)
uio->uio_rw = UIO_READ;
# endif
Modified: trunk/sys/contrib/ipfilter/netinet/ip_lookup.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_lookup.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_lookup.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -38,7 +38,7 @@
#endif
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__FreeBSD__)
+#if defined(__MidnightBSD__)
# include <sys/cdefs.h>
# include <sys/proc.h>
#endif
Modified: trunk/sys/contrib/ipfilter/netinet/ip_nat.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_nat.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_nat.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -5113,7 +5113,7 @@
ipf_fix_outcksum(0, &fin->fin_ip->ip_sum, msumd, 0);
}
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \
- defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD__)
+ defined(linux) || defined(BRIDGE_IPF) || defined(__MidnightBSD__)
else {
/*
* Strictly speaking, this isn't necessary on BSD
@@ -5225,7 +5225,7 @@
uh->uh_ulen += fin->fin_plen;
uh->uh_ulen = htons(uh->uh_ulen);
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \
- defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD__)
+ defined(linux) || defined(BRIDGE_IPF) || defined(__MidnightBSD__)
ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0);
#endif
Modified: trunk/sys/contrib/ipfilter/netinet/ip_rules.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_rules.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_rules.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -22,7 +22,7 @@
#endif
#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 399000000)
#else
-# if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sgi)
+# if !defined(__MidnightBSD__) && !defined(__OpenBSD__) && !defined(__sgi)
# include <sys/systm.h>
# endif
#endif
@@ -31,7 +31,7 @@
#if !defined(__SVR4) && !defined(__svr4__) && !defined(__hpux)
# include <sys/mbuf.h>
#endif
-#if defined(__FreeBSD__) && (__FreeBSD_version > 220000)
+#if defined(__MidnightBSD__) && (__FreeBSD_version > 220000)
# include <sys/sockio.h>
#else
# include <sys/ioctl.h>
Modified: trunk/sys/contrib/ipfilter/netinet/ip_scan.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_scan.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_scan.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -36,7 +36,7 @@
#if !defined(__hpux) && !defined(__osf__) && !defined(linux) && !defined(AIX)
# include <sys/ioccom.h>
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
# include <sys/filio.h>
# include <sys/malloc.h>
#else
Modified: trunk/sys/contrib/ipfilter/netinet/ip_sync.c
===================================================================
--- trunk/sys/contrib/ipfilter/netinet/ip_sync.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ipfilter/netinet/ip_sync.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -450,7 +450,7 @@
int err = 0;
-# if BSD_GE_YEAR(199306) || defined(__FreeBSD__) || defined(__osf__)
+# if BSD_GE_YEAR(199306) || defined(__MidnightBSD__) || defined(__osf__)
uio->uio_rw = UIO_WRITE;
# endif
@@ -598,7 +598,7 @@
return EINVAL;
}
-# if BSD_GE_YEAR(199306) || defined(__FreeBSD__) || defined(__osf__)
+# if BSD_GE_YEAR(199306) || defined(__MidnightBSD__) || defined(__osf__)
uio->uio_rw = UIO_READ;
# endif
Modified: trunk/sys/contrib/ngatm/netnatm/api/cc_dump.c
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/api/cc_dump.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/api/cc_dump.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -43,7 +43,7 @@
#include <netnatm/api/ccpriv.h>
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <machine/stdarg.h>
#endif
#else /* !_KERNEL */
Modified: trunk/sys/contrib/ngatm/netnatm/api/ccpriv.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/api/ccpriv.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/api/ccpriv.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -35,7 +35,7 @@
* Private declarations.
*/
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netgraph/atm/ccatm/ng_ccatm_cust.h>
#endif
#else /* !_KERNEL */
Modified: trunk/sys/contrib/ngatm/netnatm/saal/sscfu.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/saal/sscfu.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/saal/sscfu.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -42,7 +42,7 @@
* Define how a buffer looks like.
*/
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define SSCFU_MBUF_T mbuf
#endif
#else
Modified: trunk/sys/contrib/ngatm/netnatm/saal/sscfupriv.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/saal/sscfupriv.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/saal/sscfupriv.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -32,7 +32,7 @@
* Private SSCF-UNI definitions.
*/
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netgraph/atm/sscfu/ng_sscfu_cust.h>
#endif
#else
Modified: trunk/sys/contrib/ngatm/netnatm/saal/sscop.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/saal/sscop.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/saal/sscop.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -40,7 +40,7 @@
* Define how a buffer looks like.
*/
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define SSCOP_MBUF_T mbuf
#endif
#else
Modified: trunk/sys/contrib/ngatm/netnatm/saal/sscoppriv.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/saal/sscoppriv.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/saal/sscoppriv.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -33,7 +33,7 @@
*
*/
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netgraph/atm/sscop/ng_sscop_cust.h>
#endif
#else /* !_KERNEL */
Modified: trunk/sys/contrib/ngatm/netnatm/sig/unipriv.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/sig/unipriv.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/sig/unipriv.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -35,7 +35,7 @@
#define unipriv_h
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netgraph/atm/uni/ng_uni_cust.h>
#endif
#else
Modified: trunk/sys/contrib/ngatm/netnatm/unimsg.h
===================================================================
--- trunk/sys/contrib/ngatm/netnatm/unimsg.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/ngatm/netnatm/unimsg.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -36,7 +36,7 @@
#include <sys/types.h>
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/systm.h>
#endif
#include <sys/stdint.h>
Modified: trunk/sys/contrib/octeon-sdk/cvmx-abi.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-abi.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-abi.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -51,7 +51,7 @@
#ifndef __CVMX_ABI_H__
#define __CVMX_ABI_H__
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__MidnightBSD__) && defined(_KERNEL)
#include <machine/endian.h>
#else
#ifndef __U_BOOT__
Modified: trunk/sys/contrib/octeon-sdk/cvmx-access-native.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-access-native.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-access-native.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -140,7 +140,7 @@
return address + 0x400000000ull; /* 256MB-512MB is a virtual mapping for the 2nd 256MB */
else
return address; /* Looks to be a 1:1 mapped userspace pointer */
-#elif defined(__FreeBSD__) && defined(_KERNEL)
+#elif defined(__MidnightBSD__) && defined(_KERNEL)
return (pmap_kextract((vm_offset_t)ptr));
#else
#if CVMX_USE_1_TO_1_TLB_MAPPINGS
@@ -252,7 +252,7 @@
return CASTPTR(void, physical_address - 0x400000000ull);
else
return CASTPTR(void, physical_address);
-#elif defined(__FreeBSD__) && defined(_KERNEL)
+#elif defined(__MidnightBSD__) && defined(_KERNEL)
#if defined(__mips_n64)
return CASTPTR(void, CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, physical_address));
#else
Modified: trunk/sys/contrib/octeon-sdk/cvmx-asm.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-asm.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-asm.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -618,7 +618,7 @@
#define TLB_GLOBAL (0x1ULL<<0)
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
/* Macros to PUSH and POP Octeon2 ISA. */
#define CVMX_PUSH_OCTEON2 asm volatile (".set push\n.set arch=octeon2")
#define CVMX_POP_OCTEON2 asm volatile (".set pop")
Modified: trunk/sys/contrib/octeon-sdk/cvmx-atomic.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-atomic.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-atomic.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -356,7 +356,7 @@
{
uint64_t tmp, ret;
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
if (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF7XXX))
{
CVMX_PUSH_OCTEON2;
@@ -395,7 +395,7 @@
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
: [inc] "r" (incr)
: "memory");
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
}
#endif
@@ -441,7 +441,7 @@
{
uint32_t tmp, ret;
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
if (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF7XXX))
{
CVMX_PUSH_OCTEON2;
@@ -480,7 +480,7 @@
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
: [inc] "r" (incr)
: "memory");
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
}
#endif
@@ -657,7 +657,7 @@
{
uint64_t tmp, ret;
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
if (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF7XXX))
{
CVMX_PUSH_OCTEON2;
@@ -695,7 +695,7 @@
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
: [new_val] "r" (new_val)
: "memory");
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
}
#endif
@@ -719,7 +719,7 @@
{
uint32_t tmp, ret;
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
if (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF7XXX))
{
CVMX_PUSH_OCTEON2;
@@ -757,7 +757,7 @@
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
: [new_val] "r" (new_val)
: "memory");
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
}
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-bootmem.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-bootmem.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-bootmem.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -56,7 +56,7 @@
#include <asm/octeon/cvmx.h>
#include <asm/octeon/cvmx-bootmem.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#endif
#include "cvmx.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-clock.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-clock.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-clock.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -60,7 +60,7 @@
#include <asm/octeon/cvmx-pexp-defs.h>
#include <asm/octeon/cvmx-dbg-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#endif
#include "cvmx.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-cmd-queue.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-cmd-queue.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -66,7 +66,7 @@
#else
#include "cvmx.h"
#include "cvmx-bootmem.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#endif
#include "cvmx-fpa.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-dma-engine.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-dma-engine.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-dma-engine.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -66,7 +66,7 @@
#include <asm/octeon/cvmx-pexp-defs.h>
#include <asm/octeon/cvmx-helper-cfg.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-ebt3000.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-ebt3000.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-ebt3000.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -53,7 +53,7 @@
*
*/
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#endif
#include "cvmx.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-board.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-board.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-board.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -74,7 +74,7 @@
#include "cvmx-helper-util.h"
#include "cvmx-helper-board.h"
#include "cvmx-gpio.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#ifdef __U_BOOT__
# include <libfdt.h>
#else
@@ -94,7 +94,7 @@
*/
CVMX_SHARED cvmx_helper_link_info_t (*cvmx_override_board_link_get)(int ipd_port) = NULL;
-#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__FreeBSD__) || !defined(_KERNEL))
+#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__MidnightBSD__) || !defined(_KERNEL))
static void cvmx_retry_i2c_write(int twsi_id, uint8_t dev_addr, uint16_t internal_addr, int num_bytes, int ia_width_bytes, uint64_t data)
{
@@ -373,7 +373,7 @@
*/
if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_SIM)
return -1;
-#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__FreeBSD__) || !defined(_KERNEL))
+#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__MidnightBSD__) || !defined(_KERNEL))
if (cvmx_sysinfo_get()->fdt_addr)
{
cvmx_phy_info_t phy_info = __get_phy_info_from_dt(ipd_port);
@@ -782,7 +782,7 @@
return result;
}
-#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__FreeBSD__) || !defined(_KERNEL))
+#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__MidnightBSD__) || !defined(_KERNEL))
/**
* @INTERNAL
* Switch MDIO mux to the specified port.
@@ -988,7 +988,7 @@
int phy_addr;
int is_broadcom_phy = 0;
-#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__FreeBSD__) || !defined(_KERNEL))
+#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__MidnightBSD__) || !defined(_KERNEL))
if (cvmx_sysinfo_get()->fdt_addr)
{
return __cvmx_helper_board_link_get_from_dt(ipd_port);
@@ -1527,7 +1527,7 @@
*/
cvmx_helper_board_usb_clock_types_t __cvmx_helper_board_usb_get_clock_type(void)
{
-#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__FreeBSD__) || !defined(_KERNEL))
+#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && (!defined(__MidnightBSD__) || !defined(_KERNEL))
const void *fdt_addr = CASTPTR(const void *, cvmx_sysinfo_get()->fdt_addr);
int nodeoffset;
const void *nodep;
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-cfg.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-cfg.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-cfg.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -68,7 +68,7 @@
#include "cvmx-helper-cfg.h"
#include "cvmx-ilk.h"
#include "cvmx-helper-ilk.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#include "executive-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-errata.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-errata.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-errata.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -62,7 +62,7 @@
#include <asm/octeon/cvmx-asxx-defs.h>
#include <asm/octeon/cvmx-gmxx-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-ilk.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-ilk.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-ilk.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -60,7 +60,7 @@
#include <asm/octeon/cvmx-qlm.h>
#include <asm/octeon/cvmx-ilk-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-jtag.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-jtag.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-jtag.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -52,12 +52,12 @@
#include <asm/octeon/cvmx-clock.h>
#include <asm/octeon/cvmx-helper-jtag.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#endif
#include "cvmx.h"
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__MidnightBSD__) && defined(_KERNEL)
#include "cvmx-helper-jtag.h"
#endif
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-loop.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-loop.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-loop.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -60,7 +60,7 @@
#endif
#include <asm/octeon/cvmx-pip-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#ifdef CVMX_ENABLE_PKO_FUNCTIONS
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-npi.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-npi.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-npi.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -63,7 +63,7 @@
#endif
#include <asm/octeon/cvmx-pip-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#include "cvmx.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -67,7 +67,7 @@
#include <asm/octeon/cvmx-dbg-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#ifdef CVMX_ENABLE_PKO_FUNCTIONS
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -66,7 +66,7 @@
#include <asm/octeon/cvmx-gmxx-defs.h>
#include <asm/octeon/cvmx-ciu-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#ifdef CVMX_ENABLE_PKO_FUNCTIONS
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-spi.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-spi.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-spi.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -60,7 +60,7 @@
#include <asm/octeon/cvmx-pko-defs.h>
#include <asm/octeon/cvmx-pip-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#ifdef CVMX_ENABLE_PKO_FUNCTIONS
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-srio.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-srio.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-srio.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -64,7 +64,7 @@
#include <asm/octeon/cvmx-sriomaintx-defs.h>
#include <asm/octeon/cvmx-dpi-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#ifdef CVMX_ENABLE_PKO_FUNCTIONS
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-util.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-util.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-util.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -67,7 +67,7 @@
#include <asm/octeon/cvmx-pexp-defs.h>
#include <asm/octeon/cvmx-helper-cfg.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper-xaui.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper-xaui.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -66,7 +66,7 @@
#include <asm/octeon/cvmx-pcsxx-defs.h>
#include <asm/octeon/cvmx-ciu-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-helper.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-helper.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-helper.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -79,7 +79,7 @@
#include <asm/octeon/cvmx-helper-errata.h>
#include <asm/octeon/cvmx-helper-cfg.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#endif
#include "cvmx.h"
@@ -88,7 +88,7 @@
#include "cvmx-version.h"
#include "cvmx-helper-check-defines.h"
#include "cvmx-gmx.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-error.h"
#include "cvmx-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-ilk.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-ilk.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-ilk.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -57,7 +57,7 @@
#include <asm/octeon/cvmx-helper-ilk.h>
#else
#include "cvmx.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#endif
#include "cvmx-sysinfo.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-ipd.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-ipd.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-ipd.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -67,7 +67,7 @@
#include <asm/octeon/cvmx-helper-errata.h>
#include <asm/octeon/cvmx-helper-cfg.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#endif
#include "cvmx.h"
@@ -75,7 +75,7 @@
#include "cvmx-bootmem.h"
#include "cvmx-version.h"
#include "cvmx-helper-check-defines.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-error.h"
#include "cvmx-config.h"
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx-l2c.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-l2c.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-l2c.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -53,7 +53,7 @@
#include <asm/octeon/cvmx-l2c.h>
#include <asm/octeon/cvmx-spinlock.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#endif
#include "cvmx.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-malloc/malloc.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-malloc/malloc.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-malloc/malloc.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -558,7 +558,7 @@
#ifdef LACKS_UNISTD_H
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+#if !defined(__MidnightBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#if __STD_C
extern Void_t* sbrk(ptrdiff_t);
#else
Modified: trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -577,7 +577,7 @@
}
-#if defined(__FreeBSD__)
+#if defined(__MidnightBSD__)
/**
* Send a packet out the management port. The packet is copied so
* the input mbuf isn't used after this call.
Modified: trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-mgmt-port.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -135,7 +135,7 @@
*/
extern cvmx_mgmt_port_result_t cvmx_mgmt_port_send(int port, int packet_len, void *buffer);
-#if defined(__FreeBSD__)
+#if defined(__MidnightBSD__)
/**
* Send a packet out the management port. The packet is copied so
* the input mbuf isn't used after this call.
Modified: trunk/sys/contrib/octeon-sdk/cvmx-pko.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-pko.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-pko.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -53,12 +53,12 @@
#include <asm/octeon/cvmx-helper-cfg.h>
#include <asm/octeon/cvmx-clock.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#endif
#include "cvmx.h"
#include "cvmx-sysinfo.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#endif
#include "cvmx-pko.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-platform.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-platform.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-platform.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -106,7 +106,7 @@
/* To build the simple exec toolchain runtime (newlib) library. We
should only use features available on all Octeon models. */
#define CVMX_BUILD_FOR_TOOLCHAIN
-#elif defined(__FreeBSD__) && defined(_KERNEL)
+#elif defined(__MidnightBSD__) && defined(_KERNEL)
#define CVMX_BUILD_FOR_FREEBSD_KERNEL
#else
/* We are building a simple exec standalone image for Octeon */
Modified: trunk/sys/contrib/octeon-sdk/cvmx-pow.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-pow.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-pow.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -81,7 +81,7 @@
extern "C" {
#endif
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__MidnightBSD__) && defined(_KERNEL)
/*
* For the FreeBSD kernel, have POW consistency checks depend on
* the setting of INVARIANTS.
Modified: trunk/sys/contrib/octeon-sdk/cvmx-qlm-tables.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-qlm-tables.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-qlm-tables.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -3,7 +3,7 @@
#include <asm/octeon/cvmx.h>
#include <asm/octeon/cvmx-qlm.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include <cvmx.h>
#include <cvmx-qlm.h>
#else
Modified: trunk/sys/contrib/octeon-sdk/cvmx-qlm.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-qlm.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-qlm.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -56,7 +56,7 @@
#include <asm/octeon/cvmx-sriomaintx-defs.h>
#include <asm/octeon/cvmx-pciercx-defs.h>
#else
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "executive-config.h"
#include "cvmx-config.h"
#include "cvmx.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-spi.c
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-spi.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-spi.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -63,7 +63,7 @@
#include <asm/octeon/cvmx-clock.h>
#else
#include "cvmx.h"
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include "cvmx-config.h"
#endif
#include "cvmx-sysinfo.h"
Modified: trunk/sys/contrib/octeon-sdk/cvmx-utils.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx-utils.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx-utils.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -48,7 +48,7 @@
#ifndef __CVMX_UTILS_H__
#define __CVMX_UTILS_H__
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#include <stdarg.h>
#endif
Modified: trunk/sys/contrib/octeon-sdk/cvmx.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/cvmx.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/cvmx.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -58,13 +58,13 @@
** The FreeBSD kernel ifdefs elsewhere should mean that this is never even checked,
** and so does not need to be defined.
*/
-#if !defined(__FreeBSD__) || !defined(_KERNEL)
+#if !defined(__MidnightBSD__) || !defined(_KERNEL)
#ifndef CVMX_USE_1_TO_1_TLB_MAPPINGS
#define CVMX_USE_1_TO_1_TLB_MAPPINGS 1
#endif
#endif
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__MidnightBSD__) && defined(_KERNEL)
#ifndef CVMX_ENABLE_PARAMETER_CHECKING
#ifdef INVARIANTS
#define CVMX_ENABLE_PARAMETER_CHECKING 1
Modified: trunk/sys/contrib/octeon-sdk/octeon-feature.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/octeon-feature.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/octeon-feature.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -282,7 +282,7 @@
#if defined(__U_BOOT__) || defined(CVMX_BUILD_FOR_LINUX_HOST) || defined(CVMX_BUILD_FOR_TOOLCHAIN)
#define octeon_has_feature old_octeon_has_feature
#else
-#if defined(USE_RUNTIME_MODEL_CHECKS) || (defined(__FreeBSD__) && defined(_KERNEL))
+#if defined(USE_RUNTIME_MODEL_CHECKS) || (defined(__MidnightBSD__) && defined(_KERNEL))
static inline int octeon_has_feature(octeon_feature_t feature)
{
int byte, bit;
Modified: trunk/sys/contrib/octeon-sdk/octeon-model.h
===================================================================
--- trunk/sys/contrib/octeon-sdk/octeon-model.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/octeon-sdk/octeon-model.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -318,7 +318,7 @@
)))
#ifndef OCTEON_IS_MODEL
-#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__FreeBSD__) && defined(_KERNEL) && !defined(OCTEON_MODEL))
+#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__MidnightBSD__) && defined(_KERNEL) && !defined(OCTEON_MODEL))
/* NOTE: This for internal use only!!!!! */
static inline int __octeon_is_model_runtime__(uint32_t model)
@@ -371,7 +371,7 @@
*/
static inline uint32_t cvmx_get_octeon_family(void)
{
-#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__FreeBSD__) && defined(_KERNEL))
+#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__MidnightBSD__) && defined(_KERNEL))
return (cvmx_get_proc_id() & OCTEON_FAMILY_MASK);
#else
return (OCTEON_MODEL & OCTEON_FAMILY_MASK);
Modified: trunk/sys/contrib/pf/net/if_pflog.c
===================================================================
--- trunk/sys/contrib/pf/net/if_pflog.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/if_pflog.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -33,7 +33,7 @@
* PURPOSE.
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_bpf.h"
@@ -54,10 +54,10 @@
#define NPFLOG 0
#endif
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
#include "bpfilter.h"
#include "pflog.h"
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,7 +64,7 @@
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/socket.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/malloc.h>
@@ -75,7 +75,7 @@
#endif
#include <net/if.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/if_clone.h>
#endif
#include <net/if_types.h>
@@ -99,11 +99,11 @@
#include <net/pfvar.h>
#include <net/if_pflog.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef INET
#include <machine/in_cksum.h>
#endif /* INET */
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#define PFLOGMTU (32768 + MHLEN + MLEN)
@@ -115,7 +115,7 @@
void pflogattach(int);
int pflogoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct route *);
#else
struct rtentry *);
@@ -122,7 +122,7 @@
#endif
int pflogioctl(struct ifnet *, u_long, caddr_t);
void pflogstart(struct ifnet *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static int pflog_clone_create(struct if_clone *, int, caddr_t);
static void pflog_clone_destroy(struct ifnet *);
#else
@@ -131,7 +131,7 @@
#endif
LIST_HEAD(, pflog_softc) pflogif_list;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
IFC_SIMPLE_DECLARE(pflog, 1);
#else
struct if_clone pflog_cloner =
@@ -150,7 +150,7 @@
if_clone_attach(&pflog_cloner);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static int
pflog_clone_create(struct if_clone *ifc, int unit, caddr_t param)
#else
@@ -170,7 +170,7 @@
return (ENOMEM);
pflogif->sc_unit = unit;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ifp = pflogif->sc_ifp = if_alloc(IFT_PFLOG);
if (ifp == NULL) {
free(pflogif, M_DEVBUF);
@@ -186,18 +186,18 @@
ifp->if_ioctl = pflogioctl;
ifp->if_output = pflogoutput;
ifp->if_start = pflogstart;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
ifp->if_type = IFT_PFLOG;
#endif
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_hdrlen = PFLOG_HDRLEN;
if_attach(ifp);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if_alloc_sadl(ifp);
#endif
#if NBPFILTER > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bpfattach(ifp, DLT_PFLOG, PFLOG_HDRLEN);
#else
bpfattach(&pflogif->sc_if.if_bpf, ifp, DLT_PFLOG, PFLOG_HDRLEN);
@@ -205,13 +205,13 @@
#endif
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX: Why pf(4) lock?! Better add a pflog lock?! */
PF_LOCK();
#endif
LIST_INSERT_HEAD(&pflogif_list, pflogif, sc_list);
pflogifs[unit] = ifp;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -219,7 +219,7 @@
return (0);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static void
pflog_clone_destroy(struct ifnet *ifp)
#else
@@ -231,12 +231,12 @@
int s;
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
pflogifs[pflogif->sc_unit] = NULL;
LIST_REMOVE(pflogif, sc_list);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -245,11 +245,11 @@
bpfdetach(ifp);
#endif
if_detach(ifp);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if_free(ifp);
#endif
free(pflogif, M_DEVBUF);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
return (0);
#endif
}
@@ -261,12 +261,12 @@
pflogstart(struct ifnet *ifp)
{
struct mbuf *m;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
int s;
#endif
for (;;) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
IF_LOCK(&ifp->if_snd);
_IF_DROP(&ifp->if_snd);
_IF_DEQUEUE(&ifp->if_snd, m);
@@ -287,7 +287,7 @@
int
pflogoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct route *rt)
#else
struct rtentry *rt)
@@ -303,7 +303,7 @@
{
switch (cmd) {
case SIOCSIFFLAGS:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (ifp->if_flags & IFF_UP)
ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
@@ -355,7 +355,7 @@
sizeof(hdr.ruleset));
}
if (rm->log & PF_LOG_SOCKET_LOOKUP && !pd->lookup.done)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* XXX: This should not happen as we force an early lookup
* via debug.pfugidhack
@@ -387,7 +387,7 @@
ifn->if_opackets++;
ifn->if_obytes += m->m_pkthdr.len;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
BPF_MTAP2(ifn, &hdr, PFLOG_HDRLEN, m);
#else
bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, PFLOG_HDRLEN, m,
@@ -398,7 +398,7 @@
return (0);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static int
pflog_modevent(module_t mod, int type, void *data)
{
@@ -432,4 +432,4 @@
DECLARE_MODULE(pflog, pflog_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
MODULE_VERSION(pflog, PFLOG_MODVER);
MODULE_DEPEND(pflog, pf, PF_MODVER, PF_MODVER, PF_MODVER);
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
Modified: trunk/sys/contrib/pf/net/if_pflog.h
===================================================================
--- trunk/sys/contrib/pf/net/if_pflog.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/if_pflog.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -31,7 +31,7 @@
#define PFLOGIFS_MAX 16
struct pflog_softc {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ifnet *sc_ifp; /* the interface pointer */
#else
struct ifnet sc_if; /* the interface */
@@ -75,7 +75,7 @@
#define OLD_PFLOG_HDRLEN sizeof(struct old_pfloghdr)
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_rule;
struct pf_ruleset;
struct pfi_kif;
@@ -91,7 +91,7 @@
if (pflog_packet_ptr != NULL) \
pflog_packet_ptr(i,a,b,c,d,e,f,g,h); \
} while (0)
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
#if NPFLOG > 0
#define PFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) pflog_packet(i,a,b,c,d,e,f,g,h)
#else
Modified: trunk/sys/contrib/pf/net/if_pflow.h
===================================================================
--- trunk/sys/contrib/pf/net/if_pflow.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/if_pflow.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -66,7 +66,7 @@
unsigned int sc_maxcount;
u_int64_t sc_gcounter;
struct ip_moptions sc_imo;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct callout sc_tmo;
#else
struct timeout sc_tmo;
Modified: trunk/sys/contrib/pf/net/if_pfsync.c
===================================================================
--- trunk/sys/contrib/pf/net/if_pfsync.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/if_pfsync.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -52,7 +52,7 @@
* 1.170 - SIOCSIFMTU checks
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_pf.h"
@@ -67,11 +67,11 @@
#else
#define NCARP 0
#endif
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#include <sys/param.h>
#include <sys/kernel.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/priv.h>
@@ -81,7 +81,7 @@
#include <sys/time.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/endian.h>
#include <sys/malloc.h>
#include <sys/module.h>
@@ -95,12 +95,12 @@
#include <sys/timeout.h>
#endif
#include <sys/sysctl.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/pool.h>
#endif
#include <net/if.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/if_clone.h>
#endif
#include <net/if_types.h>
@@ -107,7 +107,7 @@
#include <net/route.h>
#include <net/bpf.h>
#include <net/netisr.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/vnet.h>
#endif
@@ -127,7 +127,7 @@
#include <netinet6/nd6.h>
#endif /* INET6 */
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include "carp.h"
#endif
#if NCARP > 0
@@ -137,7 +137,7 @@
#include <net/pfvar.h>
#include <net/if_pfsync.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include "bpfilter.h"
#include "pfsync.h"
#endif
@@ -222,7 +222,7 @@
TAILQ_ENTRY(pfsync_deferral) pd_entry;
struct pf_state *pd_st;
struct mbuf *pd_m;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct callout pd_tmo;
#else
struct timeout pd_tmo;
@@ -238,7 +238,7 @@
#endif
struct pfsync_softc {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ifnet *sc_ifp;
#else
struct ifnet sc_if;
@@ -245,7 +245,7 @@
#endif
struct ifnet *sc_sync_if;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
uma_zone_t sc_pool;
#else
struct pool sc_pool;
@@ -255,7 +255,7 @@
struct in_addr sc_sync_peer;
u_int8_t sc_maxupdates;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pfsync_sync_ok;
#endif
@@ -274,7 +274,7 @@
u_int32_t sc_ureq_sent;
int sc_bulk_tries;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct callout sc_bulkfail_tmo;
#else
struct timeout sc_bulkfail_tmo;
@@ -283,7 +283,7 @@
u_int32_t sc_ureq_received;
struct pf_state *sc_bulk_next;
struct pf_state *sc_bulk_last;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct callout sc_bulk_tmo;
#else
struct timeout sc_bulk_tmo;
@@ -291,7 +291,7 @@
TAILQ_HEAD(, tdb) sc_tdb_q;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct callout sc_tmo;
#else
struct timeout sc_tmo;
@@ -298,7 +298,7 @@
#endif
};
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync data");
static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL;
#define V_pfsyncif VNET(pfsyncif)
@@ -327,7 +327,7 @@
#endif
void pfsyncattach(int);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pfsync_clone_create(struct if_clone *, int, caddr_t);
void pfsync_clone_destroy(struct ifnet *);
#else
@@ -338,7 +338,7 @@
struct pf_state_peer *);
void pfsync_update_net_tdb(struct pfsync_tdb *);
int pfsyncoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct route *);
#else
struct rtentry *);
@@ -366,7 +366,7 @@
void pfsync_bulk_update(void *);
void pfsync_bulk_fail(void *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX: ugly */
#define betoh64 (unsigned long long)be64toh
#define timeout_del callout_stop
@@ -373,11 +373,11 @@
#endif
#define PFSYNC_MAX_BULKTRIES 12
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
int pfsync_sync_ok;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(struct ifc_simple_data, pfsync_cloner_data);
VNET_DEFINE(struct if_clone, pfsync_cloner);
#define V_pfsync_cloner_data VNET(pfsync_cloner_data)
@@ -394,7 +394,7 @@
if_clone_attach(&pfsync_cloner);
}
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfsync_clone_create(struct if_clone *ifc, int unit, caddr_t param)
#else
pfsync_clone_create(struct if_clone *ifc, int unit)
@@ -407,7 +407,7 @@
if (unit != 0)
return (EINVAL);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | M_ZERO);
sc->pfsync_sync_ok = 1;
#else
@@ -418,7 +418,7 @@
for (q = 0; q < PFSYNC_S_COUNT; q++)
TAILQ_INIT(&sc->sc_qs[q]);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, NULL, NULL, NULL,
NULL, UMA_ALIGN_PTR, 0);
#else
@@ -433,7 +433,7 @@
sc->sc_len = PFSYNC_MINPKT;
sc->sc_maxupdates = 128;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
sc->sc_imo.imo_membership = (struct in_multi **)malloc(
(sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS,
M_WAITOK | M_ZERO);
@@ -440,7 +440,7 @@
sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ifp = sc->sc_ifp = if_alloc(IFT_PFSYNC);
if (ifp == NULL) {
uma_zdestroy(sc->sc_pool);
@@ -460,7 +460,7 @@
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_hdrlen = sizeof(struct pfsync_header);
ifp->if_mtu = ETHERMTU;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_init(&sc->sc_tmo, CALLOUT_MPSAFE);
callout_init_mtx(&sc->sc_bulk_tmo, &pf_task_mtx, 0);
callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE);
@@ -471,7 +471,7 @@
#endif
if_attach(ifp);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if_alloc_sadl(ifp);
#endif
@@ -480,7 +480,7 @@
#endif
#if NBPFILTER > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bpfattach(ifp, DLT_PFSYNC, PFSYNC_HDRLEN);
#else
bpfattach(&sc->sc_if.if_bpf, ifp, DLT_PFSYNC, PFSYNC_HDRLEN);
@@ -487,7 +487,7 @@
#endif
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfsyncif = sc;
#else
pfsyncif = sc;
@@ -496,7 +496,7 @@
return (0);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void
#else
int
@@ -505,18 +505,18 @@
{
struct pfsync_softc *sc = ifp->if_softc;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
timeout_del(&sc->sc_bulkfail_tmo);
timeout_del(&sc->sc_bulk_tmo);
timeout_del(&sc->sc_tmo);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sc->pfsync_sync_ok)
#else
if (!pfsync_sync_ok)
@@ -534,12 +534,12 @@
while (sc->sc_deferred > 0)
pfsync_undefer(TAILQ_FIRST(&sc->sc_deferrals), 0);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
UMA_DESTROY(sc->sc_pool);
#else
pool_destroy(&sc->sc_pool);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if_free(ifp);
if (sc->sc_imo.imo_membership)
pfsync_multicast_cleanup(sc);
@@ -549,13 +549,13 @@
free(sc, M_DEVBUF);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfsyncif = NULL;
#else
pfsyncif = NULL;
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
return (0);
#endif
}
@@ -564,11 +564,11 @@
pfsync_if_dequeue(struct ifnet *ifp)
{
struct mbuf *m;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
int s;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
IF_LOCK(&ifp->if_snd);
_IF_DROP(&ifp->if_snd);
_IF_DEQUEUE(&ifp->if_snd, m);
@@ -591,7 +591,7 @@
struct mbuf *m;
while ((m = pfsync_if_dequeue(ifp)) != NULL) {
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
IF_DROP(&ifp->if_snd);
#endif
m_freem(m);
@@ -603,7 +603,7 @@
struct pf_state_peer *d)
{
if (s->scrub.scrub_flag && d->scrub == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
d->scrub = pool_get(&V_pf_state_scrub_pl, PR_NOWAIT | PR_ZERO);
#else
d->scrub = pool_get(&pf_state_scrub_pl, PR_NOWAIT | PR_ZERO);
@@ -615,7 +615,7 @@
return (0);
}
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
void
pfsync_state_export(struct pfsync_state *sp, struct pf_state *st)
{
@@ -688,7 +688,7 @@
int pool_flags;
int error;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
if (sp->creatorid == 0 && V_pf_status.debug >= PF_DEBUG_MISC) {
@@ -701,7 +701,7 @@
}
if ((kif = pfi_kif_get(sp->ifname)) == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -723,7 +723,7 @@
r = pf_main_ruleset.rules[
PF_RULESET_FILTER].active.ptr_array[ntohl(sp->rule)];
else
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
r = &V_pf_default_rule;
#else
r = &pf_default_rule;
@@ -732,7 +732,7 @@
if ((r->max_states && r->states_cur >= r->max_states))
goto cleanup;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (flags & PFSYNC_SI_IOCTL)
pool_flags = PR_WAITOK | PR_ZERO;
else
@@ -841,7 +841,7 @@
error = ENOMEM;
if (skw == sks)
sks = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (skw != NULL)
pool_put(&V_pf_state_key_pl, skw);
if (sks != NULL)
@@ -855,7 +855,7 @@
cleanup_state: /* pf_state_insert frees the state keys */
if (st) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (st->dst.scrub)
pool_put(&V_pf_state_scrub_pl, st->dst.scrub);
if (st->src.scrub)
@@ -873,13 +873,13 @@
}
void
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfsync_input(struct mbuf *m, __unused int off)
#else
pfsync_input(struct mbuf *m, ...)
#endif
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -895,7 +895,7 @@
V_pfsyncstats.pfsyncs_ipackets++;
/* verify that we have a sync interface configured */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sc || !sc->sc_sync_if || !V_pf_status.running)
#else
if (!sc || !sc->sc_sync_if || !pf_status.running)
@@ -908,7 +908,7 @@
goto done;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_ifp->if_ipackets++;
sc->sc_ifp->if_ibytes += m->m_pkthdr.len;
#else
@@ -954,7 +954,7 @@
pkt.src = ip->ip_src;
pkt.flags = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!bcmp(&ph->pfcksum, &V_pf_status.pf_chksum, PF_MD5_DIGEST_LENGTH))
#else
if (!bcmp(&ph->pfcksum, &pf_status.pf_chksum, PF_MD5_DIGEST_LENGTH))
@@ -1005,7 +1005,7 @@
clr = (struct pfsync_clr *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1012,7 +1012,7 @@
creatorid = clr[i].creatorid;
if (clr[i].ifname[0] == '\0') {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
for (st = RB_MIN(pf_state_tree_id, &V_tree_id);
st; st = nexts) {
nexts = RB_NEXT(pf_state_tree_id, &V_tree_id, st);
@@ -1031,7 +1031,7 @@
continue;
/* XXX correct? */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
for (sk = RB_MIN(pf_state_tree, &V_pf_statetbl);
#else
for (sk = RB_MIN(pf_state_tree, &pf_statetbl);
@@ -1038,7 +1038,7 @@
#endif
sk; sk = nextsk) {
nextsk = RB_NEXT(pf_state_tree,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
&V_pf_statetbl, sk);
#else
&pf_statetbl, sk);
@@ -1053,7 +1053,7 @@
}
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1079,7 +1079,7 @@
sa = (struct pfsync_state *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1091,7 +1091,7 @@
sp->dst.state > PF_TCPS_PROXY_DST ||
sp->direction > PF_OUT ||
(sp->af != AF_INET && sp->af != AF_INET6)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1108,7 +1108,7 @@
break;
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1136,7 +1136,7 @@
iaa = (struct pfsync_ins_ack *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1152,7 +1152,7 @@
if (ISSET(st->state_flags, PFSTATE_ACK))
pfsync_deferred(st, 0);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1220,7 +1220,7 @@
sa = (struct pfsync_state *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1230,7 +1230,7 @@
if (sp->timeout >= PFTM_MAX ||
sp->src.state > PF_TCPS_PROXY_DST ||
sp->dst.state > PF_TCPS_PROXY_DST) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1272,7 +1272,7 @@
}
if (sfail) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1296,7 +1296,7 @@
st->timeout = sp->timeout;
st->pfsync_time = time_uptime;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1327,7 +1327,7 @@
ua = (struct pfsync_upd_c *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1337,7 +1337,7 @@
if (up->timeout >= PFTM_MAX ||
up->src.state > PF_TCPS_PROXY_DST ||
up->dst.state > PF_TCPS_PROXY_DST) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1378,7 +1378,7 @@
}
if (sfail) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1402,7 +1402,7 @@
st->timeout = up->timeout;
st->pfsync_time = time_uptime;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1428,7 +1428,7 @@
}
ura = (struct pfsync_upd_req *)(mp->m_data + offp);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1451,7 +1451,7 @@
pfsync_update_state_req(st);
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
@@ -1477,7 +1477,7 @@
sa = (struct pfsync_state *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1494,7 +1494,7 @@
SET(st->state_flags, PFSTATE_NOSYNC);
pf_unlink_state(st);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1521,7 +1521,7 @@
sa = (struct pfsync_del_c *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1539,7 +1539,7 @@
SET(st->state_flags, PFSTATE_NOSYNC);
pf_unlink_state(st);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1550,7 +1550,7 @@
int
pfsync_in_bus(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1573,7 +1573,7 @@
switch (bus->status) {
case PFSYNC_BUS_START:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_bulkfail_tmo, 4 * hz +
V_pf_pool_limits[PF_LIMIT_STATES].limit /
((sc->sc_ifp->if_mtu - PFSYNC_MINPKT) /
@@ -1585,7 +1585,7 @@
((sc->sc_if.if_mtu - PFSYNC_MINPKT) /
sizeof(struct pfsync_state)));
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1602,7 +1602,7 @@
timeout_del(&sc->sc_bulkfail_tmo);
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sc->pfsync_sync_ok)
#else
if (!pfsync_sync_ok)
@@ -1610,12 +1610,12 @@
carp_group_demote_adj(&sc->sc_if, -1);
#endif
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->pfsync_sync_ok = 1;
#else
pfsync_sync_ok = 1;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1623,7 +1623,7 @@
printf("pfsync: received valid "
"bulk update end\n");
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1657,12 +1657,12 @@
tp = (struct pfsync_tdb *)(mp->m_data + offp);
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < count; i++)
pfsync_update_net_tdb(&tp[i]);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1705,7 +1705,7 @@
return;
bad:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1741,7 +1741,7 @@
int
pfsyncoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct route *rt)
#else
struct rtentry *rt)
@@ -1755,7 +1755,7 @@
int
pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
struct proc *p = curproc;
#endif
struct pfsync_softc *sc = ifp->if_softc;
@@ -1773,7 +1773,7 @@
case SIOCSIFDSTADDR:
#endif
case SIOCSIFFLAGS:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (ifp->if_flags & IFF_UP)
ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
@@ -1792,11 +1792,11 @@
return (EINVAL);
if (ifr->ifr_mtu < ifp->if_mtu) {
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
pfsync_sendout();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -1814,7 +1814,7 @@
return (copyout(&pfsyncr, ifr->ifr_data, sizeof(pfsyncr)));
case SIOCSETPFSYNC:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((error = priv_check(curthread, PRIV_NETINET_PF)) != 0)
#else
if ((error = suser(p, p->p_acflag)) != 0)
@@ -1823,11 +1823,11 @@
if ((error = copyin(ifr->ifr_data, &pfsyncr, sizeof(pfsyncr))))
return (error);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
if (pfsyncr.pfsyncr_syncpeer.s_addr == 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_sync_peer.s_addr = htonl(INADDR_PFSYNC_GROUP);
#else
sc->sc_sync_peer.s_addr = INADDR_PFSYNC_GROUP;
@@ -1837,12 +1837,12 @@
pfsyncr.pfsyncr_syncpeer.s_addr;
if (pfsyncr.pfsyncr_maxupdates > 255)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
PF_UNLOCK();
#endif
return (EINVAL);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
}
#endif
sc->sc_maxupdates = pfsyncr.pfsyncr_maxupdates;
@@ -1849,7 +1849,7 @@
if (pfsyncr.pfsyncr_syncdev[0] == 0) {
sc->sc_sync_if = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
if (imo->imo_membership)
pfsync_multicast_cleanup(sc);
@@ -1863,17 +1863,17 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
if ((sifp = ifunit(pfsyncr.pfsyncr_syncdev)) == NULL)
return (EINVAL);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sifp->if_mtu < sc->sc_ifp->if_mtu ||
#else
if (sifp->if_mtu < sc->sc_if.if_mtu ||
@@ -1884,7 +1884,7 @@
pfsync_sendout();
sc->sc_sync_if = sifp;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (imo->imo_membership) {
PF_UNLOCK();
pfsync_multicast_cleanup(sc);
@@ -1897,7 +1897,7 @@
}
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sc->sc_sync_if &&
sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) {
PF_UNLOCK();
@@ -1930,7 +1930,7 @@
imo->imo_multicast_ttl = PFSYNC_DFLTTL;
imo->imo_multicast_loop = 0;
}
-#endif /* !__FreeBSD__ */
+#endif /* !__MidnightBSD__ */
ip = &sc->sc_template;
bzero(ip, sizeof(*ip));
@@ -1938,7 +1938,7 @@
ip->ip_hl = sizeof(sc->sc_template) >> 2;
ip->ip_tos = IPTOS_LOWDELAY;
/* len and id are set later */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ip->ip_off = IP_DF;
#else
ip->ip_off = htons(IP_DF);
@@ -1953,7 +1953,7 @@
sc->sc_ureq_sent = time_uptime;
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sc->pfsync_sync_ok)
#else
if (pfsync_sync_ok)
@@ -1961,18 +1961,18 @@
carp_group_demote_adj(&sc->sc_if, 1);
#endif
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->pfsync_sync_ok = 0;
#else
pfsync_sync_ok = 0;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
#endif
printf("pfsync: requesting bulk update\n");
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_bulkfail_tmo, 5 * hz,
pfsync_bulk_fail, V_pfsyncif);
#else
@@ -1980,7 +1980,7 @@
#endif
pfsync_request_update(0, 0);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
@@ -2066,7 +2066,7 @@
TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) {
#ifdef PFSYNC_DEBUG
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(st->sync_state == q,
("%s: st->sync_state == q",
__FUNCTION__));
@@ -2098,7 +2098,7 @@
sc->sc_len = PFSYNC_MINPKT;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void pfsync_sendout()
{
pfsync_sendout1(1);
@@ -2115,7 +2115,7 @@
struct pfsync_softc *sc = pfsyncif;
#endif
#if NBPFILTER > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ifnet *ifp = sc->sc_ifp;
#else
struct ifnet *ifp = &sc->sc_if;
@@ -2130,13 +2130,13 @@
#ifdef notyet
struct tdb *t;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
size_t pktlen;
#endif
int offset;
int q, count = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_NET);
@@ -2156,7 +2156,7 @@
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_ifp->if_oerrors++;
#else
sc->sc_if.if_oerrors++;
@@ -2166,7 +2166,7 @@
return;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pktlen = max_linkhdr + sc->sc_len;
if (pktlen > MHLEN) {
/* Find the right pool to allocate from. */
@@ -2182,7 +2182,7 @@
#endif
if (!ISSET(m->m_flags, M_EXT)) {
m_free(m);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_ifp->if_oerrors++;
#else
sc->sc_if.if_oerrors++;
@@ -2200,7 +2200,7 @@
bcopy(&sc->sc_template, ip, sizeof(*ip));
offset = sizeof(*ip);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ip->ip_len = m->m_pkthdr.len;
#else
ip->ip_len = htons(m->m_pkthdr.len);
@@ -2214,7 +2214,7 @@
ph->version = PFSYNC_VERSION;
ph->len = htons(sc->sc_len - sizeof(*ip));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bcopy(V_pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH);
#else
bcopy(pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH);
@@ -2231,7 +2231,7 @@
count = 0;
TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) {
#ifdef PFSYNC_DEBUG
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(st->sync_state == q,
("%s: st->sync_state == q",
__FUNCTION__));
@@ -2315,7 +2315,7 @@
if (ifp->if_bpf) {
m->m_data += sizeof(*ip);
m->m_len = m->m_pkthdr.len = sc->sc_len - sizeof(*ip);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
BPF_MTAP(ifp, m);
#else
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
@@ -2331,7 +2331,7 @@
}
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_ifp->if_opackets++;
sc->sc_ifp->if_obytes += m->m_pkthdr.len;
sc->sc_len = PFSYNC_MINPKT;
@@ -2361,13 +2361,13 @@
void
pfsync_insert_state(struct pf_state *st)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -2383,7 +2383,7 @@
return;
#ifdef PFSYNC_DEBUG
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(st->sync_state == PFSYNC_S_NONE,
("%s: st->sync_state == PFSYNC_S_NONE", __FUNCTION__));
#else
@@ -2392,7 +2392,7 @@
#endif
if (sc->sc_len == PFSYNC_MINPKT)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout,
V_pfsyncif);
#else
@@ -2412,7 +2412,7 @@
int
pfsync_defer(struct pf_state *st, struct mbuf *m)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2419,7 +2419,7 @@
#endif
struct pfsync_deferral *pd;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -2433,7 +2433,7 @@
return (0);
sc->sc_deferred++;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m->m_flags |= M_SKIP_FIREWALL;
#else
m->m_pkthdr.pf.flags |= PF_TAG_GENERATED;
@@ -2444,7 +2444,7 @@
pd->pd_m = m;
TAILQ_INSERT_TAIL(&sc->sc_deferrals, pd, pd_entry);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_init(&pd->pd_tmo, CALLOUT_MPSAFE);
callout_reset(&pd->pd_tmo, defer, pfsync_defer_tmo,
pd);
@@ -2459,7 +2459,7 @@
void
pfsync_undefer(struct pfsync_deferral *pd, int drop)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2466,7 +2466,7 @@
#endif
int s;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -2481,13 +2481,13 @@
m_freem(pd->pd_m);
else {
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX: use pf_defered?! */
PF_UNLOCK();
#endif
ip_output(pd->pd_m, (void *)NULL, (void *)NULL, 0,
(void *)NULL, (void *)NULL);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
splx(s);
@@ -2499,18 +2499,18 @@
void
pfsync_defer_tmo(void *arg)
{
-#if defined(__FreeBSD__) && defined(VIMAGE)
+#if defined(__MidnightBSD__) && defined(VIMAGE)
struct pfsync_deferral *pd = arg;
#endif
int s;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_SET(pd->pd_m->m_pkthdr.rcvif->if_vnet); /* XXX */
PF_LOCK();
#endif
pfsync_undefer(arg, 0);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
CURVNET_RESTORE();
#endif
@@ -2520,7 +2520,7 @@
void
pfsync_deferred(struct pf_state *st, int drop)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2542,7 +2542,7 @@
void
pfsync_update_state(struct pf_state *st)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2549,7 +2549,7 @@
#endif
int sync = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -2567,7 +2567,7 @@
}
if (sc->sc_len == PFSYNC_MINPKT)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout,
V_pfsyncif);
#else
@@ -2608,7 +2608,7 @@
void
pfsync_request_update(u_int32_t creatorid, u_int64_t id)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2636,7 +2636,7 @@
if (TAILQ_EMPTY(&sc->sc_upd_req_list))
nlen += sizeof(struct pfsync_subheader);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) {
#else
if (sc->sc_len + nlen > sc->sc_if.if_mtu) {
@@ -2658,7 +2658,7 @@
void
pfsync_update_state_req(struct pf_state *st)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2699,13 +2699,13 @@
void
pfsync_delete_state(struct pf_state *st)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -2723,7 +2723,7 @@
}
if (sc->sc_len == PFSYNC_MINPKT)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout,
V_pfsyncif);
#else
@@ -2760,13 +2760,13 @@
struct pfsync_clr clr;
} __packed r;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -2789,7 +2789,7 @@
void
pfsync_q_ins(struct pf_state *st, int q)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2799,7 +2799,7 @@
PF_LOCK_ASSERT();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(st->sync_state == PFSYNC_S_NONE,
("%s: st->sync_state == PFSYNC_S_NONE", __FUNCTION__));
#else
@@ -2808,7 +2808,7 @@
#if 1 || defined(PFSYNC_DEBUG)
if (sc->sc_len < PFSYNC_MINPKT)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
panic("pfsync pkt len is too low %zu", sc->sc_len);
#else
panic("pfsync pkt len is too low %d", sc->sc_len);
@@ -2817,7 +2817,7 @@
if (TAILQ_EMPTY(&sc->sc_qs[q]))
nlen += sizeof(struct pfsync_subheader);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) {
#else
if (sc->sc_len + nlen > sc->sc_if.if_mtu) {
@@ -2837,7 +2837,7 @@
void
pfsync_q_del(struct pf_state *st)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2844,7 +2844,7 @@
#endif
int q = st->sync_state;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(st->sync_state != PFSYNC_S_NONE,
("%s: st->sync_state != PFSYNC_S_NONE", __FUNCTION__));
#else
@@ -2863,7 +2863,7 @@
void
pfsync_update_tdb(struct tdb *t, int output)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2907,7 +2907,7 @@
void
pfsync_delete_tdb(struct tdb *t)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2962,13 +2962,13 @@
void
pfsync_bulk_start(void)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -2975,7 +2975,7 @@
#endif
printf("pfsync: received bulk update request\n");
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
if (TAILQ_EMPTY(&V_state_list))
#else
@@ -2985,7 +2985,7 @@
else {
sc->sc_ureq_received = time_uptime;
if (sc->sc_bulk_next == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->sc_bulk_next = TAILQ_FIRST(&V_state_list);
#else
sc->sc_bulk_next = TAILQ_FIRST(&state_list);
@@ -3008,7 +3008,7 @@
PF_LOCK_ASSERT();
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_SET(sc->sc_ifp->if_vnet);
#endif
for (;;) {
@@ -3021,7 +3021,7 @@
st = TAILQ_NEXT(st, entry_list);
if (st == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
st = TAILQ_FIRST(&V_state_list);
#else
st = TAILQ_FIRST(&state_list);
@@ -3035,7 +3035,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (i > 1 && (sc->sc_ifp->if_mtu - sc->sc_len) <
#else
if (i > 1 && (sc->sc_if.if_mtu - sc->sc_len) <
@@ -3043,7 +3043,7 @@
sizeof(struct pfsync_state)) {
/* we've filled a packet */
sc->sc_bulk_next = st;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_bulk_tmo, 1,
pfsync_bulk_update, sc);
#else
@@ -3053,7 +3053,7 @@
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_RESTORE();
#endif
splx(s);
@@ -3067,7 +3067,7 @@
struct pfsync_bus bus;
} __packed r;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -3080,7 +3080,7 @@
r.subh.action = PFSYNC_ACT_BUS;
r.subh.count = htons(1);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
r.bus.creatorid = V_pf_status.hostid;
#else
r.bus.creatorid = pf_status.hostid;
@@ -3096,13 +3096,13 @@
{
struct pfsync_softc *sc = arg;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_SET(sc->sc_ifp->if_vnet);
#endif
if (sc->sc_bulk_tries++ < PFSYNC_MAX_BULKTRIES) {
/* Try again */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
callout_reset(&sc->sc_bulkfail_tmo, 5 * hz,
pfsync_bulk_fail, V_pfsyncif);
#else
@@ -3117,7 +3117,7 @@
sc->sc_bulk_tries = 0;
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sc->pfsync_sync_ok)
#else
if (!pfsync_sync_ok)
@@ -3125,12 +3125,12 @@
carp_group_demote_adj(&sc->sc_if, -1);
#endif
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sc->pfsync_sync_ok = 1;
#else
pfsync_sync_ok = 1;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -3138,7 +3138,7 @@
printf("pfsync: failed to receive bulk update\n");
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_RESTORE();
#endif
}
@@ -3146,7 +3146,7 @@
void
pfsync_send_plus(void *plus, size_t pluslen)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -3155,7 +3155,7 @@
PF_LOCK_ASSERT();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sc->sc_len + pluslen > sc->sc_ifp->if_mtu) {
#else
if (sc->sc_len + pluslen > sc->sc_if.if_mtu) {
@@ -3176,13 +3176,13 @@
int
pfsync_up(void)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sc == NULL || !ISSET(sc->sc_ifp->if_flags, IFF_DRV_RUNNING))
#else
if (sc == NULL || !ISSET(sc->sc_if.if_flags, IFF_RUNNING))
@@ -3195,7 +3195,7 @@
int
pfsync_state_in_use(struct pf_state *st)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -3218,12 +3218,12 @@
void
pfsync_timeout(void *arg)
{
-#if defined(__FreeBSD__) && defined(VIMAGE)
+#if defined(__MidnightBSD__) && defined(VIMAGE)
struct pfsync_softc *sc = arg;
#endif
int s;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_SET(sc->sc_ifp->if_vnet);
#endif
@@ -3230,16 +3230,16 @@
pfsync_tmos++;
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
pfsync_sendout();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
splx(s);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
CURVNET_RESTORE();
#endif
}
@@ -3246,7 +3246,7 @@
/* this is a softnet/netisr handler */
void
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfsyncintr(void *arg)
{
struct pfsync_softc *sc = arg;
@@ -3307,7 +3307,7 @@
return (ENOPROTOOPT);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static int
pfsync_multicast_setup(struct pfsync_softc *sc)
{
@@ -3487,4 +3487,4 @@
DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
MODULE_VERSION(pfsync, PFSYNC_MODVER);
MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER);
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
Modified: trunk/sys/contrib/pf/net/if_pfsync.h
===================================================================
--- trunk/sys/contrib/pf/net/if_pfsync.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/if_pfsync.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -269,7 +269,7 @@
int pfsyncr_authlevel;
};
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define SIOCSETPFSYNC _IOW('i', 247, struct ifreq)
#define SIOCGETPFSYNC _IOWR('i', 248, struct ifreq)
#endif
@@ -289,7 +289,7 @@
#define PFSYNC_S_DEFER 0xfe
#define PFSYNC_S_NONE 0xff
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void pfsync_input(struct mbuf *, __unused int);
#else
void pfsync_input(struct mbuf *, ...);
@@ -301,7 +301,7 @@
#define PFSYNC_SI_CKSUM 0x02
#define PFSYNC_SI_ACK 0x04
int pfsync_state_import(struct pfsync_state *, u_int8_t);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
void pfsync_state_export(struct pfsync_state *,
struct pf_state *);
#endif
Modified: trunk/sys/contrib/pf/net/pf.c
===================================================================
--- trunk/sys/contrib/pf/net/pf.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -35,7 +35,7 @@
*
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -43,7 +43,7 @@
__MBSDID("$MidnightBSD$");
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_bpf.h"
#include "opt_pf.h"
@@ -70,7 +70,7 @@
#include <sys/socketvar.h>
#include <sys/kernel.h>
#include <sys/time.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/random.h>
#include <sys/sysctl.h>
#include <sys/endian.h>
@@ -79,7 +79,7 @@
#include <sys/pool.h>
#endif
#include <sys/proc.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/sx.h>
@@ -87,7 +87,7 @@
#include <sys/rwlock.h>
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/md5.h>
#else
#include <crypto/md5.h>
@@ -97,7 +97,7 @@
#include <net/if_types.h>
#include <net/bpf.h>
#include <net/route.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef RADIX_MPATH
#include <net/radix_mpath.h>
#endif
@@ -120,12 +120,12 @@
#include <netinet/udp_var.h>
#include <netinet/icmp_var.h>
#include <netinet/if_ether.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netinet/ip_fw.h>
#include <netpfil/ipfw/ip_fw_private.h> /* XXX: only for DIR_IN/DIR_OUT */
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <dev/rndvar.h>
#endif
#include <net/pfvar.h>
@@ -138,13 +138,13 @@
#include <netinet/in_pcb.h>
#include <netinet/icmp6.h>
#include <netinet6/nd6.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netinet6/ip6_var.h>
#include <netinet6/in6_pcb.h>
#endif
#endif /* INET6 */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <machine/in_cksum.h>
#include <sys/limits.h>
#include <sys/ucred.h>
@@ -153,7 +153,7 @@
extern int ip_optcopy(struct ip *, struct ip *);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x
#else
#define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x
@@ -164,7 +164,7 @@
*/
/* state tables */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(struct pf_state_tree, pf_statetbl);
VNET_DEFINE(struct pf_altqqueue, pf_altqs[2]);
@@ -252,7 +252,7 @@
struct pf_addr *, struct pf_addr *, u_int16_t,
u_int16_t *, u_int16_t *, u_int16_t *,
u_int16_t *, u_int8_t, sa_family_t);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void pf_send_tcp(struct mbuf *,
const struct pf_rule *, sa_family_t,
#else
@@ -270,7 +270,7 @@
int pf_test_rule(struct pf_rule **, struct pf_state **,
int, struct pfi_kif *, struct mbuf *, int,
void *, struct pf_pdesc *, struct pf_rule **,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_ruleset **, struct ifqueue *,
struct inpcb *);
#else
@@ -312,7 +312,7 @@
void pf_route6(struct mbuf **, struct pf_rule *, int,
struct ifnet *, struct pf_state *,
struct pf_pdesc *);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
int pf_socket_lookup(int, struct pf_pdesc *);
#endif
u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t,
@@ -325,7 +325,7 @@
struct pf_addr *);
int pf_check_proto_cksum(struct mbuf *, int, int,
u_int8_t, sa_family_t);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
struct pf_divert *pf_get_divert(struct mbuf *);
#endif
void pf_print_state_parts(struct pf_state *,
@@ -334,7 +334,7 @@
struct pf_addr_wrap *);
int pf_compare_state_keys(struct pf_state_key *,
struct pf_state_key *, struct pfi_kif *, u_int);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_state *pf_find_state(struct pfi_kif *,
struct pf_state_key_cmp *, u_int, struct mbuf *,
struct pf_mtag *);
@@ -345,7 +345,7 @@
int pf_src_connlimit(struct pf_state **);
int pf_check_congestion(struct ifqueue *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len);
VNET_DECLARE(int, pf_end_threads);
@@ -364,7 +364,7 @@
};
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define PPACKET_LOOPED() \
(pd->pf_mtag->flags & PF_PACKET_LOOPED)
@@ -404,7 +404,7 @@
} while (0)
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define BOUND_IFACE(r, k) \
((r)->rule_flag & PFRULE_IFBOUND) ? (k) : V_pfi_all
#else
@@ -441,7 +441,7 @@
static __inline int pf_state_compare_id(struct pf_state *,
struct pf_state *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(struct pf_src_tree, tree_src_tracking);
VNET_DEFINE(struct pf_state_tree_id, tree_id);
@@ -564,7 +564,7 @@
if ((*state)->rule.ptr->max_src_conn &&
(*state)->rule.ptr->max_src_conn <
(*state)->src_node->conn) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_SRCCONN]++;
#else
pf_status.lcounters[LCNT_SRCCONN]++;
@@ -574,7 +574,7 @@
if ((*state)->rule.ptr->max_src_conn_rate.limit &&
pf_check_threshold(&(*state)->src_node->conn_rate)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_SRCCONNRATE]++;
#else
pf_status.lcounters[LCNT_SRCCONNRATE]++;
@@ -589,7 +589,7 @@
struct pfr_addr p;
u_int32_t killed = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_OVERLOAD_TABLE]++;
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
@@ -626,7 +626,7 @@
struct pf_state_key *sk;
struct pf_state *st;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++;
RB_FOREACH(st, pf_state_tree_id, &V_tree_id) {
#else
@@ -656,7 +656,7 @@
killed++;
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -663,7 +663,7 @@
#endif
printf(", %u states killed", killed);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -691,7 +691,7 @@
k.rule.ptr = rule;
else
k.rule.ptr = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.scounters[SCNT_SRC_NODE_SEARCH]++;
*sn = RB_FIND(pf_src_tree, &V_tree_src_tracking, &k);
#else
@@ -702,13 +702,13 @@
if (*sn == NULL) {
if (!rule->max_src_nodes ||
rule->src_nodes < rule->max_src_nodes)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(*sn) = pool_get(&V_pf_src_tree_pl, PR_NOWAIT | PR_ZERO);
#else
(*sn) = pool_get(&pf_src_tree_pl, PR_NOWAIT | PR_ZERO);
#endif
else
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_SRCNODES]++;
#else
pf_status.lcounters[LCNT_SRCNODES]++;
@@ -728,7 +728,7 @@
(*sn)->rule.ptr = NULL;
PF_ACPY(&(*sn)->addr, src, af);
if (RB_INSERT(pf_src_tree,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
&V_tree_src_tracking, *sn) != NULL) {
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
@@ -739,7 +739,7 @@
pf_print_host(&(*sn)->addr, 0, af);
printf("\n");
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_src_tree_pl, *sn);
#else
pool_put(&pf_src_tree_pl, *sn);
@@ -750,7 +750,7 @@
(*sn)->ruletype = rule->action;
if ((*sn)->rule.ptr != NULL)
(*sn)->rule.ptr->src_nodes++;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.scounters[SCNT_SRC_NODE_INSERT]++;
V_pf_status.src_nodes++;
#else
@@ -760,7 +760,7 @@
} else {
if (rule->max_src_states &&
(*sn)->states >= rule->max_src_states) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_SRCSTATES]++;
#else
pf_status.lcounters[LCNT_SRCSTATES]++;
@@ -863,13 +863,13 @@
struct pf_state_key *cur;
struct pf_state *olds = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(s->key[idx] == NULL, ("%s: key is null!", __FUNCTION__));
#else
KASSERT(s->key[idx] == NULL); /* XXX handle this? */
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((cur = RB_INSERT(pf_state_tree, &V_pf_statetbl, sk)) != NULL) {
#else
if ((cur = RB_INSERT(pf_state_tree, &pf_statetbl, sk)) != NULL) {
@@ -886,7 +886,7 @@
/* unlink late or sks can go away */
olds = si->s;
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -909,7 +909,7 @@
sk : NULL);
printf("\n");
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_key_pl, sk);
#else
pool_put(&pf_state_key_pl, sk);
@@ -917,7 +917,7 @@
return (-1); /* collision! */
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_key_pl, sk);
#else
pool_put(&pf_state_key_pl, sk);
@@ -926,7 +926,7 @@
} else
s->key[idx] = sk;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((si = pool_get(&V_pf_state_item_pl, PR_NOWAIT)) == NULL) {
#else
if ((si = pool_get(&pf_state_item_pl, PR_NOWAIT)) == NULL) {
@@ -937,7 +937,7 @@
si->s = s;
/* list is sorted, if-bound states before floating */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (s->kif == V_pfi_all)
#else
if (s->kif == pfi_all)
@@ -976,7 +976,7 @@
if (si) {
TAILQ_REMOVE(&s->key[idx]->states, si, entry);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_item_pl, si);
#else
pool_put(&pf_state_item_pl, si);
@@ -984,7 +984,7 @@
}
if (TAILQ_EMPTY(&s->key[idx]->states)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_state_tree, &V_pf_statetbl, s->key[idx]);
#else
RB_REMOVE(pf_state_tree, &pf_statetbl, s->key[idx]);
@@ -991,13 +991,13 @@
#endif
if (s->key[idx]->reverse)
s->key[idx]->reverse->reverse = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX: implement this */
#else
if (s->key[idx]->inp)
s->key[idx]->inp->inp_pf_sk = NULL;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_key_pl, s->key[idx]);
#else
pool_put(&pf_state_key_pl, s->key[idx]);
@@ -1011,7 +1011,7 @@
{
struct pf_state_key *sk;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((sk = pool_get(&V_pf_state_key_pl, pool_flags)) == NULL)
#else
if ((sk = pool_get(&pf_state_key_pl, pool_flags)) == NULL)
@@ -1029,7 +1029,7 @@
struct pf_addr *saddr, struct pf_addr *daddr,
u_int16_t sport, u_int16_t dport)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((*skp == NULL && *nkp == NULL),
("%s: skp == NULL && nkp == NULL", __FUNCTION__));
#else
@@ -1075,7 +1075,7 @@
pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw,
struct pf_state_key *sks, struct pf_state *s)
{
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
splassert(IPL_SOFTNET);
#endif
@@ -1087,7 +1087,7 @@
s->key[PF_SK_STACK] = s->key[PF_SK_WIRE];
} else {
if (pf_state_key_attach(skw, s, PF_SK_WIRE)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_key_pl, sks);
#else
pool_put(&pf_state_key_pl, sks);
@@ -1101,7 +1101,7 @@
}
if (s->id == 0 && s->creatorid == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
s->id = htobe64(V_pf_status.stateid++);
s->creatorid = V_pf_status.hostid;
#else
@@ -1109,7 +1109,7 @@
s->creatorid = pf_status.hostid;
#endif
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (RB_INSERT(pf_state_tree_id, &V_tree_id, s) != NULL) {
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
@@ -1118,7 +1118,7 @@
#endif
printf("pf: state insert failed: "
"id: %016llx creatorid: %08x",
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(unsigned long long)betoh64(s->id), ntohl(s->creatorid));
#else
betoh64(s->id), ntohl(s->creatorid));
@@ -1128,7 +1128,7 @@
pf_detach_state(s);
return (-1);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_INSERT_TAIL(&V_state_list, s, entry_list);
V_pf_status.fcounters[FCNT_STATE_INSERT]++;
V_pf_status.states++;
@@ -1139,7 +1139,7 @@
#endif
pfi_kif_ref(kif, PFI_KIF_REF_STATE);
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_insert_state_ptr != NULL)
pfsync_insert_state_ptr(s);
#else
@@ -1152,7 +1152,7 @@
struct pf_state *
pf_find_state_byid(struct pf_state_cmp *key)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.fcounters[FCNT_STATE_SEARCH]++;
return (RB_FIND(pf_state_tree_id, &V_tree_id, (struct pf_state *)key));
@@ -1195,7 +1195,7 @@
}
struct pf_state *
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir,
struct mbuf *m, struct pf_mtag *pftag)
#else
@@ -1206,18 +1206,18 @@
struct pf_state_key *sk;
struct pf_state_item *si;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.fcounters[FCNT_STATE_SEARCH]++;
#else
pf_status.fcounters[FCNT_STATE_SEARCH]++;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (dir == PF_OUT && pftag->statekey &&
((struct pf_state_key *)pftag->statekey)->reverse)
sk = ((struct pf_state_key *)pftag->statekey)->reverse;
else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl,
#else
if ((sk = RB_FIND(pf_state_tree, &pf_statetbl,
@@ -1237,7 +1237,7 @@
((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse)
sk = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse;
else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl,
#else
if ((sk = RB_FIND(pf_state_tree, &pf_statetbl,
@@ -1255,7 +1255,7 @@
#endif
if (dir == PF_OUT)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pftag->statekey = NULL;
#else
m->m_pkthdr.pf.statekey = NULL;
@@ -1263,7 +1263,7 @@
/* list is sorted, if-bound states before floating ones */
TAILQ_FOREACH(si, &sk->states, entry)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((si->s->kif == V_pfi_all || si->s->kif == kif) &&
#else
if ((si->s->kif == pfi_all || si->s->kif == kif) &&
@@ -1281,13 +1281,13 @@
struct pf_state_key *sk;
struct pf_state_item *si, *ret = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.fcounters[FCNT_STATE_SEARCH]++;
#else
pf_status.fcounters[FCNT_STATE_SEARCH]++;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sk = RB_FIND(pf_state_tree, &V_pf_statetbl, (struct pf_state_key *)key);
#else
sk = RB_FIND(pf_state_tree, &pf_statetbl, (struct pf_state_key *)key);
@@ -1316,7 +1316,7 @@
pf_purge_thread(void *v)
{
int nloops = 0, s;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int locked;
#endif
@@ -1325,7 +1325,7 @@
for (;;) {
tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sx_slock(&V_pf_consistency_lock);
PF_LOCK();
locked = 0;
@@ -1350,7 +1350,7 @@
s = splsoftnet();
/* process a fraction of the state table every second */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!pf_purge_expired_states(1 + (V_pf_status.states /
V_pf_default_rule.timeout[PFTM_INTERVAL]), 0)) {
PF_UNLOCK();
@@ -1368,7 +1368,7 @@
#endif
/* purge other expired types every PFTM_INTERVAL seconds */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (++nloops >= V_pf_default_rule.timeout[PFTM_INTERVAL]) {
#else
if (++nloops >= pf_default_rule.timeout[PFTM_INTERVAL]) {
@@ -1379,7 +1379,7 @@
}
splx(s);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
if (locked)
sx_xunlock(&V_pf_consistency_lock);
@@ -1403,7 +1403,7 @@
return (time_second);
if (state->timeout == PFTM_UNTIL_PACKET)
return (0);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(state->timeout != PFTM_UNLINKED,
("pf_state_expires: timeout == PFTM_UNLINKED"));
KASSERT((state->timeout < PFTM_MAX),
@@ -1414,7 +1414,7 @@
#endif
timeout = state->rule.ptr->timeout[state->timeout];
if (!timeout)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
timeout = V_pf_default_rule.timeout[state->timeout];
#else
timeout = pf_default_rule.timeout[state->timeout];
@@ -1424,7 +1424,7 @@
end = state->rule.ptr->timeout[PFTM_ADAPTIVE_END];
states = state->rule.ptr->states_cur;
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
start = V_pf_default_rule.timeout[PFTM_ADAPTIVE_START];
end = V_pf_default_rule.timeout[PFTM_ADAPTIVE_END];
states = V_pf_status.states;
@@ -1444,7 +1444,7 @@
return (state->expire + timeout);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int
pf_purge_expired_src_nodes(int waslocked)
#else
@@ -1455,7 +1455,7 @@
struct pf_src_node *cur, *next;
int locked = waslocked;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
for (cur = RB_MIN(pf_src_tree, &V_tree_src_tracking); cur; cur = next) {
next = RB_NEXT(pf_src_tree, &V_tree_src_tracking, cur);
#else
@@ -1465,7 +1465,7 @@
if (cur->states <= 0 && cur->expire <= time_second) {
if (! locked) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sx_try_upgrade(&V_pf_consistency_lock))
return (0);
#else
@@ -1472,7 +1472,7 @@
rw_enter_write(&pf_consistency_lock);
#endif
next = RB_NEXT(pf_src_tree,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
&V_tree_src_tracking, cur);
#else
&tree_src_tracking, cur);
@@ -1485,7 +1485,7 @@
cur->rule.ptr->max_src_nodes <= 0)
pf_rm_rule(NULL, cur->rule.ptr);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_src_tree, &V_tree_src_tracking, cur);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
@@ -1500,7 +1500,7 @@
}
if (locked && !waslocked)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
sx_downgrade(&V_pf_consistency_lock);
}
@@ -1522,7 +1522,7 @@
timeout = s->rule.ptr->timeout[PFTM_SRC_NODE];
if (!timeout)
timeout =
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_default_rule.timeout[PFTM_SRC_NODE];
#else
pf_default_rule.timeout[PFTM_SRC_NODE];
@@ -1535,7 +1535,7 @@
timeout = s->rule.ptr->timeout[PFTM_SRC_NODE];
if (!timeout)
timeout =
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_default_rule.timeout[PFTM_SRC_NODE];
#else
pf_default_rule.timeout[PFTM_SRC_NODE];
@@ -1550,7 +1550,7 @@
void
pf_unlink_state(struct pf_state *cur)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (cur->local_flags & PFSTATE_EXPIRING)
return;
cur->local_flags |= PFSTATE_EXPIRING;
@@ -1560,7 +1560,7 @@
if (cur->src.state == PF_TCPS_PROXY_DST) {
/* XXX wire key the right one? */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, cur->rule.ptr, cur->key[PF_SK_WIRE]->af,
#else
pf_send_tcp(cur->rule.ptr, cur->key[PF_SK_WIRE]->af,
@@ -1572,7 +1572,7 @@
cur->src.seqhi, cur->src.seqlo + 1,
TH_RST|TH_ACK, 0, 0, 0, 1, cur->tag, NULL, NULL);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_state_tree_id, &V_tree_id, cur);
#else
RB_REMOVE(pf_state_tree_id, &tree_id, cur);
@@ -1579,7 +1579,7 @@
#endif
#if NPFLOW > 0
if (cur->state_flags & PFSTATE_PFLOW)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (export_pflow_ptr != NULL)
export_pflow_ptr(cur);
#else
@@ -1587,7 +1587,7 @@
#endif
#endif
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_delete_state_ptr != NULL)
pfsync_delete_state_ptr(cur);
#else
@@ -1604,12 +1604,12 @@
void
pf_free_state(struct pf_state *cur)
{
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
splassert(IPL_SOFTNET);
#endif
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_state_in_use_ptr != NULL &&
pfsync_state_in_use_ptr(cur))
#else
@@ -1617,7 +1617,7 @@
#endif
return;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(cur->timeout == PFTM_UNLINKED,
("pf_free_state: cur->timeout != PFTM_UNLINKED"));
#else
@@ -1635,7 +1635,7 @@
pf_rm_rule(NULL, cur->anchor.ptr);
pf_normalize_tcp_cleanup(cur);
pfi_kif_unref(cur->kif, PFI_KIF_REF_STATE);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_REMOVE(&V_state_list, cur, entry_list);
#else
TAILQ_REMOVE(&state_list, cur, entry_list);
@@ -1642,7 +1642,7 @@
#endif
if (cur->tag)
pf_tag_unref(cur->tag);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_pl, cur);
V_pf_status.fcounters[FCNT_STATE_REMOVALS]++;
V_pf_status.states--;
@@ -1653,7 +1653,7 @@
#endif
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int
pf_purge_expired_states(u_int32_t maxcheck, int waslocked)
#else
@@ -1663,7 +1663,7 @@
{
static struct pf_state *cur = NULL;
struct pf_state *next;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int locked = waslocked;
#else
int locked = 0;
@@ -1672,7 +1672,7 @@
while (maxcheck--) {
/* wrap to start of list when we hit the end */
if (cur == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
cur = TAILQ_FIRST(&V_state_list);
#else
cur = TAILQ_FIRST(&state_list);
@@ -1687,7 +1687,7 @@
if (cur->timeout == PFTM_UNLINKED) {
/* free unlinked state */
if (! locked) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sx_try_upgrade(&V_pf_consistency_lock))
return (0);
#else
@@ -1700,7 +1700,7 @@
/* unlink and free expired state */
pf_unlink_state(cur);
if (! locked) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!sx_try_upgrade(&V_pf_consistency_lock))
return (0);
#else
@@ -1713,7 +1713,7 @@
cur = next;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!waslocked && locked)
sx_downgrade(&V_pf_consistency_lock);
@@ -2200,7 +2200,7 @@
struct tcphdr *th, struct pf_state_peer *dst)
{
int hlen = (th->th_off << 2) - sizeof(*th), thoptlen = hlen;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int8_t opts[TCP_MAXOLEN], *opt = opts;
#else
u_int8_t opts[MAX_TCPOPTLEN], *opt = opts;
@@ -2248,7 +2248,7 @@
}
if (copyback)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off + sizeof(*th), thoptlen, (caddr_t)opts);
#else
m_copyback(m, off + sizeof(*th), thoptlen, opts);
@@ -2257,7 +2257,7 @@
}
void
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af,
#else
pf_send_tcp(const struct pf_rule *r, sa_family_t af,
@@ -2277,7 +2277,7 @@
#endif /* INET6 */
struct tcphdr *th;
char *opt;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_mtag *pf_mtag;
KASSERT(
@@ -2301,7 +2301,7 @@
#ifdef INET6
h6 = NULL;
#endif
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
/* maximum segment size tcp option */
tlen = sizeof(struct tcphdr);
@@ -2325,7 +2325,7 @@
m = m_gethdr(M_DONTWAIT, MT_HEADER);
if (m == NULL)
return;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef MAC
mac_netinet_firewall_send(m);
#endif
@@ -2335,7 +2335,7 @@
}
#endif
if (tag)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m->m_flags |= M_SKIP_FIREWALL;
pf_mtag->tag = rtag;
#else
@@ -2344,7 +2344,7 @@
#endif
if (r != NULL && r->rtableid >= 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
M_SETFIB(m, r->rtableid);
pf_mtag->rtableid = r->rtableid;
@@ -2351,13 +2351,13 @@
#else
m->m_pkthdr.pf.rtableid = r->rtableid;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
}
#endif
#ifdef ALTQ
if (r != NULL && r->qid) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_mtag->qid = r->qid;
/* add hints for ecn */
@@ -2429,7 +2429,7 @@
h->ip_v = 4;
h->ip_hl = sizeof(*h) >> 2;
h->ip_tos = IPTOS_LOWDELAY;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
h->ip_off = V_path_mtu_discovery ? IP_DF : 0;
h->ip_len = len;
h->ip_ttl = ttl ? ttl : V_ip_defttl;
@@ -2440,12 +2440,12 @@
#endif
h->ip_sum = 0;
if (eh == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
ip_output(m, (void *)NULL, (void *)NULL, 0,
(void *)NULL, (void *)NULL);
PF_LOCK();
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
ip_output(m, (void *)NULL, (void *)NULL, 0,
(void *)NULL, (void *)NULL);
#endif
@@ -2465,13 +2465,13 @@
bcopy(eh->ether_dhost, e->ether_shost, ETHER_ADDR_LEN);
bcopy(eh->ether_shost, e->ether_dhost, ETHER_ADDR_LEN);
e->ether_type = eh->ether_type;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
/* XXX_IMPORT: later */
ip_output(m, (void *)NULL, &ro, 0,
(void *)NULL, (void *)NULL);
PF_LOCK();
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
ip_output(m, (void *)NULL, &ro, IP_ROUTETOETHER,
(void *)NULL, (void *)NULL);
#endif
@@ -2487,7 +2487,7 @@
h6->ip6_vfc |= IPV6_VERSION;
h6->ip6_hlim = IPV6_DEFHLIM;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
PF_LOCK();
@@ -2504,7 +2504,7 @@
struct pf_rule *r)
{
struct mbuf *m0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef INET
struct ip *ip;
#endif
@@ -2511,7 +2511,7 @@
struct pf_mtag *pf_mtag;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m0 = m_copypacket(m, M_DONTWAIT);
if (m0 == NULL)
return;
@@ -2520,7 +2520,7 @@
return;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((pf_mtag = pf_get_mtag(m0)) == NULL)
return;
/* XXX: revisit */
@@ -2530,7 +2530,7 @@
#endif
if (r->rtableid >= 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
M_SETFIB(m0, r->rtableid);
pf_mtag->rtableid = r->rtableid;
@@ -2537,13 +2537,13 @@
#else
m0->m_pkthdr.pf.rtableid = r->rtableid;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
}
#endif
#ifdef ALTQ
if (r->qid) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_mtag->qid = r->qid;
/* add hints for ecn */
pf_mtag->hdr = mtod(m0, struct ip *);
@@ -2558,7 +2558,7 @@
switch (af) {
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* icmp_error() expects host byte ordering */
ip = mtod(m0, struct ip *);
NTOHS(ip->ip_len);
@@ -2573,11 +2573,11 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
icmp6_error(m0, type, code, 0);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
break;
@@ -2721,7 +2721,7 @@
}
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_match_tag(struct mbuf *m, struct pf_rule *r, int *tag,
struct pf_mtag *pf_mtag)
#else
@@ -2729,7 +2729,7 @@
#endif
{
if (*tag == -1)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*tag = pf_mtag->tag;
#else
*tag = m->m_pkthdr.pf.tag;
@@ -2740,7 +2740,7 @@
}
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_tag_packet(struct mbuf *m, int tag, int rtableid,
struct pf_mtag *pf_mtag)
#else
@@ -2751,13 +2751,13 @@
return (0);
if (tag > 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_mtag->tag = tag;
#else
m->m_pkthdr.pf.tag = tag;
#endif
if (rtableid >= 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
M_SETFIB(m, rtableid);
}
@@ -2777,7 +2777,7 @@
(*r)->anchor->match = 0;
if (match)
*match = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (*depth >= sizeof(V_pf_anchor_stack) /
sizeof(V_pf_anchor_stack[0])) {
#else
@@ -2789,7 +2789,7 @@
return;
} else if (*depth == 0 && a != NULL)
*a = *r;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
f = V_pf_anchor_stack + (*depth)++;
#else
f = pf_anchor_stack + (*depth)++;
@@ -2822,7 +2822,7 @@
do {
if (*depth <= 0)
break;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
f = V_pf_anchor_stack + *depth - 1;
#else
f = pf_anchor_stack + *depth - 1;
@@ -2913,7 +2913,7 @@
#endif /* INET6 */
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_socket_lookup(int direction, struct pf_pdesc *pd, struct inpcb *inp_arg)
#else
pf_socket_lookup(int direction, struct pf_pdesc *pd)
@@ -2921,7 +2921,7 @@
{
struct pf_addr *saddr, *daddr;
u_int16_t sport, dport;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct inpcbinfo *pi;
#else
struct inpcbtable *tb;
@@ -2934,7 +2934,7 @@
pd->lookup.gid = GID_MAX;
pd->lookup.pid = NO_PID;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (inp_arg != NULL) {
INP_LOCK_ASSERT(inp_arg);
pd->lookup.uid = inp_arg->inp_cred->cr_uid;
@@ -2949,7 +2949,7 @@
return (-1);
sport = pd->hdr.tcp->th_sport;
dport = pd->hdr.tcp->th_dport;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pi = &V_tcbinfo;
#else
tb = &tcbtable;
@@ -2960,7 +2960,7 @@
return (-1);
sport = pd->hdr.udp->uh_sport;
dport = pd->hdr.udp->uh_dport;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pi = &V_udbinfo;
#else
tb = &udbtable;
@@ -2984,7 +2984,7 @@
switch (pd->af) {
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* XXXRW: would be nice if we had an mbuf here so that we
* could use in_pcblookup_mbuf().
@@ -3011,7 +3011,7 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* XXXRW: would be nice if we had an mbuf here so that we
* could use in6_pcblookup_mbuf().
@@ -3041,7 +3041,7 @@
default:
return (-1);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
INP_RLOCK_ASSERT(inp);
pd->lookup.uid = inp->inp_cred->cr_uid;
pd->lookup.gid = inp->inp_cred->cr_groups[0];
@@ -3100,7 +3100,7 @@
int hlen;
u_int8_t hdr[60];
u_int8_t *opt, optlen;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int16_t mss = V_tcp_mssdflt;
#else
u_int16_t mss = tcp_mssdflt;
@@ -3148,7 +3148,7 @@
struct route_in6 ro6;
#endif /* INET6 */
struct rtentry *rt = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int hlen = 0;
u_int16_t mss = V_tcp_mssdflt;
#else
@@ -3165,9 +3165,9 @@
dst->sin_family = AF_INET;
dst->sin_len = sizeof(*dst);
dst->sin_addr = addr->v4;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
in_rtalloc_ign(&ro, 0, rtableid);
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
rtalloc_noclone(&ro, NO_CLONING);
#endif
rt = ro.ro_rt;
@@ -3181,9 +3181,9 @@
dst6->sin6_family = AF_INET6;
dst6->sin6_len = sizeof(*dst6);
dst6->sin6_addr = addr->v6;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
in6_rtalloc_ign(&ro6, 0, rtableid);
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
rtalloc_noclone((struct route *)&ro6, NO_CLONING);
#endif
rt = ro6.ro_rt;
@@ -3193,7 +3193,7 @@
if (rt && rt->rt_ifp) {
mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
mss = max(V_tcp_mssdflt, mss);
#else
mss = max(tcp_mssdflt, mss);
@@ -3236,7 +3236,7 @@
MD5_CTX ctx;
u_int32_t digest[4];
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_tcp_secret_init == 0) {
read_random(&V_pf_tcp_secret, sizeof(V_pf_tcp_secret));
MD5Init(&V_pf_tcp_secret_ctx);
@@ -3268,7 +3268,7 @@
MD5Update(&ctx, (char *)&pd->dst->v4, sizeof(struct in_addr));
}
MD5Final((u_char *)digest, &ctx);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_tcp_iss_off += 4096;
#define ISN_RANDOM_INCREMENT (4096 - 1)
return (digest[0] + (arc4random() & ISN_RANDOM_INCREMENT) +
@@ -3284,7 +3284,7 @@
pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
struct pfi_kif *kif, struct mbuf *m, int off, void *h,
struct pf_pdesc *pd, struct pf_rule **am, struct pf_ruleset **rsm,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ifqueue *ifq, struct inpcb *inp)
#else
struct ifqueue *ifq)
@@ -3305,7 +3305,7 @@
int asd = 0;
int match = 0;
int state_icmp = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int16_t sport = 0, dport = 0;
u_int16_t bproto_sum = 0, bip_sum = 0;
#else
@@ -3320,7 +3320,7 @@
return (PF_DROP);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (inp != NULL)
pd->lookup.done = pf_socket_lookup(direction, pd, inp);
else if (V_debug_pfugidhack) {
@@ -3551,7 +3551,7 @@
r = TAILQ_NEXT(r, entries);
/* tcp/udp only. uid.op always 0 in other cases */
else if (r->uid.op && (pd->lookup.done || (pd->lookup.done =
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_socket_lookup(direction, pd, inp), 1)) &&
#else
pf_socket_lookup(direction, pd), 1)) &&
@@ -3561,7 +3561,7 @@
r = TAILQ_NEXT(r, entries);
/* tcp/udp only. gid.op always 0 in other cases */
else if (r->gid.op && (pd->lookup.done || (pd->lookup.done =
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_socket_lookup(direction, pd, inp), 1)) &&
#else
pf_socket_lookup(direction, pd), 1)) &&
@@ -3570,13 +3570,13 @@
pd->lookup.gid))
r = TAILQ_NEXT(r, entries);
else if (r->prob &&
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
r->prob <= arc4random())
#else
r->prob <= arc4random_uniform(UINT_MAX - 1) + 1)
#endif
r = TAILQ_NEXT(r, entries);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
else if (r->match_tag && !pf_match_tag(m, r, &tag, pd->pf_mtag))
#else
else if (r->match_tag && !pf_match_tag(m, r, &tag))
@@ -3674,7 +3674,7 @@
ack++;
if (th->th_flags & TH_FIN)
ack++;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(m, r, af, pd->dst,
#else
pf_send_tcp(r, af, pd->dst,
@@ -3696,7 +3696,7 @@
if (r->action == PF_DROP)
goto cleanup;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pf_tag_packet(m, tag, rtableid, pd->pf_mtag)) {
#else
if (pf_tag_packet(m, tag, rtableid)) {
@@ -3714,7 +3714,7 @@
if (action != PF_PASS)
return (action);
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sk != NULL)
pool_put(&V_pf_state_key_pl, sk);
if (nk != NULL)
@@ -3733,7 +3733,7 @@
#if NPFSYNC > 0
if (*sm != NULL && !ISSET((*sm)->state_flags, PFSTATE_NOSYNC) &&
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
direction == PF_OUT && pfsync_up_ptr != NULL && pfsync_up_ptr()) {
#else
direction == PF_OUT && pfsync_up()) {
@@ -3744,7 +3744,7 @@
* firewall has to know about it to allow
* replies through it.
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_defer_ptr != NULL &&
pfsync_defer_ptr(*sm, m))
#else
@@ -3757,7 +3757,7 @@
return (PF_PASS);
cleanup:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sk != NULL)
pool_put(&V_pf_state_key_pl, sk);
if (nk != NULL)
@@ -3782,7 +3782,7 @@
struct pf_state *s = NULL;
struct pf_src_node *sn = NULL;
struct tcphdr *th = pd->hdr.tcp;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int16_t mss = V_tcp_mssdflt;
#else
u_int16_t mss = tcp_mssdflt;
@@ -3791,7 +3791,7 @@
/* check maximums */
if (r->max_states && (r->states_cur >= r->max_states)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.lcounters[LCNT_STATES]++;
#else
pf_status.lcounters[LCNT_STATES]++;
@@ -3812,7 +3812,7 @@
REASON_SET(&reason, PFRES_SRCLIMIT);
goto csfailed;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
s = pool_get(&V_pf_state_pl, PR_NOWAIT | PR_ZERO);
#else
s = pool_get(&pf_state_pl, PR_NOWAIT | PR_ZERO);
@@ -3907,7 +3907,7 @@
REASON_SET(&reason, PFRES_MEMORY);
pf_src_tree_remove_state(s);
STATE_DEC_COUNTERS(s);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_pl, s);
#else
pool_put(&pf_state_pl, s);
@@ -3923,7 +3923,7 @@
pf_normalize_tcp_cleanup(s);
pf_src_tree_remove_state(s);
STATE_DEC_COUNTERS(s);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_pl, s);
#else
pool_put(&pf_state_pl, s);
@@ -3943,7 +3943,7 @@
REASON_SET(&reason, PFRES_STATEINS);
pf_src_tree_remove_state(s);
STATE_DEC_COUNTERS(s);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_pl, s);
#else
pool_put(&pf_state_pl, s);
@@ -3984,7 +3984,7 @@
mss = pf_calc_mss(pd->src, pd->af, rtid, mss);
mss = pf_calc_mss(pd->dst, pd->af, rtid, mss);
s->src.mss = mss;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, r, pd->af, pd->dst, pd->src, th->th_dport,
#else
pf_send_tcp(r, pd->af, pd->dst, pd->src, th->th_dport,
@@ -3998,7 +3998,7 @@
return (PF_PASS);
csfailed:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (sk != NULL)
pool_put(&V_pf_state_key_pl, sk);
if (nk != NULL)
@@ -4011,7 +4011,7 @@
#endif
if (sn != NULL && sn->states == 0 && sn->expire == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_src_tree, &V_tree_src_tracking, sn);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
@@ -4024,7 +4024,7 @@
#endif
}
if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_src_tree, &V_tree_src_tracking, nsn);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
@@ -4086,7 +4086,7 @@
else if (r->prob && r->prob <=
(arc4random() % (UINT_MAX - 1) + 1))
r = TAILQ_NEXT(r, entries);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
else if (r->match_tag && !pf_match_tag(m, r, &tag, pd->pf_mtag))
#else
else if (r->match_tag && !pf_match_tag(m, r, &tag))
@@ -4122,7 +4122,7 @@
if (r->action != PF_PASS)
return (PF_DROP);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pf_tag_packet(m, tag, -1, pd->pf_mtag)) {
#else
if (pf_tag_packet(m, tag, -1)) {
@@ -4381,7 +4381,7 @@
* and keep updating the state TTL.
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -4391,7 +4391,7 @@
pf_print_flags(th->th_flags);
printf(" seq=%u (%u) ack=%u len=%u ackskew=%d "
"pkts=%llu:%llu dir=%s,%s\n", seq, orig_seq, ack,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pd->p_len, ackskew, (unsigned long long)(*state)->packets[0],
(unsigned long long)(*state)->packets[1],
#else
@@ -4436,7 +4436,7 @@
(*state)->src.state == TCPS_SYN_SENT) {
/* Send RST for state mismatches during handshake */
if (!(th->th_flags & TH_RST))
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
#else
pf_send_tcp((*state)->rule.ptr, pd->af,
@@ -4449,7 +4449,7 @@
src->seqlo = 0;
src->seqhi = 1;
src->max_win = 1;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
} else if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
} else if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -4460,7 +4460,7 @@
printf(" seq=%u (%u) ack=%u len=%u ackskew=%d "
"pkts=%llu:%llu dir=%s,%s\n",
seq, orig_seq, ack, pd->p_len, ackskew,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(unsigned long long)(*state)->packets[0],
(unsigned long long)(*state)->packets[1],
#else
@@ -4580,7 +4580,7 @@
key.port[0] = th->th_dport;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4606,7 +4606,7 @@
REASON_SET(reason, PFRES_SYNPROXY);
return (PF_DROP);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
#else
pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
@@ -4640,7 +4640,7 @@
(*state)->src.max_win = MAX(ntohs(th->th_win), 1);
if ((*state)->dst.seqhi == 1)
(*state)->dst.seqhi = htonl(arc4random());
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
#else
pf_send_tcp((*state)->rule.ptr, pd->af,
@@ -4659,7 +4659,7 @@
} else {
(*state)->dst.max_win = MAX(ntohs(th->th_win), 1);
(*state)->dst.seqlo = ntohl(th->th_seq);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
#else
pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
@@ -4668,7 +4668,7 @@
ntohl(th->th_ack), ntohl(th->th_seq) + 1,
TH_ACK, (*state)->src.max_win, 0, 0, 0,
(*state)->tag, NULL, NULL);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
#else
pf_send_tcp((*state)->rule.ptr, pd->af,
@@ -4697,7 +4697,7 @@
if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) &&
dst->state >= TCPS_FIN_WAIT_2 &&
src->state >= TCPS_FIN_WAIT_2) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -4743,7 +4743,7 @@
/* Copyback sequence modulation or stateful scrub changes if needed */
if (copyback)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off, sizeof(*th), (caddr_t)th);
#else
m_copyback(m, off, sizeof(*th), th);
@@ -4774,7 +4774,7 @@
key.port[0] = uh->uh_dport;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4816,7 +4816,7 @@
pf_change_ap(pd->dst, &uh->uh_dport, pd->ip_sum,
&uh->uh_sum, &nk->addr[pd->didx],
nk->port[pd->didx], 1, pd->af);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
#else
m_copyback(m, off, sizeof(*uh), uh);
@@ -4831,7 +4831,7 @@
struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason)
{
struct pf_addr *saddr = pd->src, *daddr = pd->dst;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int16_t icmpid = 0, *icmpsum;
#else
u_int16_t icmpid, *icmpsum;
@@ -4887,7 +4887,7 @@
PF_ACPY(&key.addr[0], pd->dst, key.af);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4926,7 +4926,7 @@
}
m_copyback(m, off, ICMP_MINLEN,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp);
@@ -4948,7 +4948,7 @@
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp6);
@@ -4965,7 +4965,7 @@
*/
struct pf_pdesc pd2;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bzero(&pd2, sizeof pd2);
#endif
#ifdef INET
@@ -4975,7 +4975,7 @@
struct ip6_hdr h2_6;
int terminal = 0;
#endif /* INET6 */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int ipoff2 = 0;
int off2 = 0;
#else
@@ -5102,7 +5102,7 @@
key.port[pd2.sidx] = th.th_sport;
key.port[pd2.didx] = th.th_dport;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -5132,7 +5132,7 @@
if (!((*state)->state_flags & PFSTATE_SLOPPY) &&
(!SEQ_GEQ(src->seqhi, seq) ||
!SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws)))) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -5149,7 +5149,7 @@
REASON_SET(reason, PFRES_BADSTATE);
return (PF_DROP);
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -5197,12 +5197,12 @@
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp);
m_copyback(m, ipoff2, sizeof(h2),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
&h2);
@@ -5212,12 +5212,12 @@
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
&h2_6);
@@ -5224,7 +5224,7 @@
break;
#endif /* INET6 */
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off2, 8, (caddr_t)&th);
#else
m_copyback(m, off2, 8, &th);
@@ -5252,7 +5252,7 @@
key.port[pd2.sidx] = uh.uh_sport;
key.port[pd2.didx] = uh.uh_dport;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -5287,11 +5287,11 @@
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, ipoff2, sizeof(h2), (caddr_t)&h2);
#else
m_copyback(m, ipoff2, sizeof(h2), &h2);
@@ -5302,12 +5302,12 @@
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
&h2_6);
@@ -5314,7 +5314,7 @@
break;
#endif /* INET6 */
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off2, sizeof(uh), (caddr_t)&uh);
#else
m_copyback(m, off2, sizeof(uh), &uh);
@@ -5341,7 +5341,7 @@
PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af);
key.port[0] = key.port[1] = iih.icmp_id;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -5372,7 +5372,7 @@
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, AF_INET);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off, ICMP_MINLEN, (caddr_t)pd->hdr.icmp);
m_copyback(m, ipoff2, sizeof(h2), (caddr_t)&h2);
m_copyback(m, off2, ICMP_MINLEN, (caddr_t)&iih);
@@ -5404,7 +5404,7 @@
PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af);
key.port[0] = key.port[1] = iih.icmp6_id;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -5435,7 +5435,7 @@
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, AF_INET6);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off, sizeof(struct icmp6_hdr),
(caddr_t)pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6), (caddr_t)&h2_6);
@@ -5460,7 +5460,7 @@
PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af);
key.port[0] = key.port[1] = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -5490,7 +5490,7 @@
switch (pd2.af) {
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off, ICMP_MINLEN,
(caddr_t)pd->hdr.icmp);
m_copyback(m, ipoff2, sizeof(h2), (caddr_t)&h2);
@@ -5505,12 +5505,12 @@
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
(caddr_t)
#endif
&h2_6);
@@ -5544,7 +5544,7 @@
key.port[1] = key.port[0] = 0;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -5575,7 +5575,7 @@
if ((*state)->key[PF_SK_WIRE] != (*state)->key[PF_SK_STACK]) {
struct pf_state_key *nk = (*state)->key[pd->didx];
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(nk, ("%s: nk is null", __FUNCTION__));
KASSERT(pd, ("%s: pd is null", __FUNCTION__));
KASSERT(pd->src, ("%s: pd->src is null", __FUNCTION__));
@@ -5672,7 +5672,7 @@
pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
int rtableid)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef RADIX_MPATH
struct radix_node_head *rnh;
#endif
@@ -5680,11 +5680,11 @@
struct sockaddr_in *dst;
int ret = 1;
int check_mpath;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
extern int ipmultipath;
#endif
#ifdef INET6
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
extern int ip6_multipath;
#endif
struct sockaddr_in6 *dst6;
@@ -5697,7 +5697,7 @@
struct ifnet *ifp;
check_mpath = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef RADIX_MPATH
/* XXX: stick to table 0 for now */
rnh = rt_tables_get_rnh(0, af);
@@ -5712,7 +5712,7 @@
dst->sin_family = AF_INET;
dst->sin_len = sizeof(*dst);
dst->sin_addr = addr->v4;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if (ipmultipath)
check_mpath = 1;
#endif
@@ -5729,7 +5729,7 @@
dst6->sin6_family = AF_INET6;
dst6->sin6_len = sizeof(*dst6);
dst6->sin6_addr = addr->v6;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if (ip6_multipath)
check_mpath = 1;
#endif
@@ -5743,7 +5743,7 @@
if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC)
goto out;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
switch (af) {
#ifdef INET6
case AF_INET6:
@@ -5759,7 +5759,7 @@
rtalloc_ign((struct route *)&ro, 0); /* No/default FIB. */
break;
}
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
rtalloc_noclone((struct route *)&ro, NO_CLONING);
#endif
@@ -5778,7 +5778,7 @@
rn = (struct radix_node *)ro.ro_rt;
do {
rt = (struct rtentry *)rn;
-#ifndef __FreeBSD__ /* CARPDEV */
+#ifndef __MidnightBSD__ /* CARPDEV */
if (rt->rt_ifp->if_type == IFT_CARP)
ifp = rt->rt_ifp->if_carpdev;
else
@@ -5787,7 +5787,7 @@
if (kif->pfik_ifp == ifp)
ret = 1;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef RADIX_MPATH
rn = rn_mpath_next(rn);
#endif
@@ -5836,7 +5836,7 @@
return (0);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
switch (af) {
#ifdef INET6
case AF_INET6:
@@ -5852,12 +5852,12 @@
rtalloc_ign((struct route *)&ro, 0);
break;
}
-#else /* ! __FreeBSD__ */
+#else /* ! __MidnightBSD__ */
rtalloc_noclone((struct route *)&ro, NO_CLONING);
#endif
if (ro.ro_rt != NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX_IMPORT: later */
#else
if (ro.ro_rt->rt_labelid == aw->v.rtlabel)
@@ -5883,7 +5883,7 @@
struct pf_addr naddr;
struct pf_src_node *sn = NULL;
int error = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int sw_csum;
#endif
#ifdef IPSEC
@@ -5894,7 +5894,7 @@
(dir != PF_IN && dir != PF_OUT) || oifp == NULL)
panic("pf_route: invalid parameters");
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pd->pf_mtag->routed++ > 3) {
#else
if ((*m)->m_pkthdr.pf.routed++ > 3) {
@@ -5905,7 +5905,7 @@
}
if (r->rt == PF_DUPTO) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((m0 = m_dup(*m, M_DONTWAIT)) == NULL)
#else
if ((m0 = m_copym2(*m, 0, M_COPYALL, M_NOWAIT)) == NULL)
@@ -5933,13 +5933,13 @@
dst->sin_addr = ip->ip_dst;
if (r->rt == PF_FASTROUTE) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
in_rtalloc_ign(ro, 0, M_GETFIB(m0));
#else
rtalloc(ro);
#endif
if (ro->ro_rt == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KMOD_IPSTAT_INC(ips_noroute);
#else
ipstat.ips_noroute++;
@@ -5976,7 +5976,7 @@
goto bad;
if (oifp != ifp) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
if (pf_test(PF_OUT, ifp, &m0, NULL, NULL) != PF_PASS) {
PF_LOCK();
@@ -6000,7 +6000,7 @@
ip = mtod(m0, struct ip *);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* Copied from FreeBSD 5.1-CURRENT ip_output. */
m0->m_pkthdr.csum_flags |= CSUM_IP;
sw_csum = m0->m_pkthdr.csum_flags & ~ifp->if_hwassist;
@@ -6074,7 +6074,7 @@
if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) &&
ifp->if_bridge == NULL) {
m0->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KMOD_IPSTAT_INC(ips_outhwcsum);
#else
ipstat.ips_outhwcsum++;
@@ -6096,13 +6096,13 @@
* Must be able to put at least 8 bytes per fragment.
*/
if (ip->ip_off & htons(IP_DF)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KMOD_IPSTAT_INC(ips_cantfrag);
#else
ipstat.ips_cantfrag++;
#endif
if (r->rt != PF_DUPTO) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* icmp_error() expects host byte ordering */
NTOHS(ip->ip_len);
NTOHS(ip->ip_off);
@@ -6120,7 +6120,7 @@
}
m1 = m0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* XXX: is cheaper + less error prone than own function
*/
@@ -6131,7 +6131,7 @@
error = ip_fragment(m0, ifp, ifp->if_mtu);
#endif
if (error) {
-#ifndef __FreeBSD__ /* ip_fragment does not do m_freem() on FreeBSD */
+#ifndef __MidnightBSD__ /* ip_fragment does not do m_freem() on FreeBSD */
m0 = NULL;
#endif
goto bad;
@@ -6140,7 +6140,7 @@
for (m0 = m1; m0; m0 = m1) {
m1 = m0->m_nextpkt;
m0->m_nextpkt = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (error == 0) {
PF_UNLOCK();
error = (*ifp->if_output)(ifp, m0, sintosa(dst),
@@ -6157,7 +6157,7 @@
}
if (error == 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KMOD_IPSTAT_INC(ips_fragmented);
#else
ipstat.ips_fragmented++;
@@ -6194,7 +6194,7 @@
(dir != PF_IN && dir != PF_OUT) || oifp == NULL)
panic("pf_route6: invalid parameters");
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pd->pf_mtag->routed++ > 3) {
#else
if ((*m)->m_pkthdr.pf.routed++ > 3) {
@@ -6205,7 +6205,7 @@
}
if (r->rt == PF_DUPTO) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((m0 = m_dup(*m, M_DONTWAIT)) == NULL)
#else
if ((m0 = m_copym2(*m, 0, M_COPYALL, M_NOWAIT)) == NULL)
@@ -6233,7 +6233,7 @@
/* Cheat. XXX why only in the v6 case??? */
if (r->rt == PF_FASTROUTE) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m0->m_flags |= M_SKIP_FIREWALL;
PF_UNLOCK();
ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL);
@@ -6266,7 +6266,7 @@
goto bad;
if (oifp != ifp) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
if (pf_test6(PF_OUT, ifp, &m0, NULL, NULL) != PF_PASS) {
PF_LOCK();
@@ -6297,16 +6297,16 @@
if (IN6_IS_SCOPE_EMBED(&dst->sin6_addr))
dst->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
nd6_output(ifp, ifp, m0, dst, NULL);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
} else {
in6_ifstat_inc(ifp, ifs6_in_toobig);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (r->rt != PF_DUPTO) {
PF_UNLOCK();
icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu);
@@ -6331,7 +6331,7 @@
}
#endif /* INET6 */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* FreeBSD supports cksum offloads for the following drivers.
* em(4), fxp(4), ixgb(4), lge(4), ndis(4), nge(4), re(4),
@@ -6465,7 +6465,7 @@
}
return (0);
}
-#else /* !__FreeBSD__ */
+#else /* !__MidnightBSD__ */
/*
* check protocol (tcp/udp/icmp/icmp6) checksum and set mbuf flag
@@ -6561,7 +6561,7 @@
}
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
struct pf_divert *
pf_find_divert(struct mbuf *m)
{
@@ -6593,7 +6593,7 @@
#ifdef INET
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_test(int dir, struct ifnet *ifp, struct mbuf **m0,
struct ether_header *eh, struct inpcb *inp)
#else
@@ -6604,7 +6604,7 @@
struct pfi_kif *kif;
u_short action, reason = 0, log = 0;
struct mbuf *m = *m0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ip *h = NULL;
struct m_tag *ipfwtag;
struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr;
@@ -6617,7 +6617,7 @@
struct pf_pdesc pd;
int off, dirndx, pqid = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
if (!V_pf_status.running)
{
@@ -6630,7 +6630,7 @@
#endif
memset(&pd, 0, sizeof(pd));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((pd.pf_mtag = pf_get_mtag(m)) == NULL) {
PF_UNLOCK();
DPFPRINTF(PF_DEBUG_URGENT,
@@ -6638,7 +6638,7 @@
return (PF_DROP);
}
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if (ifp->if_type == IFT_CARP && ifp->if_carpdev)
kif = (struct pfi_kif *)ifp->if_carpdev->if_pf_kif;
else
@@ -6646,7 +6646,7 @@
kif = (struct pfi_kif *)ifp->if_pf_kif;
if (kif == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
DPFPRINTF(PF_DEBUG_URGENT,
@@ -6654,16 +6654,16 @@
return (PF_DROP);
}
if (kif->pfik_flags & PFI_IFLAG_SKIP)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
PF_UNLOCK();
#endif
return (PF_PASS);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
}
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
M_ASSERTPKTHDR(m);
#else
#ifdef DIAGNOSTIC
@@ -6679,7 +6679,7 @@
goto done;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (m->m_flags & M_SKIP_FIREWALL) {
PF_UNLOCK();
return (PF_PASS);
@@ -6689,7 +6689,7 @@
return (PF_PASS);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (ip_divert_ptr != NULL &&
((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) {
struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1);
@@ -6761,7 +6761,7 @@
&reason);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -6772,7 +6772,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -6801,7 +6801,7 @@
action = pf_test_state_udp(&s, dir, kif, m, off, h, &pd);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -6812,7 +6812,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -6835,7 +6835,7 @@
&reason);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -6846,7 +6846,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -6869,7 +6869,7 @@
action = pf_test_state_other(&s, dir, kif, m, &pd);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -6880,7 +6880,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif, m, off, h,
&pd, &a, &ruleset, NULL, inp);
#else
@@ -6901,7 +6901,7 @@
}
if ((s && s->tag) || r->rtableid >= 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag);
#else
pf_tag_packet(m, s ? s->tag : 0, r->rtableid);
@@ -6908,7 +6908,7 @@
#endif
if (dir == PF_IN && s && s->key[PF_SK_STACK])
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pd.pf_mtag->statekey = s->key[PF_SK_STACK];
#else
m->m_pkthdr.pf.statekey = s->key[PF_SK_STACK];
@@ -6916,7 +6916,7 @@
#ifdef ALTQ
if (action == PF_PASS && r->qid) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pqid || (pd.tos & IPTOS_LOWDELAY))
pd.pf_mtag->qid = r->pqid;
else
@@ -6945,13 +6945,13 @@
(s->nat_rule.ptr->action == PF_RDR ||
s->nat_rule.ptr->action == PF_BINAT) &&
(ntohl(pd.dst->v4.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m->m_flags |= M_SKIP_FIREWALL;
#else
m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (action == PF_PASS && r->divert.port &&
ip_divert_ptr != NULL && !PACKET_LOOPED()) {
@@ -7038,7 +7038,7 @@
}
tr = r;
nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (nr != NULL && r == &V_pf_default_rule)
#else
if (nr != NULL && r == &pf_default_rule)
@@ -7073,7 +7073,7 @@
pf_route(m0, r, dir, kif->pfik_ifp, s, &pd);
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
return (action);
@@ -7082,7 +7082,7 @@
#ifdef INET6
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0,
struct ether_header *eh, struct inpcb *inp)
#else
@@ -7093,7 +7093,7 @@
struct pfi_kif *kif;
u_short action, reason = 0, log = 0;
struct mbuf *m = *m0, *n = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ip6_hdr *h = NULL;
struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr;
#else
@@ -7105,7 +7105,7 @@
struct pf_pdesc pd;
int off, terminal = 0, dirndx, rh_cnt = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
if (!V_pf_status.running) {
PF_UNLOCK();
@@ -7117,7 +7117,7 @@
#endif
memset(&pd, 0, sizeof(pd));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((pd.pf_mtag = pf_get_mtag(m)) == NULL) {
PF_UNLOCK();
DPFPRINTF(PF_DEBUG_URGENT,
@@ -7125,7 +7125,7 @@
return (PF_DROP);
}
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if (ifp->if_type == IFT_CARP && ifp->if_carpdev)
kif = (struct pfi_kif *)ifp->if_carpdev->if_pf_kif;
else
@@ -7133,7 +7133,7 @@
kif = (struct pfi_kif *)ifp->if_pf_kif;
if (kif == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
DPFPRINTF(PF_DEBUG_URGENT,
@@ -7141,16 +7141,16 @@
return (PF_DROP);
}
if (kif->pfik_flags & PFI_IFLAG_SKIP)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
{
PF_UNLOCK();
#endif
return (PF_PASS);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
}
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
M_ASSERTPKTHDR(m);
#else
#ifdef DIAGNOSTIC
@@ -7166,7 +7166,7 @@
goto done;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pd.pf_mtag->flags & PF_TAG_GENERATED) {
PF_UNLOCK();
#else
@@ -7173,7 +7173,7 @@
if (m->m_pkthdr.pf.flags & PF_TAG_GENERATED)
#endif
return (PF_PASS);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
}
#endif
@@ -7301,7 +7301,7 @@
&reason);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -7312,7 +7312,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -7341,7 +7341,7 @@
action = pf_test_state_udp(&s, dir, kif, m, off, h, &pd);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -7352,7 +7352,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -7382,7 +7382,7 @@
m, off, h, &pd, &reason);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -7393,7 +7393,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -7407,7 +7407,7 @@
action = pf_test_state_other(&s, dir, kif, m, &pd);
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -7418,7 +7418,7 @@
a = s->anchor.ptr;
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
action = pf_test_rule(&r, &s, dir, kif, m, off, h,
&pd, &a, &ruleset, NULL, inp);
#else
@@ -7445,7 +7445,7 @@
}
if ((s && s->tag) || r->rtableid >= 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag);
#else
pf_tag_packet(m, s ? s->tag : 0, r->rtableid);
@@ -7452,7 +7452,7 @@
#endif
if (dir == PF_IN && s && s->key[PF_SK_STACK])
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pd.pf_mtag->statekey = s->key[PF_SK_STACK];
#else
m->m_pkthdr.pf.statekey = s->key[PF_SK_STACK];
@@ -7460,7 +7460,7 @@
#ifdef ALTQ
if (action == PF_PASS && r->qid) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pd.tos & IPTOS_LOWDELAY)
pd.pf_mtag->qid = r->pqid;
else
@@ -7483,13 +7483,13 @@
(s->nat_rule.ptr->action == PF_RDR ||
s->nat_rule.ptr->action == PF_BINAT) &&
IN6_IS_ADDR_LOOPBACK(&pd.dst->v6))
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m->m_flags |= M_SKIP_FIREWALL;
#else
m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX: Anybody working on it?! */
if (r->divert.port)
printf("pf: divert(9) is not supported for IPv6\n");
@@ -7547,7 +7547,7 @@
}
tr = r;
nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (nr != NULL && r == &V_pf_default_rule)
#else
if (nr != NULL && r == &pf_default_rule)
@@ -7581,7 +7581,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
return (action);
@@ -7591,7 +7591,7 @@
int
pf_check_congestion(struct ifqueue *ifq)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX_IMPORT: later */
return (0);
#else
@@ -7609,7 +7609,7 @@
void
pf_pkt_addr_changed(struct mbuf *m)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_mtag *pf_tag;
if ((pf_tag = pf_find_mtag(m)) != NULL)
Modified: trunk/sys/contrib/pf/net/pf_if.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_if.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_if.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -32,7 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(__FreeBSD__)
+#if defined(__MidnightBSD__)
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -42,7 +42,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/malloc.h>
#endif
#include <sys/mbuf.h>
@@ -50,17 +50,17 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/device.h>
#endif
#include <sys/time.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/pool.h>
#endif
#include <net/if.h>
#include <net/if_types.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/vnet.h>
#endif
@@ -76,7 +76,7 @@
#include <netinet/ip6.h>
#endif /* INET6 */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(struct pfi_kif *, pfi_all);
VNET_DEFINE(uma_zone_t, pfi_addr_pl);
VNET_DEFINE(struct pfi_ifhead, pfi_ifs);
@@ -98,7 +98,7 @@
int pfi_buffer_cnt;
int pfi_buffer_max;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
eventhandler_tag pfi_attach_cookie;
eventhandler_tag pfi_detach_cookie;
eventhandler_tag pfi_attach_group_cookie;
@@ -117,7 +117,7 @@
int pfi_if_compare(struct pfi_kif *, struct pfi_kif *);
int pfi_skip_if(const char *, struct pfi_kif *);
int pfi_unmask(void *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void pfi_attach_ifnet_event(void * __unused, struct ifnet *);
void pfi_detach_ifnet_event(void * __unused, struct ifnet *);
void pfi_attach_group_event(void *, struct ifg_group *);
@@ -135,7 +135,7 @@
void
pfi_initialize(void)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pfi_all != NULL) /* already initialized */
#else
if (pfi_all != NULL) /* already initialized */
@@ -142,11 +142,11 @@
#endif
return;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
pool_init(&V_pfi_addr_pl, sizeof(struct pfi_dynaddr), 0, 0, 0,
"pfiaddrpl", &pool_allocator_nointr);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_buffer_max = 64;
V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*V_pfi_buffer),
PFI_MTYPE, M_WAITOK);
@@ -160,7 +160,7 @@
if ((pfi_all = pfi_kif_get(IFG_ALL)) == NULL)
#endif
panic("pfi_kif_get for pfi_all failed");
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ifg_group *ifg;
struct ifnet *ifp;
@@ -186,7 +186,7 @@
#endif
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void
pfi_cleanup(void)
{
@@ -224,7 +224,7 @@
bzero(&s, sizeof(s));
strlcpy(s.pfik_name, kif_name, sizeof(s.pfik_name));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((kif = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&s)) != NULL)
#else
if ((kif = RB_FIND(pfi_ifhead, &pfi_ifs, (struct pfi_kif *)&s)) != NULL)
@@ -232,7 +232,7 @@
return (kif);
/* create new one */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT | M_ZERO)) == NULL)
#else
if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_DONTWAIT|M_ZERO)) == NULL)
@@ -240,7 +240,7 @@
return (NULL);
strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* It seems that the value of time_second is in unintialzied state
* when pf sets interface statistics clear time in boot phase if pf
@@ -254,7 +254,7 @@
#endif
TAILQ_INIT(&kif->pfik_dynaddrs);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_INSERT(pfi_ifhead, &V_pfi_ifs, kif);
#else
RB_INSERT(pfi_ifhead, &pfi_ifs, kif);
@@ -305,7 +305,7 @@
panic("pfi_kif_unref with unknown type");
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (kif->pfik_ifp != NULL || kif->pfik_group != NULL || kif == V_pfi_all)
#else
if (kif->pfik_ifp != NULL || kif->pfik_group != NULL || kif == pfi_all)
@@ -315,7 +315,7 @@
if (kif->pfik_rules || kif->pfik_states)
return;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pfi_ifhead, &V_pfi_ifs, kif);
#else
RB_REMOVE(pfi_ifhead, &pfi_ifs, kif);
@@ -347,7 +347,7 @@
pfi_initialize();
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_update++;
#else
pfi_update++;
@@ -358,7 +358,7 @@
kif->pfik_ifp = ifp;
ifp->if_pf_kif = (caddr_t)kif;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
if ((kif->pfik_ah_cookie = hook_establish(ifp->if_addrhooks, 1,
pfi_kifaddr_update, kif)) == NULL)
panic("pfi_attach_ifnet: cannot allocate '%s' address hook",
@@ -380,12 +380,12 @@
return;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_update++;
#else
pfi_update++;
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
hook_disestablish(ifp->if_addrhooks, kif->pfik_ah_cookie);
#endif
pfi_kif_update(kif);
@@ -404,7 +404,7 @@
pfi_initialize();
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_update++;
#else
pfi_update++;
@@ -428,7 +428,7 @@
return;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_update++;
#else
pfi_update++;
@@ -447,7 +447,7 @@
int s;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_update++;
#else
pfi_update++;
@@ -505,7 +505,7 @@
if (aw->type != PF_ADDR_DYNIFTL)
return (0);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((dyn = pool_get(&V_pfi_addr_pl, PR_NOWAIT | PR_ZERO))
#else
if ((dyn = pool_get(&pfi_addr_pl, PR_WAITOK | PR_LIMITFAIL | PR_ZERO))
@@ -566,7 +566,7 @@
pf_remove_if_empty_ruleset(ruleset);
if (dyn->pfid_kif != NULL)
pfi_kif_unref(dyn->pfid_kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pfi_addr_pl, dyn);
#else
pool_put(&pfi_addr_pl, dyn);
@@ -604,7 +604,7 @@
kif = dyn->pfid_kif;
kt = dyn->pfid_kt;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (kt->pfrkt_larg != V_pfi_update) {
#else
if (kt->pfrkt_larg != pfi_update) {
@@ -611,7 +611,7 @@
#endif
/* this table needs to be brought up-to-date */
pfi_table_update(kt, kif, dyn->pfid_net, dyn->pfid_iflags);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
kt->pfrkt_larg = V_pfi_update;
#else
kt->pfrkt_larg = pfi_update;
@@ -626,7 +626,7 @@
int e, size2 = 0;
struct ifg_member *ifgm;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_buffer_cnt = 0;
#else
pfi_buffer_cnt = 0;
@@ -638,7 +638,7 @@
TAILQ_FOREACH(ifgm, &kif->pfik_group->ifg_members, ifgm_next)
pfi_instance_add(ifgm->ifgm_ifp, net, flags);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((e = pfr_set_addrs(&kt->pfrkt_t, V_pfi_buffer, V_pfi_buffer_cnt, &size2,
NULL, NULL, NULL, 0, PFR_TFLAG_ALLMASK)))
printf("pfi_table_update: cannot set %d new addresses "
@@ -666,7 +666,7 @@
af = ia->ifa_addr->sa_family;
if (af != AF_INET && af != AF_INET6)
continue;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* XXX: For point-to-point interfaces, (ifname:0) and IPv4,
* jump over addresses without a proper route to work
@@ -726,7 +726,7 @@
struct pfr_addr *p;
int i;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pfi_buffer_cnt >= V_pfi_buffer_max) {
int new_max = V_pfi_buffer_max * 2;
#else
@@ -736,7 +736,7 @@
if (new_max > PFI_BUFFER_MAX) {
printf("pfi_address_add: address buffer full (%d/%d)\n",
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_buffer_cnt, PFI_BUFFER_MAX);
#else
pfi_buffer_cnt, PFI_BUFFER_MAX);
@@ -744,7 +744,7 @@
return;
}
p = malloc(new_max * sizeof(*V_pfi_buffer), PFI_MTYPE,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
M_NOWAIT);
#else
M_DONTWAIT);
@@ -751,7 +751,7 @@
#endif
if (p == NULL) {
printf("pfi_address_add: no memory to grow buffer "
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
"(%d/%d)\n", V_pfi_buffer_cnt, PFI_BUFFER_MAX);
#else
"(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX);
@@ -758,7 +758,7 @@
#endif
return;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
memcpy(V_pfi_buffer, p, V_pfi_buffer_cnt * sizeof(*V_pfi_buffer));
/* no need to zero buffer */
free(V_pfi_buffer, PFI_MTYPE);
@@ -774,7 +774,7 @@
}
if (af == AF_INET && net > 32)
net = 128;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
p = V_pfi_buffer + V_pfi_buffer_cnt++;
#else
p = pfi_buffer + pfi_buffer_cnt++;
@@ -811,7 +811,7 @@
aw->p.dyn->pfid_kif = NULL;
pfr_detach_table(aw->p.dyn->pfid_kt);
aw->p.dyn->pfid_kt = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pfi_addr_pl, aw->p.dyn);
#else
pool_put(&pfi_addr_pl, aw->p.dyn);
@@ -836,7 +836,7 @@
struct pfi_kif *kif = (struct pfi_kif *)v;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfi_update++;
#else
pfi_update++;
@@ -862,7 +862,7 @@
strlcpy(key.pfik_name, name, sizeof(key.pfik_name));
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&key);
#else
p = RB_FIND(pfi_ifhead, &pfi_ifs, (struct pfi_kif *)&key);
@@ -914,12 +914,12 @@
{
struct pfi_kif *p, *nextp;
int s, n = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int error;
#endif
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
for (p = RB_MIN(pfi_ifhead, &V_pfi_ifs); p; p = nextp) {
nextp = RB_NEXT(pfi_ifhead, &V_pfi_ifs, p);
#else
@@ -932,7 +932,7 @@
if (!p->pfik_tzero)
p->pfik_tzero = time_second;
pfi_kif_ref(p, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYOUT(p, buf++, sizeof(*buf), error);
if (error) {
#else
@@ -942,7 +942,7 @@
splx(s);
return (EFAULT);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
nextp = RB_NEXT(pfi_ifhead, &V_pfi_ifs, p);
#else
nextp = RB_NEXT(pfi_ifhead, &pfi_ifs, p);
@@ -981,7 +981,7 @@
int s;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(p, pfi_ifhead, &V_pfi_ifs) {
#else
RB_FOREACH(p, pfi_ifhead, &pfi_ifs) {
@@ -1001,7 +1001,7 @@
int s;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(p, pfi_ifhead, &V_pfi_ifs) {
#else
RB_FOREACH(p, pfi_ifhead, &pfi_ifs) {
@@ -1034,7 +1034,7 @@
return (b);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void
pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp)
{
@@ -1107,4 +1107,4 @@
PF_UNLOCK();
CURVNET_RESTORE();
}
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
Modified: trunk/sys/contrib/pf/net/pf_ioctl.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_ioctl.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_ioctl.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -35,7 +35,7 @@
*
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/cdefs.h>
__MBSDID("$MidnightBSD$");
@@ -52,10 +52,10 @@
#define NPFLOG 0
#endif
-#else /* !__FreeBSD__ */
+#else /* !__MidnightBSD__ */
#include "pfsync.h"
#include "pflog.h"
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,7 +66,7 @@
#include <sys/socketvar.h>
#include <sys/kernel.h>
#include <sys/time.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/ucred.h>
#include <sys/jail.h>
#include <sys/module.h>
@@ -80,7 +80,7 @@
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/kthread.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/rwlock.h>
#include <uvm/uvm_extern.h>
#endif
@@ -87,7 +87,7 @@
#include <net/if.h>
#include <net/if_types.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/vnet.h>
#endif
#include <net/route.h>
@@ -99,7 +99,7 @@
#include <netinet/ip_var.h>
#include <netinet/ip_icmp.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/md5.h>
#else
#include <dev/rndvar.h>
@@ -122,14 +122,14 @@
#include <altq/altq.h>
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <net/pfil.h>
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void init_zone_var(void);
void cleanup_pf_zone(void);
int pfattach(void);
@@ -144,7 +144,7 @@
void pf_mv_pool(struct pf_palist *, struct pf_palist *);
void pf_empty_pool(struct pf_palist *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pfioctl(struct cdev *, u_long, caddr_t, int, struct thread *);
#else
int pfioctl(dev_t, u_long, caddr_t, int, struct proc *);
@@ -168,7 +168,7 @@
#define TAGID_MAX 50000
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(struct pf_rule, pf_default_rule);
VNET_DEFINE(struct sx, pf_consistency_lock);
@@ -184,7 +184,7 @@
#define V_pf_qids VNET(pf_qids)
VNET_DEFINE(struct pf_tags, pf_qids);
-#else /* !__FreeBSD__ */
+#else /* !__MidnightBSD__ */
struct pf_rule pf_default_rule;
struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk");
#ifdef ALTQ
@@ -193,7 +193,7 @@
TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags),
pf_qids = TAILQ_HEAD_INITIALIZER(pf_qids);
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE)
#error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE
@@ -206,13 +206,13 @@
void pf_rtlabel_remove(struct pf_addr_wrap *);
void pf_rtlabel_copyout(struct pf_addr_wrap *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x
#else
#define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct cdev *pf_dev;
/*
@@ -429,7 +429,7 @@
return (error);
}
-#else /* !__FreeBSD__ */
+#else /* !__MidnightBSD__ */
void
pfattach(int num)
@@ -599,7 +599,7 @@
pf_tbladdr_remove(&empty_pool_pa->addr);
pfi_kif_unref(empty_pool_pa->kif, PFI_KIF_REF_RULE);
TAILQ_REMOVE(poola, empty_pool_pa, entries);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, empty_pool_pa);
#else
pool_put(&pf_pooladdr_pl, empty_pool_pa);
@@ -650,7 +650,7 @@
pfi_kif_unref(rule->kif, PFI_KIF_REF_RULE);
pf_anchor_remove(rule);
pf_empty_pool(&rule->rpool.list);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -735,7 +735,7 @@
u_int16_t
pf_tagname2tag(char *tagname)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
return (tagname2tag(&V_pf_tags, tagname));
#else
return (tagname2tag(&pf_tags, tagname));
@@ -745,7 +745,7 @@
void
pf_tag2tagname(u_int16_t tagid, char *p)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
tag2tagname(&V_pf_tags, tagid, p);
#else
tag2tagname(&pf_tags, tagid, p);
@@ -757,7 +757,7 @@
{
struct pf_tagname *t;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(t, &V_pf_tags, entries)
#else
TAILQ_FOREACH(t, &pf_tags, entries)
@@ -771,7 +771,7 @@
void
pf_tag_unref(u_int16_t tag)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
tag_unref(&V_pf_tags, tag);
#else
tag_unref(&pf_tags, tag);
@@ -781,7 +781,7 @@
int
pf_rtlabel_add(struct pf_addr_wrap *a)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX_IMPORT: later */
return (0);
#else
@@ -795,7 +795,7 @@
void
pf_rtlabel_remove(struct pf_addr_wrap *a)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX_IMPORT: later */
#else
if (a->type == PF_ADDR_RTLABEL)
@@ -806,7 +806,7 @@
void
pf_rtlabel_copyout(struct pf_addr_wrap *a)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* XXX_IMPORT: later */
if (a->type == PF_ADDR_RTLABEL && a->v.rtlabel)
strlcpy(a->v.rtlabelname, "?", sizeof(a->v.rtlabelname));
@@ -828,7 +828,7 @@
u_int32_t
pf_qname2qid(char *qname)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
return ((u_int32_t)tagname2tag(&V_pf_qids, qname));
#else
return ((u_int32_t)tagname2tag(&pf_qids, qname));
@@ -838,7 +838,7 @@
void
pf_qid2qname(u_int32_t qid, char *p)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
tag2tagname(&V_pf_qids, (u_int16_t)qid, p);
#else
tag2tagname(&pf_qids, (u_int16_t)qid, p);
@@ -848,7 +848,7 @@
void
pf_qid_unref(u_int32_t qid)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
tag_unref(&V_pf_qids, (u_int16_t)qid);
#else
tag_unref(&pf_qids, (u_int16_t)qid);
@@ -862,7 +862,7 @@
int error = 0;
/* Purge the old altq list */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
while ((altq = TAILQ_FIRST(V_pf_altqs_inactive)) != NULL) {
TAILQ_REMOVE(V_pf_altqs_inactive, altq, entries);
if (altq->qname[0] == 0 &&
@@ -876,7 +876,7 @@
error = altq_remove(altq);
} else
pf_qid_unref(altq->qid);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -884,7 +884,7 @@
}
if (error)
return (error);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*ticket = ++V_ticket_altqs_inactive;
V_altqs_inactive_open = 1;
#else
@@ -900,7 +900,7 @@
struct pf_altq *altq;
int error = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!V_altqs_inactive_open || ticket != V_ticket_altqs_inactive)
return (0);
/* Purge the old altq list */
@@ -920,13 +920,13 @@
error = altq_remove(altq);
} else
pf_qid_unref(altq->qid);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
#endif
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_altqs_inactive_open = 0;
#else
altqs_inactive_open = 0;
@@ -941,7 +941,7 @@
struct pf_altq *altq;
int s, err, error = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!V_altqs_inactive_open || ticket != V_ticket_altqs_inactive)
#else
if (!altqs_inactive_open || ticket != ticket_altqs_inactive)
@@ -950,7 +950,7 @@
/* swap altqs, keep the old. */
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
old_altqs = V_pf_altqs_active;
V_pf_altqs_active = V_pf_altqs_inactive;
V_pf_altqs_inactive = old_altqs;
@@ -963,7 +963,7 @@
#endif
/* Attach new disciplines */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(altq, V_pf_altqs_active, entries) {
if (altq->qname[0] == 0 &&
(altq->local_flags & PFALTQ_FLAG_IF_REMOVED) == 0) {
@@ -973,7 +973,7 @@
#endif
/* attach the discipline */
error = altq_pfattach(altq);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (error == 0 && V_pf_altq_running)
#else
if (error == 0 && pf_altq_running)
@@ -987,7 +987,7 @@
}
/* Purge the old altq list */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
while ((altq = TAILQ_FIRST(V_pf_altqs_inactive)) != NULL) {
TAILQ_REMOVE(V_pf_altqs_inactive, altq, entries);
if (altq->qname[0] == 0 &&
@@ -998,7 +998,7 @@
if (altq->qname[0] == 0) {
#endif
/* detach and destroy the discipline */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_altq_running)
#else
if (pf_altq_running)
@@ -1012,7 +1012,7 @@
error = err;
} else
pf_qid_unref(altq->qid);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -1020,7 +1020,7 @@
}
splx(s);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_altqs_inactive_open = 0;
#else
altqs_inactive_open = 0;
@@ -1046,11 +1046,11 @@
tb.rate = altq->ifbandwidth;
tb.depth = altq->tbrsize;
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
error = tbr_set(&ifp->if_snd, &tb);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
splx(s);
@@ -1082,11 +1082,11 @@
/* clear tokenbucket regulator */
tb.rate = 0;
s = splnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
error = tbr_set(&ifp->if_snd, &tb);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
splx(s);
@@ -1095,7 +1095,7 @@
return (error);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void
pf_altq_ifnet_event(struct ifnet *ifp, int remove)
{
@@ -1105,7 +1105,7 @@
int error = 0;
/* Interrupt userland queue modifications */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_altqs_inactive_open)
pf_rollback_altq(V_ticket_altqs_inactive);
#else
@@ -1118,7 +1118,7 @@
return;
/* Copy the current active set */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(a1, V_pf_altqs_active, entries) {
a2 = pool_get(&V_pf_altq_pl, PR_NOWAIT);
#else
@@ -1134,7 +1134,7 @@
if (a2->qname[0] != 0) {
if ((a2->qid = pf_qname2qid(a2->qname)) == 0) {
error = EBUSY;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, a2);
#else
pool_put(&pf_altq_pl, a2);
@@ -1142,7 +1142,7 @@
break;
}
a2->altq_disc = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(a3, V_pf_altqs_inactive, entries) {
#else
TAILQ_FOREACH(a3, pf_altqs_inactive, entries) {
@@ -1164,7 +1164,7 @@
error = altq_add(a2);
PF_LOCK();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (ticket != V_ticket_altqs_inactive)
#else
if (ticket != ticket_altqs_inactive)
@@ -1172,7 +1172,7 @@
error = EBUSY;
if (error) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, a2);
#else
pool_put(&pf_altq_pl, a2);
@@ -1181,7 +1181,7 @@
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_INSERT_TAIL(V_pf_altqs_inactive, a2, entries);
#else
TAILQ_INSERT_TAIL(pf_altqs_inactive, a2, entries);
@@ -1412,7 +1412,7 @@
}
MD5Final(digest, &ctx);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
memcpy(V_pf_status.pf_chksum, digest, sizeof(V_pf_status.pf_chksum));
#else
memcpy(pf_status.pf_chksum, digest, sizeof(pf_status.pf_chksum));
@@ -1440,7 +1440,7 @@
}
int
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
#else
pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
@@ -1448,7 +1448,7 @@
{
struct pf_pooladdr *pa = NULL;
struct pf_pool *pool = NULL;
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
int s;
#endif
int error = 0;
@@ -1456,7 +1456,7 @@
CURVNET_SET(TD_TO_VNET(td));
/* XXX keep in sync with switch() below */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (securelevel_gt(td->td_ucred, 2))
#else
if (securelevel > 1)
@@ -1496,7 +1496,7 @@
case DIOCGETSRCNODES:
case DIOCCLRSRCNODES:
case DIOCIGETIFACES:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
case DIOCGIFSPEED:
#endif
case DIOCSETIFFLAG:
@@ -1538,7 +1538,7 @@
case DIOCOSFPGET:
case DIOCGETSRCNODES:
case DIOCIGETIFACES:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
case DIOCGIFSPEED:
#endif
break;
@@ -1567,7 +1567,7 @@
}
if (flags & FWRITE)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
sx_xlock(&V_pf_consistency_lock);
else
sx_slock(&V_pf_consistency_lock);
@@ -1577,7 +1577,7 @@
rw_enter_read(&pf_consistency_lock);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#else
s = splsoftnet();
@@ -1585,7 +1585,7 @@
switch (cmd) {
case DIOCSTART:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.running)
#else
if (pf_status.running)
@@ -1592,7 +1592,7 @@
#endif
error = EEXIST;
else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
error = hook_pf();
PF_LOCK();
@@ -1622,7 +1622,7 @@
break;
case DIOCSTOP:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!V_pf_status.running)
error = ENOENT;
else {
@@ -1670,7 +1670,7 @@
break;
}
if (pr->ticket != ruleset->rules[rs_num].inactive.ticket) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
DPFPRINTF(PF_DEBUG_MISC,
("ticket: %d != [%d]%d\n", pr->ticket, rs_num,
ruleset->rules[rs_num].inactive.ticket));
@@ -1678,7 +1678,7 @@
error = EBUSY;
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pr->pool_ticket != V_ticket_pabuf) {
DPFPRINTF(PF_DEBUG_MISC,
("pool_ticket: %d != %d\n", pr->pool_ticket,
@@ -1689,7 +1689,7 @@
error = EBUSY;
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rule = pool_get(&V_pf_rule_pl, PR_NOWAIT);
#else
rule = pool_get(&pf_rule_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -1699,7 +1699,7 @@
break;
}
bcopy(&pr->rule, rule, sizeof(struct pf_rule));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rule->cuid = td->td_ucred->cr_ruid;
rule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
#else
@@ -1715,7 +1715,7 @@
rule->entries.tqe_prev = NULL;
#ifndef INET
if (rule->af == AF_INET) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -1726,7 +1726,7 @@
#endif /* INET */
#ifndef INET6
if (rule->af == AF_INET6) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -1744,7 +1744,7 @@
if (rule->ifname[0]) {
rule->kif = pfi_kif_get(rule->ifname);
if (rule->kif == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -1755,7 +1755,7 @@
pfi_kif_ref(rule->kif, PFI_KIF_REF_RULE);
}
-#ifdef __FreeBSD__ /* ROUTING */
+#ifdef __MidnightBSD__ /* ROUTING */
if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs)
#else
if (rule->rtableid > 0 && !rtable_exists(rule->rtableid))
@@ -1799,7 +1799,7 @@
error = EINVAL;
if (pf_anchor_setup(rule, ruleset, pr->anchor_call))
error = EINVAL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(pa, &V_pf_pabuf, entries)
#else
TAILQ_FOREACH(pa, &pf_pabuf, entries)
@@ -1816,7 +1816,7 @@
PFR_TFLAG_ACTIVE;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_mv_pool(&V_pf_pabuf, &rule->rpool.list);
#else
pf_mv_pool(&pf_pabuf, &rule->rpool.list);
@@ -1832,7 +1832,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!V_debug_pfugidhack && (rule->uid.op || rule->gid.op ||
rule->log & PF_LOG_SOCKET_LOOKUP)) {
DPFPRINTF(PF_DEBUG_MISC,
@@ -1936,7 +1936,7 @@
if (!(pcr->action == PF_CHANGE_REMOVE ||
pcr->action == PF_CHANGE_GET_TICKET) &&
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pcr->pool_ticket != V_ticket_pabuf) {
#else
pcr->pool_ticket != ticket_pabuf) {
@@ -1977,7 +1977,7 @@
}
if (pcr->action != PF_CHANGE_REMOVE) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
newrule = pool_get(&V_pf_rule_pl, PR_NOWAIT);
#else
newrule = pool_get(&pf_rule_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -1987,7 +1987,7 @@
break;
}
bcopy(&pcr->rule, newrule, sizeof(struct pf_rule));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
newrule->cuid = td->td_ucred->cr_ruid;
newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
#else
@@ -2000,7 +2000,7 @@
newrule->entries.tqe_prev = NULL;
#ifndef INET
if (newrule->af == AF_INET) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, newrule);
#else
pool_put(&pf_rule_pl, newrule);
@@ -2011,7 +2011,7 @@
#endif /* INET */
#ifndef INET6
if (newrule->af == AF_INET6) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, newrule);
#else
pool_put(&pf_rule_pl, newrule);
@@ -2023,7 +2023,7 @@
if (newrule->ifname[0]) {
newrule->kif = pfi_kif_get(newrule->ifname);
if (newrule->kif == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_rule_pl, newrule);
#else
pool_put(&pf_rule_pl, newrule);
@@ -2036,7 +2036,7 @@
newrule->kif = NULL;
if (newrule->rtableid > 0 &&
-#ifdef __FreeBSD__ /* ROUTING */
+#ifdef __MidnightBSD__ /* ROUTING */
newrule->rtableid >= rt_numfibs)
#else
!rtable_exists(newrule->rtableid))
@@ -2082,7 +2082,7 @@
error = EINVAL;
if (pf_anchor_setup(newrule, ruleset, pcr->anchor_call))
error = EINVAL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(pa, &V_pf_pabuf, entries)
#else
TAILQ_FOREACH(pa, &pf_pabuf, entries)
@@ -2100,7 +2100,7 @@
PFR_TFLAG_ACTIVE;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_mv_pool(&V_pf_pabuf, &newrule->rpool.list);
#else
pf_mv_pool(&pf_pabuf, &newrule->rpool.list);
@@ -2118,7 +2118,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!V_debug_pfugidhack && (newrule->uid.op ||
newrule->gid.op ||
newrule->log & PF_LOG_SOCKET_LOOKUP)) {
@@ -2133,7 +2133,7 @@
newrule->packets[0] = newrule->packets[1] = 0;
newrule->bytes[0] = newrule->bytes[1] = 0;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_empty_pool(&V_pf_pabuf);
#else
pf_empty_pool(&pf_pabuf);
@@ -2194,7 +2194,7 @@
struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr;
u_int killed = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
for (s = RB_MIN(pf_state_tree_id, &V_tree_id); s; s = nexts) {
nexts = RB_NEXT(pf_state_tree_id, &V_tree_id, s);
#else
@@ -2214,7 +2214,7 @@
}
psk->psk_killed = killed;
#if NPFSYNC > 0
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_clear_states_ptr != NULL)
pfsync_clear_states_ptr(V_pf_status.hostid, psk->psk_ifname);
#else
@@ -2234,7 +2234,7 @@
if (psk->psk_pfcmp.id) {
if (psk->psk_pfcmp.creatorid == 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
psk->psk_pfcmp.creatorid = V_pf_status.hostid;
#else
psk->psk_pfcmp.creatorid = pf_status.hostid;
@@ -2246,7 +2246,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
for (s = RB_MIN(pf_state_tree_id, &V_tree_id); s;
s = nexts) {
nexts = RB_NEXT(pf_state_tree_id, &V_tree_id, s);
@@ -2308,7 +2308,7 @@
error = EINVAL;
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pfsync_state_import_ptr != NULL)
error = pfsync_state_import_ptr(sp, PFSYNC_SI_IOCTL);
#else
@@ -2342,7 +2342,7 @@
u_int32_t nr = 0;
if (ps->ps_len == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
nr = V_pf_status.states;
#else
nr = pf_status.states;
@@ -2351,17 +2351,17 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
pstore = malloc(sizeof(*pstore), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
p = ps->ps_states;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
state = TAILQ_FIRST(&V_state_list);
#else
state = TAILQ_FIRST(&state_list);
@@ -2371,7 +2371,7 @@
if ((nr+1) * sizeof(*p) > (unsigned)ps->ps_len)
break;
pfsync_state_export(pstore, state);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYOUT(pstore, p, sizeof(*p), error);
#else
error = copyout(pstore, p, sizeof(*p));
@@ -2394,7 +2394,7 @@
case DIOCGETSTATUS: {
struct pf_status *s = (struct pf_status *)addr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bcopy(&V_pf_status, s, sizeof(struct pf_status));
#else
bcopy(&pf_status, s, sizeof(struct pf_status));
@@ -2407,7 +2407,7 @@
struct pfioc_if *pi = (struct pfioc_if *)addr;
if (pi->ifname[0] == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bzero(V_pf_status.ifname, IFNAMSIZ);
#else
bzero(pf_status.ifname, IFNAMSIZ);
@@ -2414,7 +2414,7 @@
#endif
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
strlcpy(V_pf_status.ifname, pi->ifname, IFNAMSIZ);
#else
strlcpy(pf_status.ifname, pi->ifname, IFNAMSIZ);
@@ -2423,7 +2423,7 @@
}
case DIOCCLRSTATUS: {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bzero(V_pf_status.counters, sizeof(V_pf_status.counters));
bzero(V_pf_status.fcounters, sizeof(V_pf_status.fcounters));
bzero(V_pf_status.scounters, sizeof(V_pf_status.scounters));
@@ -2493,7 +2493,7 @@
error = EINVAL;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
old = V_pf_default_rule.timeout[pt->timeout];
#else
old = pf_default_rule.timeout[pt->timeout];
@@ -2500,7 +2500,7 @@
#endif
if (pt->timeout == PFTM_INTERVAL && pt->seconds == 0)
pt->seconds = 1;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_default_rule.timeout[pt->timeout] = pt->seconds;
#else
pf_default_rule.timeout[pt->timeout] = pt->seconds;
@@ -2518,7 +2518,7 @@
error = EINVAL;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pt->seconds = V_pf_default_rule.timeout[pt->timeout];
#else
pt->seconds = pf_default_rule.timeout[pt->timeout];
@@ -2533,7 +2533,7 @@
error = EINVAL;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pl->limit = V_pf_pool_limits[pl->index].limit;
#else
pl->limit = pf_pool_limits[pl->index].limit;
@@ -2546,7 +2546,7 @@
int old_limit;
if (pl->index < 0 || pl->index >= PF_LIMIT_MAX ||
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_pool_limits[pl->index].pp == NULL) {
#else
pf_pool_limits[pl->index].pp == NULL) {
@@ -2554,7 +2554,7 @@
error = EINVAL;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
uma_zone_set_max(V_pf_pool_limits[pl->index].pp, pl->limit);
old_limit = V_pf_pool_limits[pl->index].limit;
V_pf_pool_limits[pl->index].limit = pl->limit;
@@ -2575,7 +2575,7 @@
case DIOCSETDEBUG: {
u_int32_t *level = (u_int32_t *)addr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.debug = *level;
#else
pf_status.debug = *level;
@@ -2597,7 +2597,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
case DIOCGIFSPEED: {
struct pf_ifspeed *psp = (struct pf_ifspeed *)addr;
struct pf_ifspeed ps;
@@ -2615,7 +2615,7 @@
error = EINVAL;
break;
}
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#ifdef ALTQ
case DIOCSTARTALTQ: {
@@ -2622,7 +2622,7 @@
struct pf_altq *altq;
/* enable all altq interfaces on active list */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(altq, V_pf_altqs_active, entries) {
if (altq->qname[0] == 0 && (altq->local_flags &
PFALTQ_FLAG_IF_REMOVED) == 0) {
@@ -2636,7 +2636,7 @@
}
}
if (error == 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_altq_running = 1;
#else
pf_altq_running = 1;
@@ -2649,7 +2649,7 @@
struct pf_altq *altq;
/* disable all altq interfaces on active list */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(altq, V_pf_altqs_active, entries) {
if (altq->qname[0] == 0 && (altq->local_flags &
PFALTQ_FLAG_IF_REMOVED) == 0) {
@@ -2663,7 +2663,7 @@
}
}
if (error == 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_altq_running = 0;
#else
pf_altq_running = 0;
@@ -2676,7 +2676,7 @@
struct pfioc_altq *pa = (struct pfioc_altq *)addr;
struct pf_altq *altq, *a;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pa->ticket != V_ticket_altqs_inactive) {
#else
if (pa->ticket != ticket_altqs_inactive) {
@@ -2684,7 +2684,7 @@
error = EBUSY;
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
altq = pool_get(&V_pf_altq_pl, PR_NOWAIT);
#else
altq = pool_get(&pf_altq_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -2694,7 +2694,7 @@
break;
}
bcopy(&pa->altq, altq, sizeof(struct pf_altq));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
altq->local_flags = 0;
#endif
@@ -2705,7 +2705,7 @@
if (altq->qname[0] != 0) {
if ((altq->qid = pf_qname2qid(altq->qname)) == 0) {
error = EBUSY;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -2713,7 +2713,7 @@
break;
}
altq->altq_disc = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(a, V_pf_altqs_inactive, entries) {
#else
TAILQ_FOREACH(a, pf_altqs_inactive, entries) {
@@ -2726,7 +2726,7 @@
}
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct ifnet *ifp;
if ((ifp = ifunit(altq->ifname)) == NULL) {
@@ -2735,12 +2735,12 @@
PF_UNLOCK();
#endif
error = altq_add(altq);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
}
#endif
if (error) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -2748,7 +2748,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_INSERT_TAIL(V_pf_altqs_inactive, altq, entries);
#else
TAILQ_INSERT_TAIL(pf_altqs_inactive, altq, entries);
@@ -2762,7 +2762,7 @@
struct pf_altq *altq;
pa->nr = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_FOREACH(altq, V_pf_altqs_active, entries)
pa->nr++;
pa->ticket = V_ticket_altqs_active;
@@ -2779,7 +2779,7 @@
struct pf_altq *altq;
u_int32_t nr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pa->ticket != V_ticket_altqs_active) {
#else
if (pa->ticket != ticket_altqs_active) {
@@ -2788,7 +2788,7 @@
break;
}
nr = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
altq = TAILQ_FIRST(V_pf_altqs_active);
#else
altq = TAILQ_FIRST(pf_altqs_active);
@@ -2816,7 +2816,7 @@
u_int32_t nr;
int nbytes;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pq->ticket != V_ticket_altqs_active) {
#else
if (pq->ticket != ticket_altqs_active) {
@@ -2826,7 +2826,7 @@
}
nbytes = pq->nbytes;
nr = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
altq = TAILQ_FIRST(V_pf_altqs_active);
#else
altq = TAILQ_FIRST(pf_altqs_active);
@@ -2840,7 +2840,7 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((altq->local_flags & PFALTQ_FLAG_IF_REMOVED) != 0) {
error = ENXIO;
break;
@@ -2848,7 +2848,7 @@
PF_UNLOCK();
#endif
error = altq_getqstats(altq, pq->buf, &nbytes);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
if (error == 0) {
@@ -2862,7 +2862,7 @@
case DIOCBEGINADDRS: {
struct pfioc_pooladdr *pp = (struct pfioc_pooladdr *)addr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_empty_pool(&V_pf_pabuf);
pp->ticket = ++V_ticket_pabuf;
#else
@@ -2875,7 +2875,7 @@
case DIOCADDADDR: {
struct pfioc_pooladdr *pp = (struct pfioc_pooladdr *)addr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pp->ticket != V_ticket_pabuf) {
#else
if (pp->ticket != ticket_pabuf) {
@@ -2901,7 +2901,7 @@
error = EINVAL;
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pa = pool_get(&V_pf_pooladdr_pl, PR_NOWAIT);
#else
pa = pool_get(&pf_pooladdr_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -2914,7 +2914,7 @@
if (pa->ifname[0]) {
pa->kif = pfi_kif_get(pa->ifname);
if (pa->kif == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, pa);
#else
pool_put(&pf_pooladdr_pl, pa);
@@ -2927,7 +2927,7 @@
if (pfi_dynaddr_setup(&pa->addr, pp->af)) {
pfi_dynaddr_remove(&pa->addr);
pfi_kif_unref(pa->kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, pa);
#else
pool_put(&pf_pooladdr_pl, pa);
@@ -2935,7 +2935,7 @@
error = EINVAL;
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_INSERT_TAIL(&V_pf_pabuf, pa, entries);
#else
TAILQ_INSERT_TAIL(&pf_pabuf, pa, entries);
@@ -3011,7 +3011,7 @@
break;
}
if (pca->action != PF_CHANGE_REMOVE) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
newpa = pool_get(&V_pf_pooladdr_pl,
PR_NOWAIT);
#else
@@ -3025,7 +3025,7 @@
bcopy(&pca->addr, newpa, sizeof(struct pf_pooladdr));
#ifndef INET
if (pca->af == AF_INET) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -3036,7 +3036,7 @@
#endif /* INET */
#ifndef INET6
if (pca->af == AF_INET6) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -3048,7 +3048,7 @@
if (newpa->ifname[0]) {
newpa->kif = pfi_kif_get(newpa->ifname);
if (newpa->kif == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -3063,7 +3063,7 @@
pf_tbladdr_setup(ruleset, &newpa->addr)) {
pfi_dynaddr_remove(&newpa->addr);
pfi_kif_unref(newpa->kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -3096,7 +3096,7 @@
pfi_dynaddr_remove(&oldpa->addr);
pf_tbladdr_remove(&oldpa->addr);
pfi_kif_unref(oldpa->kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_pooladdr_pl, oldpa);
#else
pool_put(&pf_pooladdr_pl, oldpa);
@@ -3131,7 +3131,7 @@
pr->nr = 0;
if (ruleset->anchor == NULL) {
/* XXX kludge for pf_main_ruleset */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(anchor, pf_anchor_global, &V_pf_anchors)
#else
RB_FOREACH(anchor, pf_anchor_global, &pf_anchors)
@@ -3160,7 +3160,7 @@
pr->name[0] = 0;
if (ruleset->anchor == NULL) {
/* XXX kludge for pf_main_ruleset */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(anchor, pf_anchor_global, &V_pf_anchors)
#else
RB_FOREACH(anchor, pf_anchor_global, &pf_anchors)
@@ -3406,16 +3406,16 @@
error = ENODEV;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -3462,7 +3462,7 @@
}
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYOUT(ioe, io->array+i, sizeof(io->array[i]),
error);
if (error) {
@@ -3490,16 +3490,16 @@
error = ENODEV;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -3563,17 +3563,17 @@
error = ENODEV;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
/* first makes sure everything will succeed */
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -3593,7 +3593,7 @@
error = EINVAL;
goto fail;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (!V_altqs_inactive_open || ioe->ticket !=
V_ticket_altqs_inactive) {
#else
@@ -3640,7 +3640,7 @@
}
/* now do the commit - no errors should happen here */
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -3694,7 +3694,7 @@
int space = psn->psn_len;
if (space == 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking)
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking)
@@ -3704,15 +3704,15 @@
break;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
#endif
pstore = malloc(sizeof(*pstore), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK();
#endif
p = psn->psn_src_nodes;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
@@ -3740,7 +3740,7 @@
n->conn_rate.count * diff /
n->conn_rate.seconds;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_COPYOUT(pstore, p, sizeof(*p), error);
#else
error = copyout(pstore, p, sizeof(*p));
@@ -3762,7 +3762,7 @@
struct pf_src_node *n;
struct pf_state *state;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(state, pf_state_tree_id, &V_tree_id) {
#else
RB_FOREACH(state, pf_state_tree_id, &tree_id) {
@@ -3770,7 +3770,7 @@
state->src_node = NULL;
state->nat_src_node = NULL;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
@@ -3779,7 +3779,7 @@
n->states = 0;
}
pf_purge_expired_src_nodes(1);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.src_nodes = 0;
#else
pf_status.src_nodes = 0;
@@ -3794,7 +3794,7 @@
(struct pfioc_src_node_kill *)addr;
u_int killed = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(sn, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(sn, pf_src_tree, &tree_src_tracking) {
@@ -3810,7 +3810,7 @@
/* Handle state to src_node linkage */
if (sn->states != 0) {
RB_FOREACH(s, pf_state_tree_id,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
&V_tree_id) {
#else
&tree_id) {
@@ -3837,7 +3837,7 @@
case DIOCSETHOSTID: {
u_int32_t *hostid = (u_int32_t *)addr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (*hostid == 0)
V_pf_status.hostid = arc4random();
else
@@ -3886,7 +3886,7 @@
break;
}
fail:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_UNLOCK();
if (flags & FWRITE)
@@ -3906,7 +3906,7 @@
return (error);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void
pfsync_state_export(struct pfsync_state *sp, struct pf_state *st)
{
@@ -3976,7 +3976,7 @@
{
struct pf_state *state;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(state, pf_state_tree_id, &V_tree_id) {
#else
RB_FOREACH(state, pf_state_tree_id, &tree_id) {
@@ -4017,7 +4017,7 @@
struct pf_src_node *n;
struct pf_state *state;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(state, pf_state_tree_id, &V_tree_id) {
#else
RB_FOREACH(state, pf_state_tree_id, &tree_id) {
@@ -4025,7 +4025,7 @@
state->src_node = NULL;
state->nat_src_node = NULL;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
@@ -4417,4 +4417,4 @@
DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_FIRST);
MODULE_VERSION(pf, PF_MODVER);
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
Modified: trunk/sys/contrib/pf/net/pf_lb.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_lb.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_lb.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -35,7 +35,7 @@
*
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -43,7 +43,7 @@
__MBSDID("$MidnightBSD$");
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_bpf.h"
#include "opt_pf.h"
@@ -86,14 +86,14 @@
#include <sys/socketvar.h>
#include <sys/kernel.h>
#include <sys/time.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/sysctl.h>
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/pool.h>
#endif
#include <sys/proc.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/sx.h>
@@ -101,7 +101,7 @@
#include <sys/rwlock.h>
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/md5.h>
#else
#include <crypto/md5.h>
@@ -129,7 +129,7 @@
#include <netinet/icmp_var.h>
#include <netinet/if_ether.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <dev/rndvar.h>
#endif
#include <net/pfvar.h>
@@ -148,7 +148,7 @@
#endif /* INET6 */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x
#else
#define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x
@@ -279,7 +279,7 @@
!pf_match_port(dst->port_op, dst->port[0],
dst->port[1], dport))
r = r->skip[PF_SKIP_DST_PORT].ptr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
else if (r->match_tag && !pf_match_tag(m, r, &tag, pd->pf_mtag))
#else
else if (r->match_tag && !pf_match_tag(m, r, &tag))
@@ -304,7 +304,7 @@
pf_step_out_of_anchor(&asd, &ruleset, rs_num, &r,
NULL, NULL);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (pf_tag_packet(m, tag, rtableid, pd->pf_mtag))
#else
if (pf_tag_packet(m, tag, rtableid))
@@ -370,7 +370,7 @@
high = tmp;
}
/* low < high */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
cut = htonl(arc4random()) % (1 + high - low) + low;
#else
cut = arc4random_uniform(1 + high - low) + low;
@@ -379,7 +379,7 @@
for (tmp = cut; tmp <= high; ++(tmp)) {
key.port[0] = htons(tmp);
if (pf_find_state_all(&key, PF_IN, NULL) ==
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
NULL) {
#else
NULL && !in_baddynamic(tmp, proto)) {
@@ -391,7 +391,7 @@
for (tmp = cut - 1; tmp >= low; --(tmp)) {
key.port[0] = htons(tmp);
if (pf_find_state_all(&key, PF_IN, NULL) ==
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
NULL) {
#else
NULL && !in_baddynamic(tmp, proto)) {
@@ -438,7 +438,7 @@
k.rule.ptr = r;
else
k.rule.ptr = NULL;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_status.scounters[SCNT_SRC_NODE_SEARCH]++;
*sn = RB_FIND(pf_src_tree, &V_tree_src_tracking, &k);
#else
@@ -447,7 +447,7 @@
#endif
if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) {
PF_ACPY(naddr, &(*sn)->raddr, af);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -598,7 +598,7 @@
if (*sn != NULL)
PF_ACPY(&(*sn)->raddr, naddr, af);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC &&
#else
if (pf_status.debug >= PF_DEBUG_MISC &&
@@ -776,7 +776,7 @@
* Pretend there was no match.
*/
if (!bcmp(*skp, *nkp, sizeof(struct pf_state_key_cmp))) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_state_key_pl, *nkp);
pool_put(&V_pf_state_key_pl, *skp);
#else
Modified: trunk/sys/contrib/pf/net/pf_norm.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_norm.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_norm.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_pf.h"
@@ -50,7 +50,7 @@
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/time.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/pool.h>
#include <dev/rndvar.h>
@@ -77,7 +77,7 @@
#include <net/pfvar.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
struct pf_frent {
LIST_ENTRY(pf_frent) fr_next;
struct ip *fr_ip;
@@ -96,7 +96,7 @@
#define PFFRAG_DROP 0x0004 /* Drop all fragments */
#define BUFFER_FRAGMENTS(fr) (!((fr)->fr_flags & PFFRAG_NOBUFFER))
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
struct pf_fragment {
RB_ENTRY(pf_fragment) fr_entry;
TAILQ_ENTRY(pf_fragment) frag_next;
@@ -116,7 +116,7 @@
};
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_HEAD(pf_fragqueue, pf_fragment);
TAILQ_HEAD(pf_cachequeue, pf_fragment);
VNET_DEFINE(struct pf_fragqueue, pf_fragqueue);
@@ -128,7 +128,7 @@
TAILQ_HEAD(pf_cachequeue, pf_fragment) pf_cachequeue;
#endif
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
static __inline int pf_frag_compare(struct pf_fragment *,
struct pf_fragment *);
#else
@@ -136,7 +136,7 @@
struct pf_fragment *);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_HEAD(pf_frag_tree, pf_fragment);
VNET_DEFINE(struct pf_frag_tree, pf_frag_tree);
#define V_pf_frag_tree VNET(pf_frag_tree)
@@ -165,7 +165,7 @@
#ifdef INET6
void pf_scrub_ip6(struct mbuf **, u_int8_t);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define DPFPRINTF(x) do { \
if (V_pf_status.debug >= PF_DEBUG_MISC) { \
printf("%s: ", __func__); \
@@ -182,7 +182,7 @@
#endif
/* Globals */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(uma_zone_t, pf_frent_pl);
VNET_DEFINE(uma_zone_t, pf_frag_pl);
VNET_DEFINE(uma_zone_t, pf_cache_pl);
@@ -202,7 +202,7 @@
void
pf_normalize_init(void)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/*
* XXX
* No high water mark support(It's hint not hard limit).
@@ -229,7 +229,7 @@
pool_sethardlimit(&pf_cent_pl, PFFRAG_FRCENT_HIWAT, NULL, 0);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_INIT(&V_pf_fragqueue);
TAILQ_INIT(&V_pf_cachequeue);
#else
@@ -238,7 +238,7 @@
#endif
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static int
#else
static __inline int
@@ -266,7 +266,7 @@
pf_purge_expired_fragments(void)
{
struct pf_fragment *frag;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int32_t expire = time_second -
V_pf_default_rule.timeout[PFTM_FRAG];
#else
@@ -274,7 +274,7 @@
pf_default_rule.timeout[PFTM_FRAG];
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
while ((frag = TAILQ_LAST(&V_pf_fragqueue, pf_fragqueue)) != NULL) {
KASSERT((BUFFER_FRAGMENTS(frag)),
("BUFFER_FRAGMENTS(frag) == 0: %s", __FUNCTION__));
@@ -289,7 +289,7 @@
pf_free_fragment(frag);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
while ((frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue)) != NULL) {
KASSERT((!BUFFER_FRAGMENTS(frag)),
("BUFFER_FRAGMENTS(frag) != 0: %s", __FUNCTION__));
@@ -302,7 +302,7 @@
DPFPRINTF(("expiring %d(%p)\n", frag->fr_id, frag));
pf_free_fragment(frag);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((TAILQ_EMPTY(&V_pf_cachequeue) ||
TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue) != frag),
("!(TAILQ_EMPTY() || TAILQ_LAST() == farg): %s",
@@ -324,7 +324,7 @@
struct pf_fragment *frag;
int goal;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
goal = V_pf_nfrents * 9 / 10;
DPFPRINTF(("trying to free > %d frents\n",
V_pf_nfrents - goal));
@@ -335,7 +335,7 @@
pf_nfrents - goal));
while (goal < pf_nfrents) {
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
frag = TAILQ_LAST(&V_pf_fragqueue, pf_fragqueue);
#else
frag = TAILQ_LAST(&pf_fragqueue, pf_fragqueue);
@@ -346,7 +346,7 @@
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
goal = V_pf_ncache * 9 / 10;
DPFPRINTF(("trying to free > %d cache entries\n",
V_pf_ncache - goal));
@@ -357,7 +357,7 @@
pf_ncache - goal));
while (goal < pf_ncache) {
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue);
#else
frag = TAILQ_LAST(&pf_cachequeue, pf_cachequeue);
@@ -383,7 +383,7 @@
LIST_REMOVE(frent, fr_next);
m_freem(frent->fr_m);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -396,7 +396,7 @@
frcache = LIST_FIRST(&frag->fr_cache)) {
LIST_REMOVE(frcache, fr_next);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((LIST_EMPTY(&frag->fr_cache) ||
LIST_FIRST(&frag->fr_cache)->fr_off >
frcache->fr_end),
@@ -441,7 +441,7 @@
/* XXX Are we sure we want to update the timeout? */
frag->fr_timeout = time_second;
if (BUFFER_FRAGMENTS(frag)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_REMOVE(&V_pf_fragqueue, frag, frag_next);
TAILQ_INSERT_HEAD(&V_pf_fragqueue, frag, frag_next);
#else
@@ -449,7 +449,7 @@
TAILQ_INSERT_HEAD(&pf_fragqueue, frag, frag_next);
#endif
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
TAILQ_REMOVE(&V_pf_cachequeue, frag, frag_next);
TAILQ_INSERT_HEAD(&V_pf_cachequeue, frag, frag_next);
#else
@@ -468,7 +468,7 @@
pf_remove_fragment(struct pf_fragment *frag)
{
if (BUFFER_FRAGMENTS(frag)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_frag_tree, &V_pf_frag_tree, frag);
TAILQ_REMOVE(&V_pf_fragqueue, frag, frag_next);
pool_put(&V_pf_frag_pl, frag);
@@ -478,7 +478,7 @@
pool_put(&pf_frag_pl, frag);
#endif
} else {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_frag_tree, &V_pf_cache_tree, frag);
TAILQ_REMOVE(&V_pf_cachequeue, frag, frag_next);
pool_put(&V_pf_cache_pl, frag);
@@ -504,7 +504,7 @@
u_int16_t ip_len = ntohs(ip->ip_len) - ip->ip_hl * 4;
u_int16_t max = ip_len + off;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((*frag == NULL || BUFFER_FRAGMENTS(*frag)),
("! (*frag == NULL || BUFFER_FRAGMENTS(*frag)): %s", __FUNCTION__));
#else
@@ -517,7 +517,7 @@
/* Create a new reassembly queue for this packet */
if (*frag == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*frag = pool_get(&V_pf_frag_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_frag_pl, PR_NOWAIT);
@@ -524,7 +524,7 @@
#endif
if (*frag == NULL) {
pf_flush_fragments();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*frag = pool_get(&V_pf_frag_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_frag_pl, PR_NOWAIT);
@@ -542,7 +542,7 @@
(*frag)->fr_timeout = time_second;
LIST_INIT(&(*frag)->fr_queue);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_INSERT(pf_frag_tree, &V_pf_frag_tree, *frag);
TAILQ_INSERT_HEAD(&V_pf_fragqueue, *frag, frag_next);
#else
@@ -565,7 +565,7 @@
frep = frea;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((frep != NULL || frea != NULL),
("!(frep != NULL || frea != NULL): %s", __FUNCTION__));;
#else
@@ -613,7 +613,7 @@
next = LIST_NEXT(frea, fr_next);
m_freem(frea->fr_m);
LIST_REMOVE(frea, fr_next);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_frent_pl, frea);
V_pf_nfrents--;
#else
@@ -660,7 +660,7 @@
/* We have all the data */
frent = LIST_FIRST(&(*frag)->fr_queue);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((frent != NULL), ("frent == NULL: %s", __FUNCTION__));
#else
KASSERT(frent != NULL);
@@ -679,7 +679,7 @@
m2 = m->m_next;
m->m_next = NULL;
m_cat(m, m2);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -690,7 +690,7 @@
next = LIST_NEXT(frent, fr_next);
m2 = frent->fr_m;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -697,7 +697,7 @@
pool_put(&pf_frent_pl, frent);
pf_nfrents--;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m->m_pkthdr.csum_flags &= m2->m_pkthdr.csum_flags;
m->m_pkthdr.csum_data += m2->m_pkthdr.csum_data;
#endif
@@ -704,7 +704,7 @@
m_cat(m, m2);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
while (m->m_pkthdr.csum_data & 0xffff0000)
m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) +
(m->m_pkthdr.csum_data >> 16);
@@ -735,7 +735,7 @@
drop_fragment:
/* Oops - fail safe - drop packet */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -757,7 +757,7 @@
u_int16_t max = ip_len + off;
int hosed = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((*frag == NULL || !BUFFER_FRAGMENTS(*frag)),
("!(*frag == NULL || !BUFFER_FRAGMENTS(*frag)): %s", __FUNCTION__));
#else
@@ -766,7 +766,7 @@
/* Create a new range queue for this packet */
if (*frag == NULL) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*frag = pool_get(&V_pf_cache_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_cache_pl, PR_NOWAIT);
@@ -773,7 +773,7 @@
#endif
if (*frag == NULL) {
pf_flush_fragments();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*frag = pool_get(&V_pf_cache_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_cache_pl, PR_NOWAIT);
@@ -783,7 +783,7 @@
}
/* Get an entry for the queue */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
cur = pool_get(&V_pf_cent_pl, PR_NOWAIT);
if (cur == NULL) {
pool_put(&V_pf_cache_pl, *frag);
@@ -795,7 +795,7 @@
*frag = NULL;
goto no_mem;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_ncache++;
#else
pf_ncache++;
@@ -814,7 +814,7 @@
LIST_INIT(&(*frag)->fr_cache);
LIST_INSERT_HEAD(&(*frag)->fr_cache, cur, fr_next);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_INSERT(pf_frag_tree, &V_pf_cache_tree, *frag);
TAILQ_INSERT_HEAD(&V_pf_cachequeue, *frag, frag_next);
#else
@@ -838,7 +838,7 @@
frp = fra;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((frp != NULL || fra != NULL),
("!(frp != NULL || fra != NULL): %s", __FUNCTION__));
#else
@@ -885,7 +885,7 @@
* than this mbuf magic. For my next trick,
* I'll pull a rabbit out of my laptop.
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*m0 = m_dup(m, M_DONTWAIT);
#else
*m0 = m_copym2(m, 0, h->ip_hl << 2, M_NOWAIT);
@@ -892,7 +892,7 @@
#endif
if (*m0 == NULL)
goto no_mem;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
/* From KAME Project : We have missed this! */
m_adj(*m0, (h->ip_hl << 2) -
(*m0)->m_pkthdr.len);
@@ -917,7 +917,7 @@
h = mtod(m, struct ip *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(((int)m->m_len ==
ntohs(h->ip_len) - precut),
("m->m_len != ntohs(h->ip_len) - precut: %s",
@@ -939,7 +939,7 @@
h->ip_id, -precut, frp->fr_off, frp->fr_end, off,
max));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
cur = pool_get(&V_pf_cent_pl, PR_NOWAIT);
#else
cur = pool_get(&pf_cent_pl, PR_NOWAIT);
@@ -946,7 +946,7 @@
#endif
if (cur == NULL)
goto no_mem;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_ncache++;
#else
pf_ncache++;
@@ -989,7 +989,7 @@
m->m_pkthdr.len = plen;
}
h = mtod(m, struct ip *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT(((int)m->m_len == ntohs(h->ip_len) - aftercut),
("m->m_len != ntohs(h->ip_len) - aftercut: %s",
__FUNCTION__));
@@ -1007,7 +1007,7 @@
h->ip_id, -aftercut, off, max, fra->fr_off,
fra->fr_end));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
cur = pool_get(&V_pf_cent_pl, PR_NOWAIT);
#else
cur = pool_get(&pf_cent_pl, PR_NOWAIT);
@@ -1014,7 +1014,7 @@
#endif
if (cur == NULL)
goto no_mem;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_ncache++;
#else
pf_ncache++;
@@ -1036,7 +1036,7 @@
max, fra->fr_off, fra->fr_end));
fra->fr_off = cur->fr_off;
LIST_REMOVE(cur, fr_next);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_cent_pl, cur);
V_pf_ncache--;
#else
@@ -1047,7 +1047,7 @@
} else if (frp && fra->fr_off <= frp->fr_end) {
/* Need to merge in a modified 'frp' */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((cur == NULL), ("cur != NULL: %s",
__FUNCTION__));
#else
@@ -1059,7 +1059,7 @@
max, fra->fr_off, fra->fr_end));
fra->fr_off = frp->fr_off;
LIST_REMOVE(frp, fr_next);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pf_cent_pl, frp);
V_pf_ncache--;
#else
@@ -1169,7 +1169,7 @@
(struct pf_addr *)&h->ip_dst.s_addr, AF_INET,
r->dst.neg, NULL, M_GETFIB(m)))
r = r->skip[PF_SKIP_DST_ADDR].ptr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
else if (r->match_tag && !pf_match_tag(m, r, &tag, pd->pf_mtag))
#else
else if (r->match_tag && !pf_match_tag(m, r, &tag))
@@ -1233,7 +1233,7 @@
if ((r->rule_flag & (PFRULE_FRAGCROP|PFRULE_FRAGDROP)) == 0) {
/* Fully buffer all of the fragments */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
frag = pf_find_fragment(h, &V_pf_frag_tree);
#else
frag = pf_find_fragment(h, &pf_frag_tree);
@@ -1245,7 +1245,7 @@
goto bad;
/* Get an entry for the fragment queue */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
frent = pool_get(&V_pf_frent_pl, PR_NOWAIT);
#else
frent = pool_get(&pf_frent_pl, PR_NOWAIT);
@@ -1254,7 +1254,7 @@
REASON_SET(reason, PFRES_MEMORY);
return (PF_DROP);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pf_nfrents++;
#else
pf_nfrents++;
@@ -1289,7 +1289,7 @@
/* non-buffering fragment cache (drops or masks overlaps) */
int nomem = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (dir == PF_OUT && pd->pf_mtag->flags & PF_TAG_FRAGCACHE) {
#else
if (dir == PF_OUT && m->m_pkthdr.pf.flags & PF_TAG_FRAGCACHE) {
@@ -1302,7 +1302,7 @@
goto fragment_pass;
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
frag = pf_find_fragment(h, &V_pf_cache_tree);
#else
frag = pf_find_fragment(h, &pf_cache_tree);
@@ -1337,7 +1337,7 @@
}
#endif
if (dir == PF_IN)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pd->pf_mtag->flags |= PF_TAG_FRAGCACHE;
#else
m->m_pkthdr.pf.flags |= PF_TAG_FRAGCACHE;
@@ -1674,7 +1674,7 @@
/* copy back packet headers if we sanitized */
if (rewrite)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
m_copyback(m, off, sizeof(*th), (caddr_t)th);
#else
m_copyback(m, off, sizeof(*th), th);
@@ -1697,7 +1697,7 @@
u_int8_t hdr[60];
u_int8_t *opt;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((src->scrub == NULL),
("pf_normalize_tcp_init: src->scrub != NULL"));
@@ -1782,7 +1782,7 @@
void
pf_normalize_tcp_cleanup(struct pf_state *state)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (state->src.scrub)
pool_put(&V_pf_state_scrub_pl, state->src.scrub);
if (state->dst.scrub)
@@ -1810,7 +1810,7 @@
int copyback = 0;
int got_ts = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
KASSERT((src->scrub || dst->scrub),
("pf_normalize_tcp_statefull: src->scrub && dst->scrub!"));
#else
@@ -1870,7 +1870,7 @@
if (got_ts) {
/* Huh? Multiple timestamps!? */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1943,7 +1943,7 @@
if (src->scrub && (src->scrub->pfss_flags & PFSS_PAWS) &&
(uptime.tv_sec - src->scrub->pfss_last.tv_sec > TS_MAX_IDLE ||
time_second - state->creation > TS_MAX_CONN)) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1957,7 +1957,7 @@
}
if (dst->scrub && (dst->scrub->pfss_flags & PFSS_PAWS) &&
uptime.tv_sec - dst->scrub->pfss_last.tv_sec > TS_MAX_IDLE) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -2045,7 +2045,7 @@
* this packet.
*/
if ((ts_fudge = state->rule.ptr->timeout[PFTM_TS_DIFF]) == 0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ts_fudge = V_pf_default_rule.timeout[PFTM_TS_DIFF];
#else
ts_fudge = pf_default_rule.timeout[PFTM_TS_DIFF];
@@ -2055,7 +2055,7 @@
/* Calculate max ticks since the last timestamp */
#define TS_MAXFREQ 1100 /* RFC max TS freq of 1Khz + 10% skew */
#define TS_MICROSECS 1000000 /* microseconds per second */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifndef timersub
#define timersub(tvp, uvp, vvp) \
do { \
@@ -2092,7 +2092,7 @@
tsval_from_last) ? '1' : ' ',
SEQ_GT(tsecr, dst->scrub->pfss_tsval) ? '2' : ' ',
SEQ_LT(tsecr, dst->scrub->pfss_tsval0)? '3' : ' '));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
DPFPRINTF((" tsval: %u tsecr: %u +ticks: %u "
"idle: %jus %lums\n",
tsval, tsecr, tsval_from_last,
@@ -2114,7 +2114,7 @@
"\n", dst->scrub->pfss_tsval,
dst->scrub->pfss_tsecr, dst->scrub->pfss_tsval0));
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -2166,7 +2166,7 @@
* Hey! Someone tried to sneak a packet in. Or the
* stack changed its RFC1323 behavior?!?!
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -2197,7 +2197,7 @@
src->scrub->pfss_flags |= PFSS_DATA_TS;
else {
src->scrub->pfss_flags |= PFSS_DATA_NOTS;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC && dst->scrub &&
#else
if (pf_status.debug >= PF_DEBUG_MISC && dst->scrub &&
@@ -2255,7 +2255,7 @@
int thoff;
int opt, cnt, optlen = 0;
int rewrite = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_char opts[TCP_MAXOLEN];
#else
u_char opts[MAX_TCPOPTLEN];
Modified: trunk/sys/contrib/pf/net/pf_osfp.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_osfp.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_osfp.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -17,7 +17,7 @@
*
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/cdefs.h>
__MBSDID("$MidnightBSD$");
#endif
@@ -26,7 +26,7 @@
#include <sys/socket.h>
#ifdef _KERNEL
#include <sys/systm.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <sys/pool.h>
#endif
#endif /* _KERNEL */
@@ -47,7 +47,7 @@
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define DPFPRINTF(format, x...) \
if (V_pf_status.debug >= PF_DEBUG_NOISY) \
printf(format , ##x)
@@ -56,7 +56,7 @@
if (pf_status.debug >= PF_DEBUG_NOISY) \
printf(format , ##x)
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
typedef uma_zone_t pool_t;
#else
typedef struct pool pool_t;
@@ -76,7 +76,7 @@
#define pool_put(pool, item) free(item)
#define pool_init(pool, size, a, ao, f, m, p) (*(pool)) = (size)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define NTOHS(x) (x) = ntohs((u_int16_t)(x))
#endif
@@ -89,7 +89,7 @@
#endif /* _KERNEL */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
SLIST_HEAD(pf_osfp_list, pf_os_fingerprint);
VNET_DEFINE(struct pf_osfp_list, pf_osfp_list);
#define V_pf_osfp_list VNET(pf_osfp_list)
@@ -284,7 +284,7 @@
(fp.fp_flags & PF_OSFP_WSCALE_DC) ? "*" : "",
fp.fp_wscale);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((fpresult = pf_osfp_find(&V_pf_osfp_list, &fp,
#else
if ((fpresult = pf_osfp_find(&pf_osfp_list, &fp,
@@ -325,7 +325,7 @@
}
/* Initialize the OS fingerprint system */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int
#else
void
@@ -332,7 +332,7 @@
#endif
pf_osfp_initialize(void)
{
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__MidnightBSD__) && defined(_KERNEL)
int error = ENOMEM;
do {
@@ -351,7 +351,7 @@
SLIST_INIT(&pf_osfp_list);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef _KERNEL
return (error);
#else
@@ -360,7 +360,7 @@
#endif
}
-#if defined(__FreeBSD__) && (_KERNEL)
+#if defined(__MidnightBSD__) && (_KERNEL)
void
pf_osfp_cleanup(void)
{
@@ -377,7 +377,7 @@
struct pf_os_fingerprint *fp;
struct pf_osfp_entry *entry;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
while ((fp = SLIST_FIRST(&V_pf_osfp_list))) {
SLIST_REMOVE_HEAD(&V_pf_osfp_list, fp_next);
#else
@@ -436,7 +436,7 @@
fpioc->fp_os.fp_os);
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((fp = pf_osfp_find_exact(&V_pf_osfp_list, &fpadd))) {
#else
if ((fp = pf_osfp_find_exact(&pf_osfp_list, &fpadd))) {
@@ -446,7 +446,7 @@
return (EEXIST);
}
if ((entry = pool_get(&pf_osfp_entry_pl,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PR_NOWAIT)) == NULL)
#else
PR_WAITOK|PR_LIMITFAIL)) == NULL)
@@ -454,7 +454,7 @@
return (ENOMEM);
} else {
if ((fp = pool_get(&pf_osfp_pl,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PR_NOWAIT)) == NULL)
#else
PR_WAITOK|PR_LIMITFAIL)) == NULL)
@@ -471,7 +471,7 @@
fp->fp_ttl = fpioc->fp_ttl;
SLIST_INIT(&fp->fp_oses);
if ((entry = pool_get(&pf_osfp_entry_pl,
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PR_NOWAIT)) == NULL) {
#else
PR_WAITOK|PR_LIMITFAIL)) == NULL) {
@@ -479,7 +479,7 @@
pool_put(&pf_osfp_pl, fp);
return (ENOMEM);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pf_osfp_insert(&V_pf_osfp_list, fp);
#else
pf_osfp_insert(&pf_osfp_list, fp);
@@ -625,7 +625,7 @@
memset(fpioc, 0, sizeof(*fpioc));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
SLIST_FOREACH(fp, &V_pf_osfp_list, fp_next) {
#else
SLIST_FOREACH(fp, &pf_osfp_list, fp_next) {
@@ -656,7 +656,7 @@
{
struct pf_os_fingerprint *f, *f2, find;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
SLIST_FOREACH(f, &V_pf_osfp_list, fp_next) {
#else
SLIST_FOREACH(f, &pf_osfp_list, fp_next) {
@@ -672,7 +672,7 @@
find.fp_wsize *= (find.fp_mss + 40);
else if (f->fp_flags & PF_OSFP_WSIZE_MOD)
find.fp_wsize *= 2;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (f != (f2 = pf_osfp_find(&V_pf_osfp_list, &find, 0))) {
#else
if (f != (f2 = pf_osfp_find(&pf_osfp_list, &find, 0))) {
Modified: trunk/sys/contrib/pf/net/pf_ruleset.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_ruleset.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_ruleset.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -35,7 +35,7 @@
*
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/cdefs.h>
__MBSDID("$MidnightBSD$");
#endif
@@ -61,7 +61,7 @@
#ifdef _KERNEL
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define DPFPRINTF(format, x...) \
if (V_pf_status.debug >= PF_DEBUG_NOISY) \
printf(format , ##x)
@@ -70,7 +70,7 @@
if (pf_status.debug >= PF_DEBUG_NOISY) \
printf(format , ##x)
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define rs_malloc(x) malloc(x, M_TEMP, M_NOWAIT|M_ZERO)
#else
#define rs_malloc(x) malloc(x, M_TEMP, M_WAITOK|M_CANFAIL|M_ZERO)
@@ -96,7 +96,7 @@
#endif /* PFDEBUG */
#endif /* _KERNEL */
-#if defined(__FreeBSD__) && !defined(_KERNEL)
+#if defined(__MidnightBSD__) && !defined(_KERNEL)
#undef V_pf_anchors
#define V_pf_anchors pf_anchors
@@ -104,7 +104,7 @@
#define pf_main_ruleset pf_main_anchor.ruleset
#endif
-#if defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__MidnightBSD__) && defined(_KERNEL)
VNET_DEFINE(struct pf_anchor_global, pf_anchors);
VNET_DEFINE(struct pf_anchor, pf_main_anchor);
#else
@@ -178,7 +178,7 @@
if (key == NULL)
return (NULL);
strlcpy(key->path, path, sizeof(key->path));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
found = RB_FIND(pf_anchor_global, &V_pf_anchors, key);
#else
found = RB_FIND(pf_anchor_global, &pf_anchors, key);
@@ -208,7 +208,7 @@
{
char *p, *q, *r;
struct pf_ruleset *ruleset;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_anchor *anchor = NULL, *dup, *parent = NULL;
#else
struct pf_anchor *anchor, *dup, *parent = NULL;
@@ -263,7 +263,7 @@
strlcat(anchor->path, "/", sizeof(anchor->path));
}
strlcat(anchor->path, anchor->name, sizeof(anchor->path));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) !=
#else
if ((dup = RB_INSERT(pf_anchor_global, &pf_anchors, anchor)) !=
@@ -284,7 +284,7 @@
"RB_INSERT2 '%s' '%s' collides with "
"'%s' '%s'\n", anchor->path, anchor->name,
dup->path, dup->name);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_anchor_global, &V_pf_anchors,
#else
RB_REMOVE(pf_anchor_global, &pf_anchors,
@@ -324,7 +324,7 @@
!TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) ||
ruleset->rules[i].inactive.open)
return;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor);
#else
RB_REMOVE(pf_anchor_global, &pf_anchors, ruleset->anchor);
Modified: trunk/sys/contrib/pf/net/pf_table.c
===================================================================
--- trunk/sys/contrib/pf/net/pf_table.c 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pf_table.c 2018-06-04 03:52:12 UTC (rev 10404)
@@ -30,7 +30,7 @@
*
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -43,7 +43,7 @@
#include <sys/socket.h>
#include <sys/mbuf.h>
#include <sys/kernel.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/malloc.h>
#else
#include <sys/pool.h>
@@ -52,7 +52,7 @@
#include <net/if.h>
#include <net/route.h>
#include <netinet/in.h>
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#include <netinet/ip_ipsp.h>
#endif
#include <net/pfvar.h>
@@ -64,7 +64,7 @@
return (EINVAL); \
} while (0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
static inline int
_copyin(const void *uaddr, void *kaddr, size_t len)
{
@@ -175,7 +175,7 @@
#define senderr(e) do { rv = (e); goto _bad; } while (0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DEFINE(uma_zone_t, pfr_ktable_pl);
VNET_DEFINE(uma_zone_t, pfr_kentry_pl);
VNET_DEFINE(uma_zone_t, pfr_kcounters_pl);
@@ -254,7 +254,7 @@
void
pfr_initialize(void)
{
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
pool_init(&pfr_ktable_pl, sizeof(struct pfr_ktable), 0, 0, 0,
"pfrktable", NULL);
pool_init(&pfr_kentry_pl, sizeof(struct pfr_kentry), 0, 0, 0,
@@ -660,13 +660,13 @@
w.pfrw_addr = addr;
w.pfrw_free = kt->pfrkt_cnt;
w.pfrw_flags = flags;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rv = kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#else
rv = rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#endif
if (!rv)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rv = kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree,
&w);
#else
@@ -713,13 +713,13 @@
w.pfrw_flags = flags;
if (flags & PFR_FLAG_ATOMIC)
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rv = kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#else
rv = rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#endif
if (!rv)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rv = kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree,
&w);
#else
@@ -840,7 +840,7 @@
w.pfrw_op = sweep ? PFRW_SWEEP : PFRW_ENQUEUE;
w.pfrw_workq = workq;
if (kt->pfrkt_ip4 != NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree,
&w))
#else
@@ -848,7 +848,7 @@
#endif
printf("pfr_enqueue_addrs: IPv4 walktree failed.\n");
if (kt->pfrkt_ip6 != NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree,
&w))
#else
@@ -866,13 +866,13 @@
bzero(&w, sizeof(w));
w.pfrw_op = PFRW_MARK;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree, &w))
#else
if (rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w))
#endif
printf("pfr_mark_addrs: IPv4 walktree failed.\n");
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree, &w))
#else
if (rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w))
@@ -885,7 +885,7 @@
pfr_lookup_addr(struct pfr_ktable *kt, struct pfr_addr *ad, int exact)
{
union sockaddr_union sa, mask;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct radix_node_head *head = NULL;
#else
struct radix_node_head *head;
@@ -904,7 +904,7 @@
if (ADDR_NETWORK(ad)) {
pfr_prepare_network(&mask, ad->pfra_af, ad->pfra_net);
s = splsoftnet(); /* rn_lookup makes use of globals */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#endif
ke = (struct pfr_kentry *)rn_lookup(&sa, &mask, head);
@@ -926,7 +926,7 @@
{
struct pfr_kentry *ke;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
#else
if (intr)
@@ -962,7 +962,7 @@
pfr_destroy_kentry(struct pfr_kentry *ke)
{
if (ke->pfrke_counters)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pfr_kcounters_pl, ke->pfrke_counters);
pool_put(&V_pfr_kentry_pl, ke);
#else
@@ -1050,7 +1050,7 @@
if (negchange)
p->pfrke_not = !p->pfrke_not;
if (p->pfrke_counters) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pfr_kcounters_pl, p->pfrke_counters);
#else
pool_put(&pfr_kcounters_pl, p->pfrke_counters);
@@ -1107,7 +1107,7 @@
{
union sockaddr_union mask;
struct radix_node *rn;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct radix_node_head *head = NULL;
#else
struct radix_node_head *head;
@@ -1121,18 +1121,18 @@
head = kt->pfrkt_ip6;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#endif
if (KENTRY_NETWORK(ke)) {
pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rn = rn_addroute(&ke->pfrke_sa, &mask, head, ke->pfrke_node);
#else
rn = rn_addroute(&ke->pfrke_sa, &mask, head, ke->pfrke_node, 0);
#endif
} else
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rn = rn_addroute(&ke->pfrke_sa, NULL, head, ke->pfrke_node);
#else
rn = rn_addroute(&ke->pfrke_sa, NULL, head, ke->pfrke_node, 0);
@@ -1147,7 +1147,7 @@
{
union sockaddr_union mask;
struct radix_node *rn;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct radix_node_head *head = NULL;
#else
struct radix_node_head *head;
@@ -1160,18 +1160,18 @@
head = kt->pfrkt_ip6;
s = splsoftnet();
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_LOCK_ASSERT();
#endif
if (KENTRY_NETWORK(ke)) {
pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rn = rn_delete(&ke->pfrke_sa, &mask, head);
#else
rn = rn_delete(&ke->pfrke_sa, &mask, head, NULL);
#endif
} else
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
rn = rn_delete(&ke->pfrke_sa, NULL, head);
#else
rn = rn_delete(&ke->pfrke_sa, NULL, head, NULL);
@@ -1266,7 +1266,7 @@
if (ke->pfrke_af == AF_INET) {
if (w->pfrw_dyn->pfid_acnt4++ > 0)
break;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfr_prepare_network(&V_pfr_mask, AF_INET, ke->pfrke_net);
#else
pfr_prepare_network(&pfr_mask, AF_INET, ke->pfrke_net);
@@ -1274,7 +1274,7 @@
w->pfrw_dyn->pfid_addr4 = *SUNION2PF(
&ke->pfrke_sa, AF_INET);
w->pfrw_dyn->pfid_mask4 = *SUNION2PF(
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
&V_pfr_mask, AF_INET);
#else
&pfr_mask, AF_INET);
@@ -1282,7 +1282,7 @@
} else if (ke->pfrke_af == AF_INET6){
if (w->pfrw_dyn->pfid_acnt6++ > 0)
break;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfr_prepare_network(&V_pfr_mask, AF_INET6, ke->pfrke_net);
#else
pfr_prepare_network(&pfr_mask, AF_INET6, ke->pfrke_net);
@@ -1290,7 +1290,7 @@
w->pfrw_dyn->pfid_addr6 = *SUNION2PF(
&ke->pfrke_sa, AF_INET6);
w->pfrw_dyn->pfid_mask6 = *SUNION2PF(
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
&V_pfr_mask, AF_INET6);
#else
&pfr_mask, AF_INET6);
@@ -2076,7 +2076,7 @@
struct pfr_ktable *kt;
struct pf_ruleset *rs;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
#else
if (intr)
@@ -2131,7 +2131,7 @@
pfr_clean_node_mask(kt, &addrq);
pfr_destroy_kentries(&addrq);
}
-#if defined(__FreeBSD__) && (__FreeBSD_version >= 500100)
+#if defined(__MidnightBSD__) && (__FreeBSD_version >= 500100)
if (kt->pfrkt_ip4 != NULL) {
RADIX_NODE_HEAD_DESTROY(kt->pfrkt_ip4);
free((caddr_t)kt->pfrkt_ip4, M_RTABLE);
@@ -2152,7 +2152,7 @@
kt->pfrkt_rs->tables--;
pf_remove_if_empty_ruleset(kt->pfrkt_rs);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pool_put(&V_pfr_ktable_pl, kt);
#else
pool_put(&pfr_ktable_pl, kt);
@@ -2191,7 +2191,7 @@
switch (af) {
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfr_sin.sin_addr.s_addr = a->addr32[0];
ke = (struct pfr_kentry *)rn_match(&V_pfr_sin, kt->pfrkt_ip4);
#else
@@ -2204,7 +2204,7 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bcopy(a, &V_pfr_sin6.sin6_addr, sizeof(V_pfr_sin6.sin6_addr));
ke = (struct pfr_kentry *)rn_match(&V_pfr_sin6, kt->pfrkt_ip6);
#else
@@ -2238,7 +2238,7 @@
switch (af) {
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
V_pfr_sin.sin_addr.s_addr = a->addr32[0];
ke = (struct pfr_kentry *)rn_match(&V_pfr_sin, kt->pfrkt_ip4);
#else
@@ -2251,7 +2251,7 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
bcopy(a, &V_pfr_sin6.sin6_addr, sizeof(V_pfr_sin6.sin6_addr));
ke = (struct pfr_kentry *)rn_match(&V_pfr_sin6, kt->pfrkt_ip6);
#else
@@ -2275,7 +2275,7 @@
if (ke != NULL && op_pass != PFR_OP_XPASS &&
(kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) {
if (ke->pfrke_counters == NULL)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
ke->pfrke_counters = pool_get(&V_pfr_kcounters_pl,
#else
ke->pfrke_counters = pool_get(&pfr_kcounters_pl,
@@ -2338,7 +2338,7 @@
pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
struct pf_addr **raddr, struct pf_addr **rmask, sa_family_t af)
{
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pfr_kentry *ke, *ke2 = NULL;
struct pf_addr *addr = NULL;
#else
@@ -2348,7 +2348,7 @@
union sockaddr_union mask;
int idx = -1, use_counter = 0;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (af == AF_INET)
addr = (struct pf_addr *)&V_pfr_sin.sin_addr;
else if (af == AF_INET6)
@@ -2377,13 +2377,13 @@
kt->pfrkt_nomatch++;
return (1);
}
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
pfr_prepare_network(&V_pfr_mask, af, ke->pfrke_net);
#else
pfr_prepare_network(&pfr_mask, af, ke->pfrke_net);
#endif
*raddr = SUNION2PF(&ke->pfrke_sa, af);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
*rmask = SUNION2PF(&V_pfr_mask, af);
#else
*rmask = SUNION2PF(&pfr_mask, af);
@@ -2412,7 +2412,7 @@
}
for (;;) {
/* we don't want to use a nested block */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
if (af == AF_INET)
ke2 = (struct pfr_kentry *)rn_match(&V_pfr_sin,
kt->pfrkt_ip4);
@@ -2438,7 +2438,7 @@
/* we need to increase the counter past the nested block */
pfr_prepare_network(&mask, AF_INET, ke2->pfrke_net);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
PF_POOLMASK(addr, addr, SUNION2PF(&mask, af), &V_pfr_ffaddr, af);
#else
PF_POOLMASK(addr, addr, SUNION2PF(&mask, af), &pfr_ffaddr, af);
@@ -2466,7 +2466,7 @@
switch (af) {
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
@@ -2475,7 +2475,7 @@
#endif /* INET */
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
@@ -2501,13 +2501,13 @@
dyn->pfid_acnt4 = 0;
dyn->pfid_acnt6 = 0;
if (!dyn->pfid_af || dyn->pfid_af == AF_INET)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#endif
if (!dyn->pfid_af || dyn->pfid_af == AF_INET6)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
Modified: trunk/sys/contrib/pf/net/pfvar.h
===================================================================
--- trunk/sys/contrib/pf/net/pfvar.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/pf/net/pfvar.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -38,7 +38,7 @@
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/tree.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <sys/lock.h>
#include <sys/sx.h>
#else
@@ -47,7 +47,7 @@
#include <net/radix.h>
#include <net/route.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <net/if_clone.h>
#include <net/pf_mtag.h>
#include <vm/uma.h>
@@ -55,7 +55,7 @@
#include <netinet/ip_ipsp.h>
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#include <netinet/in.h>
#endif
@@ -63,7 +63,7 @@
struct ip;
struct ip6_hdr;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct inpcb;
#endif
@@ -174,7 +174,7 @@
} a;
char ifname[IFNAMSIZ];
char tblname[PF_TABLE_NAME_SIZE];
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define RTLABEL_LEN 32
#endif
char rtlabelname[RTLABEL_LEN];
@@ -212,7 +212,7 @@
* Address manipulation macros
*/
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define splsoftnet() splnet()
#define HTONL(x) (x) = htonl((__uint32_t)(x))
@@ -237,7 +237,7 @@
if (var) \
uma_zdestroy(var)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
extern struct mtx pf_task_mtx;
#define PF_LOCK_ASSERT() mtx_assert(&pf_task_mtx, MA_OWNED)
@@ -249,7 +249,7 @@
#define PF_UNLOCK_ASSERT()
#define PF_LOCK()
#define PF_UNLOCK()
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#define PF_COPYIN(uaddr, kaddr, len, r) do { \
PF_UNLOCK(); \
@@ -273,7 +273,7 @@
#define PFSYNC_MINVER 1
#define PFSYNC_PREFVER PFSYNC_MODVER
#define PFSYNC_MAXVER 1
-#endif /* __FreeBSD__ */
+#endif /* __MidnightBSD__ */
#ifdef INET
#ifndef INET6
#define PF_INET_ONLY
@@ -831,7 +831,7 @@
u_int64_t id;
u_int32_t creatorid;
u_int8_t direction;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int8_t pad[2];
u_int8_t local_flags;
#define PFSTATE_EXPIRING 0x01
@@ -921,7 +921,7 @@
sa_family_t af;
u_int8_t proto;
u_int8_t direction;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int8_t local_flags;
#define PFSTATE_EXPIRING 0x01
u_int8_t pad;
@@ -933,7 +933,7 @@
u_int8_t updates;
} __packed;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef _KERNEL
/* pfsync */
typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t);
@@ -1213,7 +1213,7 @@
RB_HEAD(pfi_ifhead, pfi_kif);
/* state tables */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef _KERNEL
VNET_DECLARE(struct pf_state_tree, pf_statetbl);
#define V_pf_statetbl VNET(pf_statetbl)
@@ -1275,7 +1275,7 @@
struct pf_addr *dst; /* dst address */
u_int16_t *sport;
u_int16_t *dport;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_mtag *pf_mtag;
#endif
@@ -1401,7 +1401,7 @@
*(a) = (x); \
} while (0)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define REASON_SET(a, x) \
do { \
if ((a) != NULL) \
@@ -1486,7 +1486,7 @@
u_int32_t parent_qid; /* parent queue id */
u_int32_t bandwidth; /* queue bandwidth */
u_int8_t priority; /* priority */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int8_t local_flags; /* dynamic interface */
#define PFALTQ_FLAG_IF_REMOVED 0x01
#endif
@@ -1766,7 +1766,7 @@
#define DIOCSETIFFLAG _IOWR('D', 89, struct pfioc_iface)
#define DIOCCLRIFFLAG _IOWR('D', 90, struct pfioc_iface)
#define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill)
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_ifspeed {
char ifname[IFNAMSIZ];
u_int32_t baudrate;
@@ -1777,7 +1777,7 @@
#ifdef _KERNEL
RB_HEAD(pf_src_tree, pf_src_node);
RB_PROTOTYPE(pf_src_tree, pf_src_node, entry, pf_src_compare);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pf_src_tree, tree_src_tracking);
#define V_tree_src_tracking VNET(tree_src_tracking)
#else
@@ -1787,7 +1787,7 @@
RB_HEAD(pf_state_tree_id, pf_state);
RB_PROTOTYPE(pf_state_tree_id, pf_state,
entry_id, pf_state_compare_id);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pf_state_tree_id, tree_id);
#define V_tree_id VNET(tree_id)
VNET_DECLARE(struct pf_state_queue, state_list);
@@ -1798,7 +1798,7 @@
#endif
TAILQ_HEAD(pf_poolqueue, pf_pool);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pf_poolqueue, pf_pools[2]);
#define V_pf_pools VNET(pf_pools)
#else
@@ -1805,7 +1805,7 @@
extern struct pf_poolqueue pf_pools[2];
#endif
TAILQ_HEAD(pf_altqqueue, pf_altq);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pf_altqqueue, pf_altqs[2]);
#define V_pf_altqs VNET(pf_altqs)
VNET_DECLARE(struct pf_palist, pf_pabuf);
@@ -1815,7 +1815,7 @@
extern struct pf_palist pf_pabuf;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(u_int32_t, ticket_altqs_active);
#define V_ticket_altqs_active VNET(ticket_altqs_active)
VNET_DECLARE(u_int32_t, ticket_altqs_inactive);
@@ -1847,7 +1847,7 @@
extern void pf_tbladdr_remove(struct pf_addr_wrap *);
extern void pf_tbladdr_copyout(struct pf_addr_wrap *);
extern void pf_calc_skip_steps(struct pf_rulequeue *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef ALTQ
extern void pf_altq_ifnet_event(struct ifnet *, int);
#endif
@@ -1886,7 +1886,7 @@
extern struct pool pf_state_scrub_pl;
#endif
extern void pf_purge_thread(void *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
extern int pf_purge_expired_src_nodes(int);
extern int pf_purge_expired_states(u_int32_t , int);
#else
@@ -1911,7 +1911,7 @@
extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
u_int8_t);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct ifnet *, sync_ifp);
#define V_sync_ifp VNET(sync_ifp);
VNET_DECLARE(struct pf_rule, pf_default_rule);
@@ -1924,12 +1924,12 @@
u_int8_t);
void pf_rm_rule(struct pf_rulequeue *,
struct pf_rule *);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
struct pf_divert *pf_find_divert(struct mbuf *);
#endif
#ifdef INET
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pf_test(int, struct ifnet *, struct mbuf **, struct ether_header *,
struct inpcb *);
#else
@@ -1938,7 +1938,7 @@
#endif /* INET */
#ifdef INET6
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pf_test6(int, struct ifnet *, struct mbuf **, struct ether_header *,
struct inpcb *);
#else
@@ -1949,7 +1949,7 @@
void pf_addr_inc(struct pf_addr *, sa_family_t);
#endif /* INET6 */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
u_int32_t pf_new_isn(struct pf_state *);
#endif
void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,
@@ -1988,7 +1988,7 @@
int);
int pf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *,
int);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pf_socket_lookup(int, struct pf_pdesc *, struct inpcb *);
#else
int pf_socket_lookup(int, struct pf_pdesc *);
@@ -2033,7 +2033,7 @@
int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *,
int *, u_int32_t, int);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pfi_kif *, pfi_all);
#define V_pfi_all VNET(pfi_all)
#else
@@ -2041,7 +2041,7 @@
#endif
void pfi_initialize(void);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
void pfi_cleanup(void);
#endif
struct pfi_kif *pfi_kif_get(const char *);
@@ -2063,7 +2063,7 @@
int pfi_set_flags(const char *, int);
int pfi_clear_flags(const char *, int);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pf_match_tag(struct mbuf *, struct pf_rule *, int *,
struct pf_mtag *);
#else
@@ -2073,7 +2073,7 @@
void pf_tag2tagname(u_int16_t, char *);
void pf_tag_ref(u_int16_t);
void pf_tag_unref(u_int16_t);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pf_tag_packet(struct mbuf *, int, int, struct pf_mtag *);
#else
int pf_tag_packet(struct mbuf *, int, int);
@@ -2082,7 +2082,7 @@
void pf_qid2qname(u_int32_t, char *);
void pf_qid_unref(u_int32_t);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pf_status, pf_status);
#define V_pf_status VNET(pf_status)
#else
@@ -2089,7 +2089,7 @@
extern struct pf_status pf_status;
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(uma_zone_t, pf_frent_pl);
#define V_pf_frent_pl VNET(pf_frent_pl)
VNET_DECLARE(uma_zone_t, pf_frag_pl);
@@ -2105,7 +2105,7 @@
void *pp;
unsigned limit;
};
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
VNET_DECLARE(struct pf_pool_limit, pf_pool_limits[PF_LIMIT_MAX]);
#define V_pf_pool_limits VNET(pf_pool_limits)
#else
@@ -2112,7 +2112,7 @@
extern struct pf_pool_limit pf_pool_limits[PF_LIMIT_MAX];
#endif
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
struct pf_frent {
LIST_ENTRY(pf_frent) fr_next;
struct ip *fr_ip;
@@ -2142,11 +2142,11 @@
LIST_HEAD(pf_cacheq, pf_frcache) fru_cache; /* non-buf */
} fr_u;
};
-#endif /* (__FreeBSD__) */
+#endif /* (__MidnightBSD__) */
#endif /* _KERNEL */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#ifdef _KERNEL
VNET_DECLARE(struct pf_anchor_global, pf_anchors);
#define V_pf_anchors VNET(pf_anchors)
@@ -2174,7 +2174,7 @@
struct pf_ruleset *pf_find_or_create_ruleset(const char *);
void pf_rs_initialize(void);
-#ifndef __FreeBSD__
+#ifndef __MidnightBSD__
#ifdef _KERNEL
int pf_anchor_copyout(const struct pf_ruleset *,
const struct pf_rule *, struct pfioc_rule *);
@@ -2195,7 +2195,7 @@
const struct tcphdr *);
void pf_osfp_flush(void);
int pf_osfp_get(struct pf_osfp_ioctl *);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
int pf_osfp_initialize(void);
void pf_osfp_cleanup(void);
#else
Modified: trunk/sys/contrib/v4l/videodev2.h
===================================================================
--- trunk/sys/contrib/v4l/videodev2.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/v4l/videodev2.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -59,7 +59,7 @@
#ifndef __LINUX_VIDEODEV2_H
#define __LINUX_VIDEODEV2_H
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
#define __user
typedef uint64_t __u64;
typedef int64_t __s64;
Modified: trunk/sys/contrib/xz-embedded/linux/include/linux/xz.h
===================================================================
--- trunk/sys/contrib/xz-embedded/linux/include/linux/xz.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/contrib/xz-embedded/linux/include/linux/xz.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -16,7 +16,7 @@
# include <linux/stddef.h>
# include <linux/types.h>
#else
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
# include <sys/stddef.h>
# include <sys/types.h>
#else
Modified: trunk/sys/net/bpf.h
===================================================================
--- trunk/sys/net/bpf.h 2018-06-04 03:51:34 UTC (rev 10403)
+++ trunk/sys/net/bpf.h 2018-06-04 03:52:12 UTC (rev 10404)
@@ -1132,7 +1132,7 @@
* them collide with something used elsewhere. On platforms that
* don't already define it, define it as 245.
*/
-#if !defined(__MidnightBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__)
+#if !defined(__MidnightBSD__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__)
#define DLT_PFSYNC 246
#endif
More information about the Midnightbsd-cvs
mailing list