[Glibc-bsd-commits] r4991 - in trunk/freebsd-utils/debian: . patches
Robert Millan
rmh at alioth.debian.org
Wed Oct 2 23:26:12 UTC 2013
Author: rmh
Date: 2013-10-02 23:25:49 +0000 (Wed, 02 Oct 2013)
New Revision: 4991
Removed:
trunk/freebsd-utils/debian/patches/pf_regex_h.diff
Modified:
trunk/freebsd-utils/debian/changelog
trunk/freebsd-utils/debian/control
trunk/freebsd-utils/debian/patches/006_mdconfig.diff
trunk/freebsd-utils/debian/patches/011_mount_nullfs.diff
trunk/freebsd-utils/debian/patches/013_pf.diff
trunk/freebsd-utils/debian/patches/014_route.diff
trunk/freebsd-utils/debian/patches/016_swapon.diff
trunk/freebsd-utils/debian/patches/017_sysctl.diff
trunk/freebsd-utils/debian/patches/018_umount.diff
trunk/freebsd-utils/debian/patches/022_devd.diff
trunk/freebsd-utils/debian/patches/025_camcontrol.diff
trunk/freebsd-utils/debian/patches/026_kdump.diff
trunk/freebsd-utils/debian/patches/035_nfs.diff
trunk/freebsd-utils/debian/patches/038_jail.diff
trunk/freebsd-utils/debian/patches/pf_regex_c.diff
trunk/freebsd-utils/debian/patches/pf_regex_followup.diff
trunk/freebsd-utils/debian/patches/series
trunk/freebsd-utils/debian/patches/stablerestart-fhs-compliance.diff
trunk/freebsd-utils/debian/rules
Log:
* New upstream release.
- Refresh all patches.
- Bump B-D on freebsd-glue and libcam-dev.
Modified: trunk/freebsd-utils/debian/changelog
===================================================================
--- trunk/freebsd-utils/debian/changelog 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/changelog 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,12 +1,17 @@
-freebsd-utils (9.1-5) UNRELEASED; urgency=low
+freebsd-utils (9.2-1) unstable; urgency=low
+ * New upstream release.
+ - Refresh all patches.
+ - Bump B-D on freebsd-glue and libcam-dev.
+
+ [ Robert Millan ]
* Misc adjustments for freebsd-glue 0.1.0.
* Reduce the patchset even further by using trimdomain, link_addr and
link_ntoa from freebsd-glue.
* Improve output formatting in nfsiod init script. Thanks Mats Erik
Andersson. (Closes: #721446)
- -- Robert Millan <rmh at debian.org> Sun, 04 Aug 2013 17:30:14 +0200
+ -- Robert Millan <rmh at debian.org> Thu, 03 Oct 2013 01:21:38 +0200
freebsd-utils (9.1-4) unstable; urgency=high
Modified: trunk/freebsd-utils/debian/control
===================================================================
--- trunk/freebsd-utils/debian/control 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/control 2013-10-02 23:25:49 UTC (rev 4991)
@@ -9,7 +9,7 @@
Build-Depends: debhelper (>= 7), po-debconf, sharutils,
flex | flex-old,
freebsd-buildutils (>= 9.0-8~),
- freebsd-glue (>= 0.1.1~),
+ freebsd-glue (>= 0.1.6~),
kfreebsd-kernel-headers (>= 9.1-3~),
libc0.1-dev (>= 2.13-26),
libbsd-dev (>= 0.3.0), pkg-config,
@@ -30,7 +30,7 @@
# libsbuf-dev: ifconfig, mdconfig, geom
libsbuf-dev (>= 8.2-2),
# libcam-dev: camcontrol
- libcam-dev (>= 8.2),
+ libcam-dev (>= 9.2~),
# libedit-dev: pppctl
libedit-dev,
# libexpat1-dev: ifconfig, geom
Modified: trunk/freebsd-utils/debian/patches/006_mdconfig.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/006_mdconfig.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/006_mdconfig.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -9,31 +9,10 @@
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
-@@ -42,6 +42,7 @@
- static int md_find(char *, const char *);
- static int md_query(char *name);
- static int md_list(char *units, int opt);
-+static void mdmaybeload(void);
- static char *geom_config_get(struct gconf *g, const char *name);
- static void md_prthumanval(char *length);
+@@ -74,6 +74,24 @@
+ #define CLASS_NAME_MD "MD"
-@@ -267,9 +268,7 @@
-
- mdio.md_version = MDIOVERSION;
-
-- if (!kld_isloaded("g_md") && kld_load("geom_md") == -1)
-- err(1, "failed to load geom_md module");
--
-+ mdmaybeload();
- fd = open("/dev/" MDCTL_NAME, O_RDWR, 0);
- if (fd < 0)
- err(1, "open(/dev/%s)", MDCTL_NAME);
-@@ -492,3 +491,21 @@
- {
- return (md_list(name, OPT_UNIT));
- }
-+
-+void
+ static void
+mdmaybeload(void)
+{
+ char name1[64], name2[64];
@@ -50,10 +29,25 @@
+ }
+ }
+}
++
++static void
+ usage(void)
+ {
+
+@@ -315,8 +333,7 @@
+
+ mdio.md_version = MDIOVERSION;
+
+- if (!kld_isloaded("g_md") && kld_load("geom_md") == -1)
+- err(1, "failed to load geom_md module");
++ mdmaybeload();
+
+ fd = open(_PATH_DEV MDCTL_NAME, O_RDWR, 0);
+ if (fd < 0)
--- a/sbin/mdconfig/Makefile
+++ b/sbin/mdconfig/Makefile
-@@ -5,6 +5,6 @@
- MLINKS= mdconfig.8 vnconfig.8
+@@ -4,6 +4,6 @@
+ MAN= mdconfig.8
DPADD= ${LIBUTIL} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
-LDADD= -lutil -lgeom -lbsdxml -lsbuf
Modified: trunk/freebsd-utils/debian/patches/011_mount_nullfs.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/011_mount_nullfs.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/011_mount_nullfs.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -4,8 +4,8 @@
--- a/sbin/mount_nullfs/mount_nullfs.c
+++ b/sbin/mount_nullfs/mount_nullfs.c
-@@ -63,7 +63,7 @@
- };
+@@ -58,7 +58,7 @@
+ #include "mntopts.h"
int subdir(const char *, const char *);
-static void usage(void) __dead2;
Modified: trunk/freebsd-utils/debian/patches/013_pf.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/013_pf.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/013_pf.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,7 +1,7 @@
--- a/contrib/pf/authpf/authpf.c
+++ b/contrib/pf/authpf/authpf.c
@@ -37,7 +37,7 @@
- #ifdef __FreeBSD_kernel__
+ #if 1
#include <inttypes.h>
#endif
-#include <login_cap.h>
Modified: trunk/freebsd-utils/debian/patches/014_route.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/014_route.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/014_route.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,20 +1,6 @@
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
-@@ -64,10 +64,13 @@
- #include <paths.h>
- #include <stdio.h>
- #include <stdlib.h>
-+#include <stdint.h>
- #include <string.h>
- #include <sysexits.h>
- #include <unistd.h>
- #include <ifaddrs.h>
-+#include <time.h>
-+
-
- struct keytab {
- const char *kt_cp;
-@@ -148,7 +151,7 @@
+@@ -167,7 +167,7 @@
if (argc < 2)
usage(NULL);
@@ -23,3 +9,15 @@
switch(ch) {
case 'n':
nflag = 1;
+@@ -243,6 +243,11 @@
+
+ if (fib < 0)
+ return (0);
++
++#ifndef SO_SETFIB
++#define SO_SETFIB 0x1014
++#endif
++
+ return (setsockopt(s, SOL_SOCKET, SO_SETFIB, (void *)&fib,
+ sizeof(fib)));
+ }
Modified: trunk/freebsd-utils/debian/patches/016_swapon.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/016_swapon.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/016_swapon.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -17,27 +17,27 @@
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/sysctl.h>
-@@ -71,6 +72,8 @@
- int ch, doall;
+@@ -72,6 +73,8 @@
int sflag = 0, lflag = 0, hflag = 0, qflag = 0;
+ const char *etc_fstab;
+ setprogname (argv[0]);
+
if ((ptr = strrchr(argv[0], '/')) == NULL)
ptr = argv[0];
if (strstr(ptr, "swapon"))
-@@ -80,7 +83,7 @@
- orig_prog = which_prog;
+@@ -82,7 +85,7 @@
doall = 0;
-- while ((ch = getopt(argc, argv, "AadghklmqsU")) != -1) {
-+ while ((ch = getopt(argc, argv, "AadghklmqsUve")) != -1) {
+ etc_fstab = NULL;
+- while ((ch = getopt(argc, argv, "AadghklmqsUF:")) != -1) {
++ while ((ch = getopt(argc, argv, "AadghklmqsUF:ve")) != -1) {
switch(ch) {
case 'A':
if (which_prog == SWAPCTL) {
-@@ -132,6 +135,9 @@
- usage();
- }
+@@ -137,6 +140,9 @@
+ case 'F':
+ etc_fstab = optarg;
break;
+ case 'v':
+ case 'e':
@@ -45,7 +45,7 @@
case '?':
default:
usage();
-@@ -271,7 +277,8 @@
+@@ -278,7 +284,8 @@
hlen = 10;
break;
default:
@@ -57,11 +57,11 @@
}
--- a/sbin/swapon/Makefile
+++ b/sbin/swapon/Makefile
-@@ -10,6 +10,6 @@
+@@ -9,6 +9,6 @@
+ MLINKS+=swapon.8 swapctl.8
- WARNS?= 3
DPADD= ${LIBUTIL}
-LDADD= -lutil
-+LDADD= -lbsd -lutil
++LDADD= -lbsd -lfreebsd-glue -lutil
.include <bsd.prog.mk>
Modified: trunk/freebsd-utils/debian/patches/017_sysctl.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/017_sysctl.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/017_sysctl.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -12,7 +12,7 @@
static int aflag, bflag, dflag, eflag, hflag, iflag;
static int Nflag, nflag, oflag, qflag, xflag, warncount;
-@@ -354,6 +355,7 @@
+@@ -353,6 +354,7 @@
static int
S_loadavg(int l2, void *p)
{
@@ -20,7 +20,7 @@
struct loadavg *tv = (struct loadavg*)p;
if (l2 != sizeof(*tv)) {
-@@ -364,6 +366,7 @@
+@@ -363,6 +365,7 @@
(double)tv->ldavg[0]/(double)tv->fscale,
(double)tv->ldavg[1]/(double)tv->fscale,
(double)tv->ldavg[2]/(double)tv->fscale);
Modified: trunk/freebsd-utils/debian/patches/018_umount.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/018_umount.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/018_umount.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,100 +1,11 @@
----
- sbin/umount/umount.8 | 5 -----
- sbin/umount/umount.c | 30 ++++++------------------------
- 2 files changed, 6 insertions(+), 29 deletions(-)
-
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
-@@ -91,7 +91,7 @@
- struct addrinfo hints;
-
- all = errs = 0;
-- while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1)
-+ while ((ch = getopt(argc, argv, "Aafh:t:v")) != -1)
- switch (ch) {
- case 'A':
- all = 2;
-@@ -99,9 +99,6 @@
- case 'a':
- all = 1;
- break;
-- case 'F':
-- setfstab(optarg);
-- break;
- case 'f':
- fflag = MNT_FORCE;
- break;
-@@ -163,7 +160,7 @@
- break;
- case 1:
- if (setfsent() == 0)
-- err(1, "%s", getfstab());
-+ err(1, "/etc/fstab");
- errs = umountall(typelist);
- break;
- case 0:
-@@ -361,24 +358,12 @@
-
- if (!namematch(ai))
- return (1);
-- /* First try to unmount using the file system ID. */
-- snprintf(fsidbuf, sizeof(fsidbuf), "FSID:%d:%d", sfs->f_fsid.val[0],
-- sfs->f_fsid.val[1]);
-- if (unmount(fsidbuf, fflag | MNT_BYFSID) != 0) {
-- /* XXX, non-root users get a zero fsid, so don't warn. */
-- if (errno != ENOENT || sfs->f_fsid.val[0] != 0 ||
-- sfs->f_fsid.val[1] != 0)
-- warn("unmount of %s failed", sfs->f_mntonname);
-- if (errno != ENOENT)
-- return (1);
-- /* Compatibility for old kernels. */
-- if (sfs->f_fsid.val[0] != 0 || sfs->f_fsid.val[1] != 0)
-- warnx("retrying using path instead of file system ID");
-+
- if (unmount(sfs->f_mntonname, fflag) != 0) {
- warn("unmount of %s failed", sfs->f_mntonname);
+@@ -401,7 +401,7 @@
+ free(orignfsdirname);
return (1);
}
-- }
-+
- /* Mark this this file system as unmounted. */
- getmntentry(NULL, NULL, &sfs->f_fsid, REMOVE);
- if (vflag)
-@@ -395,7 +380,7 @@
- clnt_spcreateerror("MOUNTPROG"));
- return (1);
- }
- clp->cl_auth = authsys_create_default();
+ clp->cl_auth = authunix_create_default();
try.tv_sec = 20;
try.tv_usec = 0;
clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir,
-@@ -603,6 +588,6 @@
-
- (void)fprintf(stderr, "%s\n%s\n",
- "usage: umount [-fv] special ... | node ... | fsid ...",
-- " umount -a | -A [-F fstab] [-fv] [-h host] [-t type]");
-+ " umount -a | -A [-fv] [-h host] [-t type]");
- exit(1);
- }
---- a/sbin/umount/umount.8
-+++ b/sbin/umount/umount.8
-@@ -40,7 +40,6 @@
- .Ar special ... | node ... | fsid ...
- .Nm
- .Fl a | A
--.Op Fl F Ar fstab
- .Op Fl fv
- .Op Fl h Ar host
- .Op Fl t Ar type
-@@ -69,10 +68,6 @@
- .It Fl A
- All the currently mounted file systems except
- the root are unmounted.
--.It Fl F Ar fstab
--Specify the
--.Pa fstab
--file to use.
- .It Fl f
- The file system is forcibly unmounted.
- Active special devices continue to work,
Modified: trunk/freebsd-utils/debian/patches/022_devd.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/022_devd.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/022_devd.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -47,7 +47,7 @@
pid-file "/var/run/devd.pid";
# Setup some shorthand for regex that we use later in the file.
-@@ -27,54 +23,6 @@
+@@ -27,144 +23,6 @@
# Note that the attach/detach with the highest value wins, so that one can
# override these general rules.
@@ -62,6 +62,7 @@
-#
-notify 0 {
- match "system" "IFNET";
+- match "subsystem" "!usbus[0-9]+";
- match "type" "ATTACH";
- action "/etc/pccard_ether $subsystem start";
-};
@@ -99,13 +100,18 @@
- action "/etc/rc.d/dhclient quietstart $subsystem";
-};
-
- # An entry like this might be in a different file, but is included here
- # as an example of how to override things. Normally 'ed50' would match
- # the above attach/detach stuff, but the value of 100 makes it
-@@ -87,74 +35,6 @@
- device-name "ed50";
- };
-
+-# An entry like this might be in a different file, but is included here
+-# as an example of how to override things. Normally 'ed50' would match
+-# the above attach/detach stuff, but the value of 100 makes it
+-# hard wired to 1.2.3.4.
+-attach 100 {
+- device-name "ed50";
+- action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
+-};
+-detach 100 {
+- device-name "ed50";
+-};
+-
-# When a USB Bluetooth dongle appears, activate it
-attach 100 {
- device-name "ubt[0-9]+";
@@ -133,14 +139,22 @@
- action "/etc/rc.d/syscons setkeyboard /dev/kbd0";
-};
-
--attach 100 {
-- device-name "ums[0-9]+";
-- action "/etc/rc.d/moused quietstart $device-name";
+-notify 100 {
+- match "system" "DEVFS";
+- match "subsystem" "CDEV";
+- match "type" "CREATE";
+- match "cdev" "ums[0-9]+";
+-
+- action "/etc/rc.d/moused quietstart $cdev";
-};
-
--detach 100 {
-- device-name "ums[0-9]+";
-- action "/etc/rc.d/moused stop $device-name";
+-notify 100 {
+- match "system" "DEVFS";
+- match "subsystem" "CDEV";
+- match "type" "DESTROY";
+- match "cdev" "ums[0-9]+";
+-
+- action "/etc/rc.d/moused stop $cdev";
-};
-
-# Firmware download into the ActiveWire board. After the firmware download is
@@ -174,10 +188,11 @@
- action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
-};
-
- #
+-#
# Rescan scsi device-names on attach, but not detach. However, it is
# disabled by default due to reports of problems.
-@@ -202,13 +82,6 @@
+ #
+@@ -211,13 +69,6 @@
vendor $vendor bus $bus";
};
@@ -191,7 +206,7 @@
# Notify all users before beginning emergency shutdown when we get
# a _CRT or _HOT thermal event and we're going to power down the system
# very soon.
-@@ -250,19 +123,6 @@
+@@ -259,19 +110,6 @@
action "logger -p kern.warn 'ZFS: checksum mismatch, zpool=$pool path=$vdev_path offset=$zio_offset size=$zio_size'";
};
Modified: trunk/freebsd-utils/debian/patches/025_camcontrol.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/025_camcontrol.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/025_camcontrol.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,24 +1,3 @@
---- a/sbin/camcontrol/camcontrol.c
-+++ b/sbin/camcontrol/camcontrol.c
-@@ -134,12 +134,12 @@
- };
-
- #ifndef MINIMALISTIC
--static const char scsicmd_opts[] = "a:c:dfi:o:r";
--static const char readdefect_opts[] = "f:GP";
--static const char negotiate_opts[] = "acD:M:O:qR:T:UW:";
--static const char smprg_opts[] = "l";
--static const char smppc_opts[] = "a:A:d:lm:M:o:p:s:S:T:";
--static const char smpphylist_opts[] = "lq";
-+static const char scsicmd_opts[] = "+a:c:dfi:o:r";
-+static const char readdefect_opts[] = "+f:GP";
-+static const char negotiate_opts[] = "+acD:M:O:qR:T:UW:";
-+static const char smprg_opts[] = "+l";
-+static const char smppc_opts[] = "+a:A:d:lm:M:o:p:s:S:T:";
-+static const char smpphylist_opts[] = "+lq";
- #endif
-
- struct camcontrol_opts option_table[] = {
--- a/sbin/camcontrol/Makefile
+++ b/sbin/camcontrol/Makefile
@@ -12,7 +12,7 @@
Modified: trunk/freebsd-utils/debian/patches/026_kdump.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/026_kdump.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/026_kdump.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -167,7 +167,7 @@
/*
* These are simple support macros. print_or utilizes a variable
* defined in the calling function to track whether or not it should
-@@ -353,44 +369,44 @@
+@@ -353,47 +369,48 @@
}
_EOF_
@@ -177,38 +177,23 @@
-auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
-auto_or_type "mmapflagsname" "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
-auto_or_type "wait4optname" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h"
-+auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "bits/stat.h"
-+auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "bits/fcntl.h"
-+auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "fcntl.h"
-+auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "bits/mman.h"
-+auto_or_type "mmapflagsname" "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "bits/mman.h"
-+auto_or_type "wait4optname" "W[A-Z]+[[:space:]]+[0-9]+" "bits/waitflags.h"
auto_or_type "getfsstatflagsname" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h"
auto_or_type "mountflagsname" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h"
auto_or_type "rebootoptname" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h"
-auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h"
-+auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "bits/fcntl.h"
auto_or_type "thrcreateflagsname" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h"
-auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
-auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
-auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h"
-+auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "bits/mman.h"
-+auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "bits/shm.h"
-+auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/rfork.h"
- auto_or_type "nfssvcname" "NFSSVC_[A-Z]+[[:space:]]+0x[0-9]+" "nfsserver/nfs.h"
+ auto_or_type "nfssvcname" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
-auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h"
-+auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "stdio.h"
auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h"
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
-auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
-auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
-auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
-auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
-+auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "bits/resource.h"
-+auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "bits/fcntl.h"
-+auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "bits/mman.h"
-+auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "bits/mman.h"
auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h"
auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
auto_switch_type "extattrctlname" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
@@ -216,24 +201,43 @@
auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h"
-auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
-+auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "bits/sigaction.h"
auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h"
-auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
-+auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "bits/mman.h"
auto_switch_type "quotactlname" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h"
-auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
-auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
-+auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "bits/socket.h"
-+auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "bits/socket.h"
auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
-auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
-auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h"
-+auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "bits/socket.h"
-+auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "bits/socket.h"
auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h"
-@@ -405,8 +421,9 @@
++auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "bits/stat.h"
++auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "bits/fcntl.h"
++auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "fcntl.h"
++auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "bits/mman.h"
++auto_or_type "mmapflagsname" "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "bits/mman.h"
++auto_or_type "wait4optname" "W[A-Z]+[[:space:]]+[0-9]+" "bits/waitflags.h"
++auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "bits/fcntl.h"
++auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "bits/mman.h"
++auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "bits/shm.h"
++auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/rfork.h"
++auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "stdio.h"
++auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "bits/resource.h"
++auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "bits/fcntl.h"
++auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "bits/mman.h"
++auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "bits/mman.h"
++auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "bits/sigaction.h"
++auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "bits/mman.h"
++auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "bits/socket.h"
++auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "bits/socket.h"
++auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "bits/socket.h"
++auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "bits/socket.h"
++
+ cat <<_EOF_
+ /*
+ * AUTO - Special
+@@ -405,8 +422,9 @@
{
switch (cmd) {
_EOF_
@@ -244,7 +248,7 @@
awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \
if ($i ~ /define/) \
break; \
-@@ -454,8 +471,9 @@
+@@ -454,8 +472,9 @@
{
switch (func) {
_EOF_
@@ -256,7 +260,7 @@
awk '{ for (i = 1; i <= NF; i++) \
if ($i ~ /define/) \
break; \
-@@ -486,7 +504,8 @@
+@@ -486,7 +505,8 @@
printf("%#x<", flags);
_EOF_
Modified: trunk/freebsd-utils/debian/patches/035_nfs.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/035_nfs.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/035_nfs.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -79,7 +79,7 @@
.include <bsd.prog.mk>
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
-@@ -2066,12 +2066,18 @@
+@@ -2118,12 +2118,18 @@
if (!strcmp(seclist, "sys"))
flavor = AUTH_SYS;
Modified: trunk/freebsd-utils/debian/patches/038_jail.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/038_jail.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/038_jail.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -12,20 +12,20 @@
#include <string.h>
#include <unistd.h>
-+#include <sys/syscall.h>
+
++
+typedef void login_cap_t;
+
-+static inline int
-+setfib(int fib)
-+{
-+ return syscall (SYS_setfib, fib);
-+}
+
++
++
++
++
++
#include "jailp.h"
#define DEFAULT_STOP_TIMEOUT 10
-@@ -589,14 +598,6 @@
+@@ -591,14 +600,6 @@
if (term != NULL)
setenv("TERM", term, 1);
}
@@ -40,7 +40,7 @@
setenv("USER", pwd->pw_name, 1);
setenv("HOME", pwd->pw_dir, 1);
setenv("SHELL",
-@@ -769,12 +770,6 @@
+@@ -775,12 +776,6 @@
jail_warnx(j, "unknown uid %d", getuid());
return -1;
}
Modified: trunk/freebsd-utils/debian/patches/pf_regex_c.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/pf_regex_c.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/pf_regex_c.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,13 +1,18 @@
+#!/bin/bash
-Generated with:
+# You can execute this patch in order to generate a patched directory
-find . -type f -name \*.c -or -name \*.y | grep -v "/\.svn/" | \
- while read i ; do \
- sed -i $i \
- -e 's/defined\( \|\t\)*(\( \|\t\)*__FreeBSD__\( \|\t\)*)/defined(__FreeBSD_kernel__)/g' \
- -e 's/#\( \|\t\)*ifdef\( \|\t\)*__FreeBSD__/#ifdef __FreeBSD_kernel__/g' \
- -e 's/#\( \|\t\)*ifndef\( \|\t\)*__FreeBSD__/#ifndef __FreeBSD_kernel__/g' \
+for d in b/contrib/pf b/sys/contrib/pf ; do \
+ for f in $(find $d -type f -name \*.c -or -name \*.y -or -name \*.h | grep -v "/\.svn/") ; do \
+ sed -i $f \
+ -e 's/defined\( \|\t\)*(\( \|\t\)*__FreeBSD__\( \|\t\)*)/1/g' \
+ -e 's/#\( \|\t\)*ifdef\( \|\t\)*__FreeBSD__/#if 1/g' \
+ -e 's/#\( \|\t\)*ifndef\( \|\t\)*__FreeBSD__/#if 0/g' \
+ ; done \
; done
+
+exit 0
+
--- a/contrib/pf/authpf/authpf.c
+++ b/contrib/pf/authpf/authpf.c
@@ -33,7 +33,7 @@
@@ -15,7 +20,7 @@
#include <err.h>
#include <errno.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <inttypes.h>
#endif
#include <login_cap.h>
@@ -24,7 +29,7 @@
volatile sig_atomic_t want_death;
static void need_death(int signo);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static __dead2 void do_death(int);
#else
static __dead void do_death(int);
@@ -33,7 +38,7 @@
shell = pw->pw_shell;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
login_close(lc);
#endif
@@ -42,7 +47,7 @@
syslog(LOG_ERR, "wrong shell for user %s, uid %u",
pw->pw_name, pw->pw_uid);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
login_close(lc);
#else
if (shell != pw->pw_shell)
@@ -51,7 +56,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
login_close(lc);
#else
if (shell != pw->pw_shell)
@@ -60,7 +65,7 @@
* function that removes our stuff when we go away.
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static __dead2 void
#else
static __dead void
@@ -71,7 +76,7 @@
/* We don't care about truncation. */
vsnprintf(buf, sizeof buf, message, ap);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
strvis(visbuf, buf, VIS_CSTYLE | VIS_NL);
#else
strnvis(visbuf, buf, sizeof visbuf, VIS_CSTYLE | VIS_NL);
@@ -82,7 +87,7 @@
#endif
-#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
-+#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD_kernel__)
++#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !1
#define INTPTR(x) (intptr_t)x
#else
#define INTPTR(x) x
@@ -93,7 +98,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/sysctl.h>
#endif
#include <net/if.h>
@@ -102,7 +107,7 @@
free($9.queues.pqname);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
r.divert.port = $9.divert.port;
#else
if ((r.divert.port = $9.divert.port)) {
@@ -111,7 +116,7 @@
}
| DIVERTTO portplain {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
filter_opts.divert.port = $2.a;
if (!filter_opts.divert.port) {
yyerror("invalid divert port: %u", ntohs($2.a));
@@ -120,7 +125,7 @@
}
| DIVERTTO STRING PORT portplain {
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if ((filter_opts.divert.addr = host($2)) == NULL) {
yyerror("could not parse divert address: %s",
$2);
@@ -129,7 +134,7 @@
}
| DIVERTREPLY {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
yyerror("divert-reply has no meaning in FreeBSD pf(4)");
YYERROR;
#else
@@ -138,7 +143,7 @@
/* ie. for 10/8 parsing */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (asprintf(&buf, "%lld/%lld", (long long)$1, (long long)$3) == -1)
#else
if (asprintf(&buf, "%lld/%lld", $1, $3) == -1)
@@ -147,7 +152,7 @@
rt_tableid_max(void)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int fibs;
size_t l = sizeof(fibs);
@@ -158,7 +163,7 @@
static double sc_x2y(struct service_curve *, double);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int32_t getifspeed(int, char *);
#else
u_int32_t getifspeed(char *);
@@ -167,7 +172,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (a->local_flags & PFALTQ_FLAG_IF_REMOVED)
printf("INACTIVE ");
#endif
@@ -176,7 +181,7 @@
unsigned int i;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (a->local_flags & PFALTQ_FLAG_IF_REMOVED)
printf("INACTIVE ");
#endif
@@ -185,7 +190,7 @@
pa->ifbandwidth = bw->bw_absolute;
else
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((rate = getifspeed(pf->dev, pa->ifname)) == 0) {
#else
if ((rate = getifspeed(pa->ifname)) == 0) {
@@ -194,7 +199,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXX
* FreeBSD does not have SIOCGIFDATA.
@@ -203,7 +208,7 @@
errx(1, "getifmtu: strlcpy");
if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) == -1)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ifr.ifr_mtu = 1500;
#else
err(1, "SIOCGIFMTU");
@@ -214,7 +219,7 @@
#include <sys/stat.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/endian.h>
#endif
@@ -223,7 +228,7 @@
if (errno == EEXIST)
errx(1, "pf already enabled");
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
else if (errno == ESRCH)
errx(1, "pfil registeration failed");
#endif
@@ -232,7 +237,7 @@
mib[0] = CTL_HW;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
mib[1] = HW_PHYSMEM;
#else
mib[1] = HW_PHYSMEM64;
@@ -241,10 +246,21 @@
opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
clearopt = showopt = debugopt = NULL;
-#if defined(__FreeBSD__) && !defined(ENABLE_ALTQ)
-+#if defined(__FreeBSD_kernel__) && !defined(ENABLE_ALTQ)
++#if 1 && !defined(ENABLE_ALTQ)
altqsupport = 0;
#else
altqsupport = 1;
+--- a/contrib/pf/pfctl/pfctl.h
++++ b/contrib/pf/pfctl/pfctl.h
+@@ -86,7 +86,7 @@
+ int pfctl_show_ifaces(const char *, int);
+ FILE *pfctl_fopen(const char *, const char *);
+
+-#ifdef __FreeBSD__
++#if 1
+ extern int altqsupport;
+ extern int dummynetsupport;
+ #define HTONL(x) (x) = htonl((__uint32_t)(x))
--- a/contrib/pf/pfctl/pfctl_optimize.c
+++ b/contrib/pf/pfctl/pfctl_optimize.c
@@ -862,7 +862,7 @@
@@ -252,7 +268,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (por2 == NULL)
#else
if (por2 == TAILQ_END(&block->sb_rules))
@@ -263,7 +279,7 @@
for (i = 0; i < SCNT_MAX; i++) {
printf(" %-25s %14lld ", pf_scounters[i],
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(long long)s->scounters[i]);
#else
s->scounters[i]);
@@ -272,7 +288,7 @@
for (i = 0; i < LCNT_MAX; i++) {
printf(" %-25s %14lld ", pf_lcounters[i],
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(unsigned long long)s->lcounters[i]);
#else
s->lcounters[i]);
@@ -281,7 +297,7 @@
}
printf(", %llu pkts, %llu bytes",
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(unsigned long long)(sn->packets[0] + sn->packets[1]),
(unsigned long long)(sn->bytes[0] + sn->bytes[1]));
#else
@@ -290,10 +306,21 @@
printf(" rtable %u", r->rtableid);
if (r->divert.port) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
printf(" divert-to %u", ntohs(r->divert.port));
#else
if (PF_AZERO(&r->divert.addr, r->af)) {
+--- a/contrib/pf/pfctl/pfctl_parser.h
++++ b/contrib/pf/pfctl/pfctl_parser.h
+@@ -159,7 +159,7 @@
+ } data;
+ };
+
+-#ifdef __FreeBSD__
++#if 1
+ /*
+ * XXX
+ * Absolutely this is not correct location to define this.
--- a/contrib/pf/pfctl/pfctl_qstats.c
+++ b/contrib/pf/pfctl/pfctl_qstats.c
@@ -89,7 +89,7 @@
@@ -301,7 +328,7 @@
int nodes, dotitle = (opts & PF_OPT_SHOWALL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!altqsupport)
return (-1);
#endif
@@ -310,7 +337,7 @@
if (iface != NULL && strcmp(node->altq.ifname, iface))
continue;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (node->altq.local_flags & PFALTQ_FLAG_IF_REMOVED)
continue;
#endif
@@ -319,7 +346,7 @@
return (-1);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pa.altq.qid > 0 &&
!(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) {
#else
@@ -328,7 +355,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
else if (pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED) {
memset(&qstats.data, 0, sizeof(qstats.data));
if ((node = pfctl_find_altq_node(*root, pa.altq.qname,
@@ -337,7 +364,7 @@
return;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (a->altq.local_flags & PFALTQ_FLAG_IF_REMOVED)
return;
#endif
@@ -348,7 +375,7 @@
#include <sys/types.h>
#include <sys/socket.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/endian.h>
#define betoh64 be64toh
#endif
@@ -357,7 +384,7 @@
bcopy(s->bytes[1], &bytes[1], sizeof(u_int64_t));
printf(", %llu:%llu pkts, %llu:%llu bytes",
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(unsigned long long)betoh64(packets[0]),
(unsigned long long)betoh64(packets[1]),
(unsigned long long)betoh64(bytes[0]),
@@ -366,7 +393,7 @@
bcopy(&s->id, &id, sizeof(u_int64_t));
printf(" id: %016llx creatorid: %08x",
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(unsigned long long)betoh64(id), ntohl(s->creatorid));
#else
betoh64(id), ntohl(s->creatorid));
@@ -377,7 +404,7 @@
#include <stdarg.h>
#include <fcntl.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <ifaddrs.h>
#include "pidfile.h"
#else
@@ -386,7 +413,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
__dead2 void
#else
__dead void
@@ -395,7 +422,7 @@
if_exists(char *ifname)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ifaddrs *ifdata, *mb;
int exists = 0;
@@ -404,7 +431,7 @@
{
struct pcap_file_header hdr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pcap_sf_pkthdr ph;
#else
struct pcap_pkthdr ph;
@@ -413,7 +440,7 @@
{
FILE *f = (FILE *)user;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pcap_sf_pkthdr sh;
#endif
@@ -422,7 +449,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sh.ts.tv_sec = (bpf_int32)h->ts.tv_sec;
sh.ts.tv_usec = (bpf_int32)h->ts.tv_usec;
sh.caplen = h->caplen;
@@ -431,7 +458,7 @@
/* try to undo header to prevent corruption */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pos < sizeof(sh) ||
ftruncate(fileno(f), pos - sizeof(sh))) {
#else
@@ -440,7 +467,7 @@
{
FILE *f = (FILE *)user;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pcap_sf_pkthdr sh;
size_t len = sizeof(sh) + h->caplen;
#else
@@ -449,7 +476,7 @@
append:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sh.ts.tv_sec = (bpf_int32)h->ts.tv_sec;
sh.ts.tv_usec = (bpf_int32)h->ts.tv_usec;
sh.caplen = h->caplen;
@@ -460,7 +487,7 @@
#include <stdlib.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "pidfile.h"
#else
#include <util.h>
@@ -471,7 +498,7 @@
struct passwd *pw;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
for (i = 1; i < NSIG; i++)
#else
for (i = 1; i < _NSIG; i++)
@@ -482,7 +509,7 @@
pfr.rule.log = rule_log;
pfr.rule.keep_state = 1;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0);
pfr.rule.flagset = (proto == IPPROTO_TCP ?
(TH_SYN|TH_ACK|TH_FIN|TH_RST) : 0);
@@ -493,7 +520,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_bpf.h"
@@ -502,7 +529,7 @@
#include <sys/proc.h>
#include <sys/socket.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/malloc.h>
@@ -511,7 +538,7 @@
#include <net/if.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <net/if_clone.h>
#endif
#include <net/if_types.h>
@@ -520,7 +547,7 @@
#include <net/if_pflog.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef INET
#include <machine/in_cksum.h>
#endif /* INET */
@@ -529,7 +556,7 @@
void pflogattach(int);
int pflogoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct route *);
#else
struct rtentry *);
@@ -537,7 +564,7 @@
int pflogioctl(struct ifnet *, u_long, caddr_t);
void pflogstart(struct ifnet *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static int pflog_clone_create(struct if_clone *, int, caddr_t);
static void pflog_clone_destroy(struct ifnet *);
#else
@@ -546,7 +573,7 @@
LIST_HEAD(, pflog_softc) pflogif_list;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
IFC_SIMPLE_DECLARE(pflog, 1);
#else
struct if_clone pflog_cloner =
@@ -555,7 +582,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static int
pflog_clone_create(struct if_clone *ifc, int unit, caddr_t param)
#else
@@ -564,7 +591,7 @@
pflogif->sc_unit = unit;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ifp = pflogif->sc_ifp = if_alloc(IFT_PFLOG);
if (ifp == NULL) {
free(pflogif, M_DEVBUF);
@@ -573,20 +600,20 @@
ifp->if_output = pflogoutput;
ifp->if_start = pflogstart;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
ifp->if_type = IFT_PFLOG;
#endif
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_hdrlen = PFLOG_HDRLEN;
if_attach(ifp);
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if_alloc_sadl(ifp);
#endif
#if NBPFILTER > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
bpfattach(ifp, DLT_PFLOG, PFLOG_HDRLEN);
#else
bpfattach(&pflogif->sc_if.if_bpf, ifp, DLT_PFLOG, PFLOG_HDRLEN);
@@ -595,14 +622,14 @@
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* 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 __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -611,7 +638,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static void
pflog_clone_destroy(struct ifnet *ifp)
#else
@@ -620,13 +647,13 @@
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
pflogifs[pflogif->sc_unit] = NULL;
LIST_REMOVE(pflogif, sc_list);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -635,12 +662,12 @@
#endif
if_detach(ifp);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if_free(ifp);
#endif
free(pflogif, M_DEVBUF);
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
return (0);
#endif
}
@@ -649,13 +676,13 @@
{
struct mbuf *m;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
int s;
#endif
for (;;) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
IF_LOCK(&ifp->if_snd);
_IF_DROP(&ifp->if_snd);
_IF_DEQUEUE(&ifp->if_snd, m);
@@ -664,7 +691,7 @@
int
pflogoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct route *rt)
#else
struct rtentry *rt)
@@ -673,7 +700,7 @@
switch (cmd) {
case SIOCSIFFLAGS:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (ifp->if_flags & IFF_UP)
ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
@@ -682,7 +709,7 @@
}
if (rm->log & PF_LOG_SOCKET_LOOKUP && !pd->lookup.done)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXX: This should not happen as we force an early lookup
* via debug.pfugidhack
@@ -691,7 +718,7 @@
ifn->if_opackets++;
ifn->if_obytes += m->m_pkthdr.len;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
BPF_MTAP2(ifn, &hdr, PFLOG_HDRLEN, m);
#else
bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, PFLOG_HDRLEN, m,
@@ -700,10 +727,41 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static int
pflog_modevent(module_t mod, int type, void *data)
{
+--- a/sys/contrib/pf/net/if_pflog.h
++++ b/sys/contrib/pf/net/if_pflog.h
+@@ -30,7 +30,7 @@
+ #define PFLOGIFS_MAX 16
+
+ struct pflog_softc {
+-#ifdef __FreeBSD__
++#if 1
+ struct ifnet *sc_ifp; /* the interface pointer */
+ #else
+ struct ifnet sc_if; /* the interface */
+@@ -74,7 +74,7 @@
+ #define OLD_PFLOG_HDRLEN sizeof(struct old_pfloghdr)
+
+ #ifdef _KERNEL
+-#ifdef __FreeBSD__
++#if 1
+ struct pf_rule;
+ struct pf_ruleset;
+ struct pfi_kif;
+--- a/sys/contrib/pf/net/if_pflow.h
++++ b/sys/contrib/pf/net/if_pflow.h
+@@ -66,7 +66,7 @@
+ unsigned int sc_maxcount;
+ u_int64_t sc_gcounter;
+ struct ip_moptions sc_imo;
+-#ifdef __FreeBSD__
++#if 1
+ struct callout sc_tmo;
+ #else
+ struct timeout sc_tmo;
--- a/sys/contrib/pf/net/if_pfsync.c
+++ b/sys/contrib/pf/net/if_pfsync.c
@@ -52,7 +52,7 @@
@@ -711,7 +769,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_pf.h"
@@ -720,7 +778,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/priv.h>
@@ -729,7 +787,7 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/endian.h>
#include <sys/malloc.h>
#include <sys/module.h>
@@ -738,13 +796,13 @@
#endif
#include <sys/sysctl.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/pool.h>
#endif
#include <net/if.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <net/if_clone.h>
#endif
#include <net/if_types.h>
@@ -752,7 +810,7 @@
#include <net/bpf.h>
#include <net/netisr.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <net/vnet.h>
#endif
@@ -761,7 +819,7 @@
#endif /* INET6 */
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include "carp.h"
#endif
#if NCARP > 0
@@ -770,7 +828,7 @@
#include <net/if_pfsync.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include "bpfilter.h"
#include "pfsync.h"
#endif
@@ -779,7 +837,7 @@
struct pf_state *pd_st;
struct mbuf *pd_m;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct callout pd_tmo;
#else
struct timeout pd_tmo;
@@ -788,7 +846,7 @@
struct pfsync_softc {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ifnet *sc_ifp;
#else
struct ifnet sc_if;
@@ -796,7 +854,7 @@
struct ifnet *sc_sync_if;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
uma_zone_t sc_pool;
#else
struct pool sc_pool;
@@ -805,7 +863,7 @@
struct in_addr sc_sync_peer;
u_int8_t sc_maxupdates;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int pfsync_sync_ok;
#endif
@@ -814,7 +872,7 @@
u_int32_t sc_ureq_sent;
int sc_bulk_tries;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct callout sc_bulkfail_tmo;
#else
struct timeout sc_bulkfail_tmo;
@@ -823,7 +881,7 @@
struct pf_state *sc_bulk_next;
struct pf_state *sc_bulk_last;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct callout sc_bulk_tmo;
#else
struct timeout sc_bulk_tmo;
@@ -832,7 +890,7 @@
TAILQ_HEAD(, tdb) sc_tdb_q;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct callout sc_tmo;
#else
struct timeout sc_tmo;
@@ -840,7 +898,7 @@
};
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync data");
static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL;
#define V_pfsyncif VNET(pfsyncif)
@@ -849,7 +907,7 @@
void pfsyncattach(int);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int pfsync_clone_create(struct if_clone *, int, caddr_t);
void pfsync_clone_destroy(struct ifnet *);
#else
@@ -858,7 +916,7 @@
void pfsync_update_net_tdb(struct pfsync_tdb *);
int pfsyncoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct route *);
#else
struct rtentry *);
@@ -867,7 +925,7 @@
void pfsync_bulk_fail(void *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX: ugly */
#define betoh64 (unsigned long long)be64toh
#define timeout_del callout_stop
@@ -875,12 +933,12 @@
#define PFSYNC_MAX_BULKTRIES 12
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
int pfsync_sync_ok;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -889,7 +947,7 @@
}
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pfsync_clone_create(struct if_clone *ifc, int unit, caddr_t param)
#else
pfsync_clone_create(struct if_clone *ifc, int unit)
@@ -898,7 +956,7 @@
return (EINVAL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | M_ZERO);
sc->pfsync_sync_ok = 1;
#else
@@ -907,7 +965,7 @@
TAILQ_INIT(&sc->sc_qs[q]);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, NULL, NULL, NULL,
NULL, UMA_ALIGN_PTR, 0);
#else
@@ -916,7 +974,7 @@
sc->sc_maxupdates = 128;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
sc->sc_imo.imo_membership = (struct in_multi **)malloc(
(sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS,
M_WAITOK | M_ZERO);
@@ -924,7 +982,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ifp = sc->sc_ifp = if_alloc(IFT_PFSYNC);
if (ifp == NULL) {
uma_zdestroy(sc->sc_pool);
@@ -933,7 +991,7 @@
ifp->if_hdrlen = sizeof(struct pfsync_header);
ifp->if_mtu = ETHERMTU;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -942,7 +1000,7 @@
if_attach(ifp);
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if_alloc_sadl(ifp);
#endif
@@ -951,7 +1009,7 @@
#if NBPFILTER > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
bpfattach(ifp, DLT_PFSYNC, PFSYNC_HDRLEN);
#else
bpfattach(&sc->sc_if.if_bpf, ifp, DLT_PFSYNC, PFSYNC_HDRLEN);
@@ -959,7 +1017,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfsyncif = sc;
#else
pfsyncif = sc;
@@ -968,7 +1026,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void
#else
int
@@ -977,20 +1035,20 @@
struct pfsync_softc *sc = ifp->if_softc;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
timeout_del(&sc->sc_bulkfail_tmo);
timeout_del(&sc->sc_bulk_tmo);
timeout_del(&sc->sc_tmo);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sc->pfsync_sync_ok)
#else
if (!pfsync_sync_ok)
@@ -999,13 +1057,13 @@
pfsync_undefer(TAILQ_FIRST(&sc->sc_deferrals), 0);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
UMA_DESTROY(sc->sc_pool);
#else
pool_destroy(&sc->sc_pool);
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if_free(ifp);
if (sc->sc_imo.imo_membership)
pfsync_multicast_cleanup(sc);
@@ -1014,14 +1072,14 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfsyncif = NULL;
#else
pfsyncif = NULL;
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
return (0);
#endif
}
@@ -1030,12 +1088,12 @@
{
struct mbuf *m;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
int s;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
IF_LOCK(&ifp->if_snd);
_IF_DROP(&ifp->if_snd);
_IF_DEQUEUE(&ifp->if_snd, m);
@@ -1044,7 +1102,7 @@
while ((m = pfsync_if_dequeue(ifp)) != NULL) {
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
IF_DROP(&ifp->if_snd);
#endif
m_freem(m);
@@ -1053,7 +1111,7 @@
{
if (s->scrub.scrub_flag && d->scrub == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -1062,7 +1120,7 @@
}
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
void
pfsync_state_export(struct pfsync_state *sp, struct pf_state *st)
{
@@ -1071,7 +1129,7 @@
int error;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
if (sp->creatorid == 0 && V_pf_status.debug >= PF_DEBUG_MISC) {
@@ -1080,7 +1138,7 @@
if ((kif = pfi_kif_get(sp->ifname)) == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1089,7 +1147,7 @@
PF_RULESET_FILTER].active.ptr_array[ntohl(sp->rule)];
else
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
r = &V_pf_default_rule;
#else
r = &pf_default_rule;
@@ -1098,7 +1156,7 @@
goto cleanup;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (flags & PFSYNC_SI_IOCTL)
pool_flags = PR_WAITOK | PR_ZERO;
else
@@ -1107,7 +1165,7 @@
if (skw == sks)
sks = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (skw != NULL)
pool_put(&V_pf_state_key_pl, skw);
if (sks != NULL)
@@ -1116,7 +1174,7 @@
cleanup_state: /* pf_state_insert frees the state keys */
if (st) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (st->dst.scrub)
pool_put(&V_pf_state_scrub_pl, st->dst.scrub);
if (st->src.scrub)
@@ -1125,14 +1183,14 @@
void
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pfsync_input(struct mbuf *m, __unused int off)
#else
pfsync_input(struct mbuf *m, ...)
#endif
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1141,7 +1199,7 @@
/* verify that we have a sync interface configured */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sc || !sc->sc_sync_if || !V_pf_status.running)
#else
if (!sc || !sc->sc_sync_if || !pf_status.running)
@@ -1150,7 +1208,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_ifp->if_ipackets++;
sc->sc_ifp->if_ibytes += m->m_pkthdr.len;
#else
@@ -1159,7 +1217,7 @@
pkt.flags = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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))
@@ -1168,7 +1226,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1176,7 +1234,7 @@
if (clr[i].ifname[0] == '\0') {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -1185,7 +1243,7 @@
/* XXX correct? */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
for (sk = RB_MIN(pf_state_tree, &V_pf_statetbl);
#else
for (sk = RB_MIN(pf_state_tree, &pf_statetbl);
@@ -1193,7 +1251,7 @@
sk; sk = nextsk) {
nextsk = RB_NEXT(pf_state_tree,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
&V_pf_statetbl, sk);
#else
&pf_statetbl, sk);
@@ -1202,7 +1260,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1211,7 +1269,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1220,7 +1278,7 @@
sp->direction > PF_OUT ||
(sp->af != AF_INET && sp->af != AF_INET6)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1229,7 +1287,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1238,7 +1296,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1247,7 +1305,7 @@
pfsync_deferred(st, 0);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1256,7 +1314,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1265,7 +1323,7 @@
sp->src.state > PF_TCPS_PROXY_DST ||
sp->dst.state > PF_TCPS_PROXY_DST) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1274,7 +1332,7 @@
if (sfail) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1283,7 +1341,7 @@
st->pfsync_time = time_uptime;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1292,7 +1350,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1301,7 +1359,7 @@
up->src.state > PF_TCPS_PROXY_DST ||
up->dst.state > PF_TCPS_PROXY_DST) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1310,7 +1368,7 @@
if (sfail) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -1319,7 +1377,7 @@
st->pfsync_time = time_uptime;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1328,7 +1386,7 @@
ura = (struct pfsync_upd_req *)(mp->m_data + offp);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1337,7 +1395,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
@@ -1346,7 +1404,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1355,7 +1413,7 @@
pf_unlink_state(st);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1364,7 +1422,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++) {
@@ -1373,7 +1431,7 @@
pf_unlink_state(st);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1382,7 +1440,7 @@
pfsync_in_bus(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1391,7 +1449,7 @@
switch (bus->status) {
case PFSYNC_BUS_START:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_bulkfail_tmo, 4 * hz +
V_pf_pool_limits[PF_LIMIT_STATES].limit /
((sc->sc_ifp->if_mtu - PFSYNC_MINPKT) /
@@ -1400,7 +1458,7 @@
sizeof(struct pfsync_state)));
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1409,7 +1467,7 @@
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sc->pfsync_sync_ok)
#else
if (!pfsync_sync_ok)
@@ -1418,13 +1476,13 @@
#endif
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->pfsync_sync_ok = 1;
#else
pfsync_sync_ok = 1;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1433,7 +1491,7 @@
"bulk update end\n");
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1442,13 +1500,13 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < count; i++)
pfsync_update_net_tdb(&tp[i]);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1457,7 +1515,7 @@
bad:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -1466,7 +1524,7 @@
int
pfsyncoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct route *rt)
#else
struct rtentry *rt)
@@ -1475,7 +1533,7 @@
pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
struct proc *p = curproc;
#endif
struct pfsync_softc *sc = ifp->if_softc;
@@ -1484,7 +1542,7 @@
#endif
case SIOCSIFFLAGS:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (ifp->if_flags & IFF_UP)
ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
@@ -1493,12 +1551,12 @@
if (ifr->ifr_mtu < ifp->if_mtu) {
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
pfsync_sendout();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1507,7 +1565,7 @@
case SIOCSETPFSYNC:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((error = priv_check(curthread, PRIV_NETINET_PF)) != 0)
#else
if ((error = suser(p, p->p_acflag)) != 0)
@@ -1516,12 +1574,12 @@
return (error);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
if (pfsyncr.pfsyncr_syncpeer.s_addr == 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_sync_peer.s_addr = htonl(INADDR_PFSYNC_GROUP);
#else
sc->sc_sync_peer.s_addr = INADDR_PFSYNC_GROUP;
@@ -1530,13 +1588,13 @@
if (pfsyncr.pfsyncr_maxupdates > 255)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
PF_UNLOCK();
#endif
return (EINVAL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
}
#endif
sc->sc_maxupdates = pfsyncr.pfsyncr_maxupdates;
@@ -1544,7 +1602,7 @@
if (pfsyncr.pfsyncr_syncdev[0] == 0) {
sc->sc_sync_if = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
if (imo->imo_membership)
pfsync_multicast_cleanup(sc);
@@ -1553,19 +1611,19 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
if ((sifp = ifunit(pfsyncr.pfsyncr_syncdev)) == NULL)
return (EINVAL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sifp->if_mtu < sc->sc_ifp->if_mtu ||
#else
if (sifp->if_mtu < sc->sc_if.if_mtu ||
@@ -1574,7 +1632,7 @@
sc->sc_sync_if = sifp;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (imo->imo_membership) {
PF_UNLOCK();
pfsync_multicast_cleanup(sc);
@@ -1583,7 +1641,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sc->sc_sync_if &&
sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) {
PF_UNLOCK();
@@ -1592,7 +1650,7 @@
ip->ip_tos = IPTOS_LOWDELAY;
/* len and id are set later */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ip->ip_off = IP_DF;
#else
ip->ip_off = htons(IP_DF);
@@ -1601,7 +1659,7 @@
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sc->pfsync_sync_ok)
#else
if (pfsync_sync_ok)
@@ -1610,20 +1668,20 @@
#endif
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->pfsync_sync_ok = 0;
#else
pfsync_sync_ok = 0;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_bulkfail_tmo, 5 * hz,
pfsync_bulk_fail, V_pfsyncif);
#else
@@ -1632,7 +1690,7 @@
pfsync_request_update(0, 0);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
@@ -1641,7 +1699,7 @@
TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) {
#ifdef PFSYNC_DEBUG
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(st->sync_state == q,
("%s: st->sync_state == q",
__FUNCTION__));
@@ -1650,7 +1708,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void pfsync_sendout()
{
pfsync_sendout1(1);
@@ -1659,7 +1717,7 @@
#endif
#if NBPFILTER > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ifnet *ifp = sc->sc_ifp;
#else
struct ifnet *ifp = &sc->sc_if;
@@ -1668,14 +1726,14 @@
struct tdb *t;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
size_t pktlen;
#endif
int offset;
int q, count = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_NET);
@@ -1684,7 +1742,7 @@
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_ifp->if_oerrors++;
#else
sc->sc_if.if_oerrors++;
@@ -1693,7 +1751,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pktlen = max_linkhdr + sc->sc_len;
if (pktlen > MHLEN) {
/* Find the right pool to allocate from. */
@@ -1702,7 +1760,7 @@
if (!ISSET(m->m_flags, M_EXT)) {
m_free(m);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_ifp->if_oerrors++;
#else
sc->sc_if.if_oerrors++;
@@ -1711,7 +1769,7 @@
offset = sizeof(*ip);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ip->ip_len = m->m_pkthdr.len;
#else
ip->ip_len = htons(m->m_pkthdr.len);
@@ -1720,7 +1778,7 @@
ph->version = PFSYNC_VERSION;
ph->len = htons(sc->sc_len - sizeof(*ip));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
bcopy(V_pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH);
#else
bcopy(pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH);
@@ -1729,7 +1787,7 @@
TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) {
#ifdef PFSYNC_DEBUG
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(st->sync_state == q,
("%s: st->sync_state == q",
__FUNCTION__));
@@ -1738,7 +1796,7 @@
m->m_data += sizeof(*ip);
m->m_len = m->m_pkthdr.len = sc->sc_len - sizeof(*ip);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
BPF_MTAP(ifp, m);
#else
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
@@ -1747,7 +1805,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_ifp->if_opackets++;
sc->sc_ifp->if_obytes += m->m_pkthdr.len;
sc->sc_len = PFSYNC_MINPKT;
@@ -1756,14 +1814,14 @@
pfsync_insert_state(struct pf_state *st)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -1772,7 +1830,7 @@
#ifdef PFSYNC_DEBUG
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(st->sync_state == PFSYNC_S_NONE,
("%s: st->sync_state == PFSYNC_S_NONE", __FUNCTION__));
#else
@@ -1781,7 +1839,7 @@
if (sc->sc_len == PFSYNC_MINPKT)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout,
V_pfsyncif);
#else
@@ -1790,7 +1848,7 @@
pfsync_defer(struct pf_state *st, struct mbuf *m)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1798,7 +1856,7 @@
struct pfsync_deferral *pd;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -1807,7 +1865,7 @@
sc->sc_deferred++;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m->m_flags |= M_SKIP_FIREWALL;
#else
m->m_pkthdr.pf.flags |= PF_TAG_GENERATED;
@@ -1816,7 +1874,7 @@
TAILQ_INSERT_TAIL(&sc->sc_deferrals, pd, pd_entry);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_init(&pd->pd_tmo, CALLOUT_MPSAFE);
callout_reset(&pd->pd_tmo, defer, pfsync_defer_tmo,
pd);
@@ -1825,7 +1883,7 @@
pfsync_undefer(struct pfsync_deferral *pd, int drop)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1833,7 +1891,7 @@
int s;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -1842,14 +1900,14 @@
else {
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX: use pf_defered?! */
PF_UNLOCK();
#endif
ip_output(pd->pd_m, (void *)NULL, (void *)NULL, 0,
(void *)NULL, (void *)NULL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
splx(s);
@@ -1858,20 +1916,20 @@
pfsync_defer_tmo(void *arg)
{
-#if defined(__FreeBSD__) && defined(VIMAGE)
-+#if defined(__FreeBSD_kernel__) && defined(VIMAGE)
++#if 1 && defined(VIMAGE)
struct pfsync_deferral *pd = arg;
#endif
int s;
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_SET(pd->pd_m->m_pkthdr.rcvif->if_vnet); /* XXX */
PF_LOCK();
#endif
pfsync_undefer(arg, 0);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
CURVNET_RESTORE();
#endif
@@ -1880,7 +1938,7 @@
pfsync_deferred(struct pf_state *st, int drop)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1889,7 +1947,7 @@
pfsync_update_state(struct pf_state *st)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1897,7 +1955,7 @@
int sync = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -1906,7 +1964,7 @@
if (sc->sc_len == PFSYNC_MINPKT)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout,
V_pfsyncif);
#else
@@ -1915,7 +1973,7 @@
pfsync_request_update(u_int32_t creatorid, u_int64_t id)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1924,7 +1982,7 @@
nlen += sizeof(struct pfsync_subheader);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) {
#else
if (sc->sc_len + nlen > sc->sc_if.if_mtu) {
@@ -1933,7 +1991,7 @@
pfsync_update_state_req(struct pf_state *st)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1942,14 +2000,14 @@
pfsync_delete_state(struct pf_state *st)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -1958,7 +2016,7 @@
if (sc->sc_len == PFSYNC_MINPKT)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout,
V_pfsyncif);
#else
@@ -1967,14 +2025,14 @@
} __packed r;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#else
splassert(IPL_SOFTNET);
@@ -1983,7 +2041,7 @@
pfsync_q_ins(struct pf_state *st, int q)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -1992,7 +2050,7 @@
PF_LOCK_ASSERT();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(st->sync_state == PFSYNC_S_NONE,
("%s: st->sync_state == PFSYNC_S_NONE", __FUNCTION__));
#else
@@ -2001,7 +2059,7 @@
#if 1 || defined(PFSYNC_DEBUG)
if (sc->sc_len < PFSYNC_MINPKT)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
panic("pfsync pkt len is too low %zu", sc->sc_len);
#else
panic("pfsync pkt len is too low %d", sc->sc_len);
@@ -2010,7 +2068,7 @@
nlen += sizeof(struct pfsync_subheader);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) {
#else
if (sc->sc_len + nlen > sc->sc_if.if_mtu) {
@@ -2019,7 +2077,7 @@
pfsync_q_del(struct pf_state *st)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2027,7 +2085,7 @@
int q = st->sync_state;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(st->sync_state != PFSYNC_S_NONE,
("%s: st->sync_state != PFSYNC_S_NONE", __FUNCTION__));
#else
@@ -2036,7 +2094,7 @@
pfsync_update_tdb(struct tdb *t, int output)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2045,7 +2103,7 @@
pfsync_delete_tdb(struct tdb *t)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2054,14 +2112,14 @@
pfsync_bulk_start(void)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -2069,7 +2127,7 @@
printf("pfsync: received bulk update request\n");
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
if (TAILQ_EMPTY(&V_state_list))
#else
@@ -2078,7 +2136,7 @@
sc->sc_ureq_received = time_uptime;
if (sc->sc_bulk_next == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->sc_bulk_next = TAILQ_FIRST(&V_state_list);
#else
sc->sc_bulk_next = TAILQ_FIRST(&state_list);
@@ -2087,7 +2145,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_SET(sc->sc_ifp->if_vnet);
#endif
for (;;) {
@@ -2096,7 +2154,7 @@
st = TAILQ_NEXT(st, entry_list);
if (st == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
st = TAILQ_FIRST(&V_state_list);
#else
st = TAILQ_FIRST(&state_list);
@@ -2105,7 +2163,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (i > 1 && (sc->sc_ifp->if_mtu - sc->sc_len) <
#else
if (i > 1 && (sc->sc_if.if_mtu - sc->sc_len) <
@@ -2114,7 +2172,7 @@
/* we've filled a packet */
sc->sc_bulk_next = st;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_bulk_tmo, 1,
pfsync_bulk_update, sc);
#else
@@ -2123,7 +2181,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_RESTORE();
#endif
splx(s);
@@ -2132,7 +2190,7 @@
} __packed r;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2141,7 +2199,7 @@
r.subh.count = htons(1);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
r.bus.creatorid = V_pf_status.hostid;
#else
r.bus.creatorid = pf_status.hostid;
@@ -2150,14 +2208,14 @@
struct pfsync_softc *sc = arg;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_SET(sc->sc_ifp->if_vnet);
#endif
if (sc->sc_bulk_tries++ < PFSYNC_MAX_BULKTRIES) {
/* Try again */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
callout_reset(&sc->sc_bulkfail_tmo, 5 * hz,
pfsync_bulk_fail, V_pfsyncif);
#else
@@ -2166,7 +2224,7 @@
#if NCARP > 0
#ifdef notyet
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sc->pfsync_sync_ok)
#else
if (!pfsync_sync_ok)
@@ -2175,13 +2233,13 @@
#endif
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sc->pfsync_sync_ok = 1;
#else
pfsync_sync_ok = 1;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -2190,7 +2248,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_RESTORE();
#endif
}
@@ -2199,7 +2257,7 @@
pfsync_send_plus(void *plus, size_t pluslen)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2208,7 +2266,7 @@
PF_LOCK_ASSERT();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sc->sc_len + pluslen > sc->sc_ifp->if_mtu) {
#else
if (sc->sc_len + pluslen > sc->sc_if.if_mtu) {
@@ -2217,14 +2275,14 @@
pfsync_up(void)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sc == NULL || !ISSET(sc->sc_ifp->if_flags, IFF_DRV_RUNNING))
#else
if (sc == NULL || !ISSET(sc->sc_if.if_flags, IFF_RUNNING))
@@ -2233,7 +2291,7 @@
pfsync_state_in_use(struct pf_state *st)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfsync_softc *sc = V_pfsyncif;
#else
struct pfsync_softc *sc = pfsyncif;
@@ -2242,13 +2300,13 @@
pfsync_timeout(void *arg)
{
-#if defined(__FreeBSD__) && defined(VIMAGE)
-+#if defined(__FreeBSD_kernel__) && defined(VIMAGE)
++#if 1 && defined(VIMAGE)
struct pfsync_softc *sc = arg;
#endif
int s;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_SET(sc->sc_ifp->if_vnet);
#endif
@@ -2256,18 +2314,18 @@
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
pfsync_sendout();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
splx(s);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
CURVNET_RESTORE();
#endif
}
@@ -2275,7 +2333,7 @@
/* this is a softnet/netisr handler */
void
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pfsyncintr(void *arg)
{
struct pfsync_softc *sc = arg;
@@ -2284,10 +2342,39 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static int
pfsync_multicast_setup(struct pfsync_softc *sc)
{
+--- a/sys/contrib/pf/net/if_pfsync.h
++++ b/sys/contrib/pf/net/if_pfsync.h
+@@ -268,7 +268,7 @@
+ int pfsyncr_authlevel;
+ };
+
+-#ifdef __FreeBSD__
++#if 1
+ #define SIOCSETPFSYNC _IOW('i', 247, struct ifreq)
+ #define SIOCGETPFSYNC _IOWR('i', 248, struct ifreq)
+ #endif
+@@ -288,7 +288,7 @@
+ #define PFSYNC_S_DEFER 0xfe
+ #define PFSYNC_S_NONE 0xff
+
+-#ifdef __FreeBSD__
++#if 1
+ void pfsync_input(struct mbuf *, __unused int);
+ #else
+ void pfsync_input(struct mbuf *, ...);
+@@ -300,7 +300,7 @@
+ #define PFSYNC_SI_CKSUM 0x02
+ #define PFSYNC_SI_ACK 0x04
+ int pfsync_state_import(struct pfsync_state *, u_int8_t);
+-#ifndef __FreeBSD__
++#if 0
+ void pfsync_state_export(struct pfsync_state *,
+ struct pf_state *);
+ #endif
--- a/sys/contrib/pf/net/pf.c
+++ b/sys/contrib/pf/net/pf.c
@@ -35,7 +35,7 @@
@@ -2295,7 +2382,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -2304,7 +2391,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_bpf.h"
#include "opt_pf.h"
@@ -2313,7 +2400,7 @@
#include <sys/kernel.h>
#include <sys/time.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/random.h>
#include <sys/sysctl.h>
#include <sys/endian.h>
@@ -2322,7 +2409,7 @@
#endif
#include <sys/proc.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/sx.h>
@@ -2331,7 +2418,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/md5.h>
#else
#include <crypto/md5.h>
@@ -2340,7 +2427,7 @@
#include <net/bpf.h>
#include <net/route.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef RADIX_MPATH
#include <net/radix_mpath.h>
#endif
@@ -2349,13 +2436,13 @@
#include <netinet/icmp_var.h>
#include <netinet/if_ether.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <netinet/ip_fw.h>
- #include <netinet/ipfw/ip_fw_private.h> /* XXX: only for DIR_IN/DIR_OUT */
+ #include <netpfil/ipfw/ip_fw_private.h> /* XXX: only for DIR_IN/DIR_OUT */
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <dev/rndvar.h>
#endif
#include <net/pfvar.h>
@@ -2364,14 +2451,14 @@
#include <netinet/icmp6.h>
#include <netinet6/nd6.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <netinet6/ip6_var.h>
#include <netinet6/in6_pcb.h>
#endif
#endif /* INET6 */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <machine/in_cksum.h>
#include <sys/limits.h>
#include <sys/ucred.h>
@@ -2380,7 +2467,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x
#else
#define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x
@@ -2389,7 +2476,7 @@
/* state tables */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
VNET_DEFINE(struct pf_state_tree, pf_statetbl);
VNET_DEFINE(struct pf_altqqueue, pf_altqs[2]);
@@ -2398,7 +2485,7 @@
u_int16_t *, u_int16_t *, u_int16_t *,
u_int16_t *, u_int8_t, sa_family_t);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void pf_send_tcp(struct mbuf *,
const struct pf_rule *, sa_family_t,
#else
@@ -2407,7 +2494,7 @@
int, struct pfi_kif *, struct mbuf *, int,
void *, struct pf_pdesc *, struct pf_rule **,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pf_ruleset **, struct ifqueue *,
struct inpcb *);
#else
@@ -2416,7 +2503,7 @@
struct ifnet *, struct pf_state *,
struct pf_pdesc *);
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
int pf_socket_lookup(int, struct pf_pdesc *);
#endif
u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t,
@@ -2425,7 +2512,7 @@
int pf_check_proto_cksum(struct mbuf *, int, int,
u_int8_t, sa_family_t);
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
struct pf_divert *pf_get_divert(struct mbuf *);
#endif
void pf_print_state_parts(struct pf_state *,
@@ -2434,7 +2521,7 @@
int pf_compare_state_keys(struct pf_state_key *,
struct pf_state_key *, struct pfi_kif *, u_int);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pf_state *pf_find_state(struct pfi_kif *,
struct pf_state_key_cmp *, u_int, struct mbuf *,
struct pf_mtag *);
@@ -2443,7 +2530,7 @@
int pf_check_congestion(struct ifqueue *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len);
VNET_DECLARE(int, pf_end_threads);
@@ -2452,7 +2539,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define PPACKET_LOOPED() \
(pd->pf_mtag->flags & PF_PACKET_LOOPED)
@@ -2461,7 +2548,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define BOUND_IFACE(r, k) \
((r)->rule_flag & PFRULE_IFBOUND) ? (k) : V_pfi_all
#else
@@ -2470,7 +2557,7 @@
struct pf_state *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
VNET_DEFINE(struct pf_src_tree, tree_src_tracking);
VNET_DEFINE(struct pf_state_tree_id, tree_id);
@@ -2479,7 +2566,7 @@
(*state)->rule.ptr->max_src_conn <
(*state)->src_node->conn) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_SRCCONN]++;
#else
pf_status.lcounters[LCNT_SRCCONN]++;
@@ -2488,7 +2575,7 @@
if ((*state)->rule.ptr->max_src_conn_rate.limit &&
pf_check_threshold(&(*state)->src_node->conn_rate)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_SRCCONNRATE]++;
#else
pf_status.lcounters[LCNT_SRCCONNRATE]++;
@@ -2497,7 +2584,7 @@
u_int32_t killed = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_OVERLOAD_TABLE]++;
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
@@ -2506,7 +2593,7 @@
struct pf_state *st;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++;
RB_FOREACH(st, pf_state_tree_id, &V_tree_id) {
#else
@@ -2515,7 +2602,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -2523,7 +2610,7 @@
printf(", %u states killed", killed);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC)
#else
if (pf_status.debug >= PF_DEBUG_MISC)
@@ -2532,7 +2619,7 @@
else
k.rule.ptr = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.scounters[SCNT_SRC_NODE_SEARCH]++;
*sn = RB_FIND(pf_src_tree, &V_tree_src_tracking, &k);
#else
@@ -2541,14 +2628,14 @@
if (!rule->max_src_nodes ||
rule->src_nodes < rule->max_src_nodes)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(*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 __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_SRCNODES]++;
#else
pf_status.lcounters[LCNT_SRCNODES]++;
@@ -2557,7 +2644,7 @@
PF_ACPY(&(*sn)->addr, src, af);
if (RB_INSERT(pf_src_tree,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
&V_tree_src_tracking, *sn) != NULL) {
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
@@ -2566,7 +2653,7 @@
printf("\n");
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_src_tree_pl, *sn);
#else
pool_put(&pf_src_tree_pl, *sn);
@@ -2575,7 +2662,7 @@
if ((*sn)->rule.ptr != NULL)
(*sn)->rule.ptr->src_nodes++;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.scounters[SCNT_SRC_NODE_INSERT]++;
V_pf_status.src_nodes++;
#else
@@ -2584,7 +2671,7 @@
if (rule->max_src_states &&
(*sn)->states >= rule->max_src_states) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_SRCSTATES]++;
#else
pf_status.lcounters[LCNT_SRCSTATES]++;
@@ -2593,14 +2680,14 @@
struct pf_state *olds = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(s->key[idx] == NULL, ("%s: key is null!", __FUNCTION__));
#else
KASSERT(s->key[idx] == NULL); /* XXX handle this? */
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((cur = RB_INSERT(pf_state_tree, &V_pf_statetbl, sk)) != NULL) {
#else
if ((cur = RB_INSERT(pf_state_tree, &pf_statetbl, sk)) != NULL) {
@@ -2609,7 +2696,7 @@
olds = si->s;
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -2618,7 +2705,7 @@
printf("\n");
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_key_pl, sk);
#else
pool_put(&pf_state_key_pl, sk);
@@ -2627,7 +2714,7 @@
}
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_key_pl, sk);
#else
pool_put(&pf_state_key_pl, sk);
@@ -2636,7 +2723,7 @@
s->key[idx] = sk;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((si = pool_get(&V_pf_state_item_pl, PR_NOWAIT)) == NULL) {
#else
if ((si = pool_get(&pf_state_item_pl, PR_NOWAIT)) == NULL) {
@@ -2645,7 +2732,7 @@
/* list is sorted, if-bound states before floating */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (s->kif == V_pfi_all)
#else
if (s->kif == pfi_all)
@@ -2654,7 +2741,7 @@
if (si) {
TAILQ_REMOVE(&s->key[idx]->states, si, entry);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_item_pl, si);
#else
pool_put(&pf_state_item_pl, si);
@@ -2663,7 +2750,7 @@
if (TAILQ_EMPTY(&s->key[idx]->states)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_state_tree, &V_pf_statetbl, s->key[idx]);
#else
RB_REMOVE(pf_state_tree, &pf_statetbl, s->key[idx]);
@@ -2671,14 +2758,14 @@
if (s->key[idx]->reverse)
s->key[idx]->reverse->reverse = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX: implement this */
#else
if (s->key[idx]->inp)
s->key[idx]->inp->inp_pf_sk = NULL;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_key_pl, s->key[idx]);
#else
pool_put(&pf_state_key_pl, s->key[idx]);
@@ -2687,7 +2774,7 @@
struct pf_state_key *sk;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((sk = pool_get(&V_pf_state_key_pl, pool_flags)) == NULL)
#else
if ((sk = pool_get(&pf_state_key_pl, pool_flags)) == NULL)
@@ -2696,7 +2783,7 @@
u_int16_t sport, u_int16_t dport)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((*skp == NULL && *nkp == NULL),
("%s: skp == NULL && nkp == NULL", __FUNCTION__));
#else
@@ -2705,7 +2792,7 @@
struct pf_state_key *sks, struct pf_state *s)
{
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
splassert(IPL_SOFTNET);
#endif
@@ -2714,7 +2801,7 @@
} else {
if (pf_state_key_attach(skw, s, PF_SK_WIRE)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_key_pl, sks);
#else
pool_put(&pf_state_key_pl, sks);
@@ -2723,7 +2810,7 @@
if (s->id == 0 && s->creatorid == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
s->id = htobe64(V_pf_status.stateid++);
s->creatorid = V_pf_status.hostid;
#else
@@ -2732,7 +2819,7 @@
#endif
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (RB_INSERT(pf_state_tree_id, &V_tree_id, s) != NULL) {
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
@@ -2741,7 +2828,7 @@
printf("pf: state insert failed: "
"id: %016llx creatorid: %08x",
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(unsigned long long)betoh64(s->id), ntohl(s->creatorid));
#else
betoh64(s->id), ntohl(s->creatorid));
@@ -2750,7 +2837,7 @@
return (-1);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_INSERT_TAIL(&V_state_list, s, entry_list);
V_pf_status.fcounters[FCNT_STATE_INSERT]++;
V_pf_status.states++;
@@ -2759,7 +2846,7 @@
pfi_kif_ref(kif, PFI_KIF_REF_STATE);
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_insert_state_ptr != NULL)
pfsync_insert_state_ptr(s);
#else
@@ -2768,7 +2855,7 @@
pf_find_state_byid(struct pf_state_cmp *key)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.fcounters[FCNT_STATE_SEARCH]++;
return (RB_FIND(pf_state_tree_id, &V_tree_id, (struct pf_state *)key));
@@ -2777,7 +2864,7 @@
struct pf_state *
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir,
struct mbuf *m, struct pf_mtag *pftag)
#else
@@ -2786,20 +2873,20 @@
struct pf_state_item *si;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.fcounters[FCNT_STATE_SEARCH]++;
#else
pf_status.fcounters[FCNT_STATE_SEARCH]++;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl,
#else
if ((sk = RB_FIND(pf_state_tree, &pf_statetbl,
@@ -2808,7 +2895,7 @@
sk = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse;
else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl,
#else
if ((sk = RB_FIND(pf_state_tree, &pf_statetbl,
@@ -2817,7 +2904,7 @@
if (dir == PF_OUT)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pftag->statekey = NULL;
#else
m->m_pkthdr.pf.statekey = NULL;
@@ -2826,7 +2913,7 @@
/* list is sorted, if-bound states before floating ones */
TAILQ_FOREACH(si, &sk->states, entry)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((si->s->kif == V_pfi_all || si->s->kif == kif) &&
#else
if ((si->s->kif == pfi_all || si->s->kif == kif) &&
@@ -2835,14 +2922,14 @@
struct pf_state_item *si, *ret = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.fcounters[FCNT_STATE_SEARCH]++;
#else
pf_status.fcounters[FCNT_STATE_SEARCH]++;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -2851,7 +2938,7 @@
{
int nloops = 0, s;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int locked;
#endif
@@ -2860,7 +2947,7 @@
tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sx_slock(&V_pf_consistency_lock);
PF_LOCK();
locked = 0;
@@ -2869,7 +2956,7 @@
/* process a fraction of the state table every second */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!pf_purge_expired_states(1 + (V_pf_status.states /
V_pf_default_rule.timeout[PFTM_INTERVAL]), 0)) {
PF_UNLOCK();
@@ -2878,7 +2965,7 @@
/* purge other expired types every PFTM_INTERVAL seconds */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (++nloops >= V_pf_default_rule.timeout[PFTM_INTERVAL]) {
#else
if (++nloops >= pf_default_rule.timeout[PFTM_INTERVAL]) {
@@ -2887,7 +2974,7 @@
splx(s);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
if (locked)
sx_xunlock(&V_pf_consistency_lock);
@@ -2896,7 +2983,7 @@
if (state->timeout == PFTM_UNTIL_PACKET)
return (0);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(state->timeout != PFTM_UNLINKED,
("pf_state_expires: timeout == PFTM_UNLINKED"));
KASSERT((state->timeout < PFTM_MAX),
@@ -2905,7 +2992,7 @@
timeout = state->rule.ptr->timeout[state->timeout];
if (!timeout)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
timeout = V_pf_default_rule.timeout[state->timeout];
#else
timeout = pf_default_rule.timeout[state->timeout];
@@ -2914,7 +3001,7 @@
states = state->rule.ptr->states_cur;
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
start = V_pf_default_rule.timeout[PFTM_ADAPTIVE_START];
end = V_pf_default_rule.timeout[PFTM_ADAPTIVE_END];
states = V_pf_status.states;
@@ -2923,7 +3010,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int
pf_purge_expired_src_nodes(int waslocked)
#else
@@ -2932,7 +3019,7 @@
int locked = waslocked;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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
@@ -2941,7 +3028,7 @@
if (cur->states <= 0 && cur->expire <= time_second) {
if (! locked) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sx_try_upgrade(&V_pf_consistency_lock))
return (0);
#else
@@ -2949,7 +3036,7 @@
#endif
next = RB_NEXT(pf_src_tree,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
&V_tree_src_tracking, cur);
#else
&tree_src_tracking, cur);
@@ -2958,7 +3045,7 @@
pf_rm_rule(NULL, cur->rule.ptr);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_src_tree, &V_tree_src_tracking, cur);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
@@ -2967,7 +3054,7 @@
if (locked && !waslocked)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
sx_downgrade(&V_pf_consistency_lock);
}
@@ -2976,7 +3063,7 @@
if (!timeout)
timeout =
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_default_rule.timeout[PFTM_SRC_NODE];
#else
pf_default_rule.timeout[PFTM_SRC_NODE];
@@ -2985,7 +3072,7 @@
if (!timeout)
timeout =
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_default_rule.timeout[PFTM_SRC_NODE];
#else
pf_default_rule.timeout[PFTM_SRC_NODE];
@@ -2994,7 +3081,7 @@
pf_unlink_state(struct pf_state *cur)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (cur->local_flags & PFSTATE_EXPIRING)
return;
cur->local_flags |= PFSTATE_EXPIRING;
@@ -3003,7 +3090,7 @@
if (cur->src.state == PF_TCPS_PROXY_DST) {
/* XXX wire key the right one? */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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,
@@ -3012,7 +3099,7 @@
TH_RST|TH_ACK, 0, 0, 0, 1, cur->tag, NULL, NULL);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_state_tree_id, &V_tree_id, cur);
#else
RB_REMOVE(pf_state_tree_id, &tree_id, cur);
@@ -3020,7 +3107,7 @@
#if NPFLOW > 0
if (cur->state_flags & PFSTATE_PFLOW)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (export_pflow_ptr != NULL)
export_pflow_ptr(cur);
#else
@@ -3029,7 +3116,7 @@
#endif
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_delete_state_ptr != NULL)
pfsync_delete_state_ptr(cur);
#else
@@ -3038,13 +3125,13 @@
pf_free_state(struct pf_state *cur)
{
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
splassert(IPL_SOFTNET);
#endif
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_state_in_use_ptr != NULL &&
pfsync_state_in_use_ptr(cur))
#else
@@ -3053,7 +3140,7 @@
return;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(cur->timeout == PFTM_UNLINKED,
("pf_free_state: cur->timeout != PFTM_UNLINKED"));
#else
@@ -3062,7 +3149,7 @@
pf_normalize_tcp_cleanup(cur);
pfi_kif_unref(cur->kif, PFI_KIF_REF_STATE);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_REMOVE(&V_state_list, cur, entry_list);
#else
TAILQ_REMOVE(&state_list, cur, entry_list);
@@ -3070,7 +3157,7 @@
if (cur->tag)
pf_tag_unref(cur->tag);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_pl, cur);
V_pf_status.fcounters[FCNT_STATE_REMOVALS]++;
V_pf_status.states--;
@@ -3079,7 +3166,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int
pf_purge_expired_states(u_int32_t maxcheck, int waslocked)
#else
@@ -3088,7 +3175,7 @@
static struct pf_state *cur = NULL;
struct pf_state *next;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int locked = waslocked;
#else
int locked = 0;
@@ -3097,7 +3184,7 @@
/* wrap to start of list when we hit the end */
if (cur == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
cur = TAILQ_FIRST(&V_state_list);
#else
cur = TAILQ_FIRST(&state_list);
@@ -3106,7 +3193,7 @@
/* free unlinked state */
if (! locked) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sx_try_upgrade(&V_pf_consistency_lock))
return (0);
#else
@@ -3115,7 +3202,7 @@
pf_unlink_state(cur);
if (! locked) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!sx_try_upgrade(&V_pf_consistency_lock))
return (0);
#else
@@ -3124,7 +3211,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!waslocked && locked)
sx_downgrade(&V_pf_consistency_lock);
@@ -3133,7 +3220,7 @@
{
int hlen = (th->th_off << 2) - sizeof(*th), thoptlen = hlen;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int8_t opts[TCP_MAXOLEN], *opt = opts;
#else
u_int8_t opts[MAX_TCPOPTLEN], *opt = opts;
@@ -3142,7 +3229,7 @@
if (copyback)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off + sizeof(*th), thoptlen, (caddr_t)opts);
#else
m_copyback(m, off + sizeof(*th), thoptlen, opts);
@@ -3151,7 +3238,7 @@
void
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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,
@@ -3160,7 +3247,7 @@
struct tcphdr *th;
char *opt;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pf_mtag *pf_mtag;
KASSERT(
@@ -3169,7 +3256,7 @@
if (m == NULL)
return;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef MAC
mac_netinet_firewall_send(m);
#endif
@@ -3178,7 +3265,7 @@
#endif
if (tag)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m->m_flags |= M_SKIP_FIREWALL;
pf_mtag->tag = rtag;
#else
@@ -3187,7 +3274,7 @@
if (r != NULL && r->rtableid >= 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
M_SETFIB(m, r->rtableid);
pf_mtag->rtableid = r->rtableid;
@@ -3195,14 +3282,14 @@
m->m_pkthdr.pf.rtableid = r->rtableid;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
}
#endif
#ifdef ALTQ
if (r != NULL && r->qid) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_mtag->qid = r->qid;
/* add hints for ecn */
@@ -3211,7 +3298,7 @@
h->ip_hl = sizeof(*h) >> 2;
h->ip_tos = IPTOS_LOWDELAY;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
h->ip_off = V_path_mtu_discovery ? IP_DF : 0;
h->ip_len = len;
h->ip_ttl = ttl ? ttl : V_ip_defttl;
@@ -3220,7 +3307,7 @@
h->ip_sum = 0;
if (eh == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
ip_output(m, (void *)NULL, (void *)NULL, 0,
(void *)NULL, (void *)NULL);
@@ -3229,7 +3316,7 @@
bcopy(eh->ether_shost, e->ether_dhost, ETHER_ADDR_LEN);
e->ether_type = eh->ether_type;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
/* XXX_IMPORT: later */
ip_output(m, (void *)NULL, &ro, 0,
@@ -3238,7 +3325,7 @@
h6->ip6_hlim = IPV6_DEFHLIM;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
PF_LOCK();
@@ -3247,7 +3334,7 @@
{
struct mbuf *m0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef INET
struct ip *ip;
#endif
@@ -3255,7 +3342,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m0 = m_copypacket(m, M_DONTWAIT);
if (m0 == NULL)
return;
@@ -3264,7 +3351,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((pf_mtag = pf_get_mtag(m0)) == NULL)
return;
/* XXX: revisit */
@@ -3273,7 +3360,7 @@
if (r->rtableid >= 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
M_SETFIB(m0, r->rtableid);
pf_mtag->rtableid = r->rtableid;
@@ -3281,14 +3368,14 @@
m0->m_pkthdr.pf.rtableid = r->rtableid;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
}
#endif
#ifdef ALTQ
if (r->qid) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_mtag->qid = r->qid;
/* add hints for ecn */
pf_mtag->hdr = mtod(m0, struct ip *);
@@ -3297,7 +3384,7 @@
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* icmp_error() expects host byte ordering */
ip = mtod(m0, struct ip *);
NTOHS(ip->ip_len);
@@ -3306,12 +3393,12 @@
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
icmp6_error(m0, type, code, 0);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
break;
@@ -3320,7 +3407,7 @@
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_match_tag(struct mbuf *m, struct pf_rule *r, int *tag,
struct pf_mtag *pf_mtag)
#else
@@ -3329,7 +3416,7 @@
{
if (*tag == -1)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*tag = pf_mtag->tag;
#else
*tag = m->m_pkthdr.pf.tag;
@@ -3338,7 +3425,7 @@
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_tag_packet(struct mbuf *m, int tag, int rtableid,
struct pf_mtag *pf_mtag)
#else
@@ -3347,14 +3434,14 @@
if (tag > 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_mtag->tag = tag;
#else
m->m_pkthdr.pf.tag = tag;
#endif
if (rtableid >= 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
M_SETFIB(m, rtableid);
}
@@ -3363,7 +3450,7 @@
if (match)
*match = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (*depth >= sizeof(V_pf_anchor_stack) /
sizeof(V_pf_anchor_stack[0])) {
#else
@@ -3372,7 +3459,7 @@
} else if (*depth == 0 && a != NULL)
*a = *r;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
f = V_pf_anchor_stack + (*depth)++;
#else
f = pf_anchor_stack + (*depth)++;
@@ -3381,7 +3468,7 @@
if (*depth <= 0)
break;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
f = V_pf_anchor_stack + *depth - 1;
#else
f = pf_anchor_stack + *depth - 1;
@@ -3390,7 +3477,7 @@
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_socket_lookup(int direction, struct pf_pdesc *pd, struct inpcb *inp_arg)
#else
pf_socket_lookup(int direction, struct pf_pdesc *pd)
@@ -3399,7 +3486,7 @@
struct pf_addr *saddr, *daddr;
u_int16_t sport, dport;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct inpcbinfo *pi;
#else
struct inpcbtable *tb;
@@ -3408,7 +3495,7 @@
pd->lookup.pid = NO_PID;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (inp_arg != NULL) {
INP_LOCK_ASSERT(inp_arg);
pd->lookup.uid = inp_arg->inp_cred->cr_uid;
@@ -3417,7 +3504,7 @@
sport = pd->hdr.tcp->th_sport;
dport = pd->hdr.tcp->th_dport;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pi = &V_tcbinfo;
#else
tb = &tcbtable;
@@ -3426,7 +3513,7 @@
sport = pd->hdr.udp->uh_sport;
dport = pd->hdr.udp->uh_dport;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pi = &V_udbinfo;
#else
tb = &udbtable;
@@ -3435,7 +3522,7 @@
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXXRW: would be nice if we had an mbuf here so that we
* could use in_pcblookup_mbuf().
@@ -3444,7 +3531,7 @@
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXXRW: would be nice if we had an mbuf here so that we
* could use in6_pcblookup_mbuf().
@@ -3453,7 +3540,7 @@
return (-1);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
INP_RLOCK_ASSERT(inp);
pd->lookup.uid = inp->inp_cred->cr_uid;
pd->lookup.gid = inp->inp_cred->cr_groups[0];
@@ -3462,7 +3549,7 @@
u_int8_t hdr[60];
u_int8_t *opt, optlen;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int16_t mss = V_tcp_mssdflt;
#else
u_int16_t mss = tcp_mssdflt;
@@ -3471,7 +3558,7 @@
#endif /* INET6 */
struct rtentry *rt = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int hlen = 0;
u_int16_t mss = V_tcp_mssdflt;
#else
@@ -3480,7 +3567,7 @@
dst->sin_len = sizeof(*dst);
dst->sin_addr = addr->v4;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
in_rtalloc_ign(&ro, 0, rtableid);
#else /* ! __FreeBSD__ */
rtalloc_noclone(&ro, NO_CLONING);
@@ -3489,7 +3576,7 @@
dst6->sin6_len = sizeof(*dst6);
dst6->sin6_addr = addr->v6;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
in6_rtalloc_ign(&ro6, 0, rtableid);
#else /* ! __FreeBSD__ */
rtalloc_noclone((struct route *)&ro6, NO_CLONING);
@@ -3498,7 +3585,7 @@
if (rt && rt->rt_ifp) {
mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
mss = max(V_tcp_mssdflt, mss);
#else
mss = max(tcp_mssdflt, mss);
@@ -3507,7 +3594,7 @@
u_int32_t digest[4];
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_tcp_secret_init == 0) {
read_random(&V_pf_tcp_secret, sizeof(V_pf_tcp_secret));
MD5Init(&V_pf_tcp_secret_ctx);
@@ -3516,7 +3603,7 @@
}
MD5Final((u_char *)digest, &ctx);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_tcp_iss_off += 4096;
#define ISN_RANDOM_INCREMENT (4096 - 1)
return (digest[0] + (arc4random() & ISN_RANDOM_INCREMENT) +
@@ -3525,7 +3612,7 @@
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 __FreeBSD_kernel__
++#if 1
struct ifqueue *ifq, struct inpcb *inp)
#else
struct ifqueue *ifq)
@@ -3534,7 +3621,7 @@
int match = 0;
int state_icmp = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int16_t sport = 0, dport = 0;
u_int16_t bproto_sum = 0, bip_sum = 0;
#else
@@ -3543,7 +3630,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (inp != NULL)
pd->lookup.done = pf_socket_lookup(direction, pd, inp);
else if (V_debug_pfugidhack) {
@@ -3552,7 +3639,7 @@
/* tcp/udp only. uid.op always 0 in other cases */
else if (r->uid.op && (pd->lookup.done || (pd->lookup.done =
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_socket_lookup(direction, pd, inp), 1)) &&
#else
pf_socket_lookup(direction, pd), 1)) &&
@@ -3561,7 +3648,7 @@
/* tcp/udp only. gid.op always 0 in other cases */
else if (r->gid.op && (pd->lookup.done || (pd->lookup.done =
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_socket_lookup(direction, pd, inp), 1)) &&
#else
pf_socket_lookup(direction, pd), 1)) &&
@@ -3570,14 +3657,14 @@
r = TAILQ_NEXT(r, entries);
else if (r->prob &&
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
r->prob <= arc4random())
#else
r->prob <= arc4random_uniform(UINT_MAX - 1) + 1)
#endif
r = TAILQ_NEXT(r, entries);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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))
@@ -3586,7 +3673,7 @@
if (th->th_flags & TH_FIN)
ack++;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_send_tcp(m, r, af, pd->dst,
#else
pf_send_tcp(r, af, pd->dst,
@@ -3595,7 +3682,7 @@
goto cleanup;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pf_tag_packet(m, tag, rtableid, pd->pf_mtag)) {
#else
if (pf_tag_packet(m, tag, rtableid)) {
@@ -3604,7 +3691,7 @@
return (action);
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sk != NULL)
pool_put(&V_pf_state_key_pl, sk);
if (nk != NULL)
@@ -3613,7 +3700,7 @@
#if NPFSYNC > 0
if (*sm != NULL && !ISSET((*sm)->state_flags, PFSTATE_NOSYNC) &&
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
direction == PF_OUT && pfsync_up_ptr != NULL && pfsync_up_ptr()) {
#else
direction == PF_OUT && pfsync_up()) {
@@ -3622,7 +3709,7 @@
* replies through it.
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_defer_ptr != NULL &&
pfsync_defer_ptr(*sm, m))
#else
@@ -3631,7 +3718,7 @@
cleanup:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sk != NULL)
pool_put(&V_pf_state_key_pl, sk);
if (nk != NULL)
@@ -3640,7 +3727,7 @@
struct pf_src_node *sn = NULL;
struct tcphdr *th = pd->hdr.tcp;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int16_t mss = V_tcp_mssdflt;
#else
u_int16_t mss = tcp_mssdflt;
@@ -3649,7 +3736,7 @@
/* check maximums */
if (r->max_states && (r->states_cur >= r->max_states)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.lcounters[LCNT_STATES]++;
#else
pf_status.lcounters[LCNT_STATES]++;
@@ -3658,7 +3745,7 @@
goto csfailed;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
s = pool_get(&V_pf_state_pl, PR_NOWAIT | PR_ZERO);
#else
s = pool_get(&pf_state_pl, PR_NOWAIT | PR_ZERO);
@@ -3667,7 +3754,7 @@
pf_src_tree_remove_state(s);
STATE_DEC_COUNTERS(s);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_pl, s);
#else
pool_put(&pf_state_pl, s);
@@ -3676,7 +3763,7 @@
pf_src_tree_remove_state(s);
STATE_DEC_COUNTERS(s);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_pl, s);
#else
pool_put(&pf_state_pl, s);
@@ -3685,7 +3772,7 @@
pf_src_tree_remove_state(s);
STATE_DEC_COUNTERS(s);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_pl, s);
#else
pool_put(&pf_state_pl, s);
@@ -3694,7 +3781,7 @@
mss = pf_calc_mss(pd->dst, pd->af, rtid, mss);
s->src.mss = mss;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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,
@@ -3703,7 +3790,7 @@
csfailed:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (sk != NULL)
pool_put(&V_pf_state_key_pl, sk);
if (nk != NULL)
@@ -3712,7 +3799,7 @@
if (sn != NULL && sn->states == 0 && sn->expire == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_src_tree, &V_tree_src_tracking, sn);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
@@ -3721,7 +3808,7 @@
}
if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_src_tree, &V_tree_src_tracking, nsn);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
@@ -3730,7 +3817,7 @@
(arc4random() % (UINT_MAX - 1) + 1))
r = TAILQ_NEXT(r, entries);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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))
@@ -3739,7 +3826,7 @@
return (PF_DROP);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pf_tag_packet(m, tag, -1, pd->pf_mtag)) {
#else
if (pf_tag_packet(m, tag, -1)) {
@@ -3748,7 +3835,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -3757,7 +3844,7 @@
printf(" seq=%u (%u) ack=%u len=%u ackskew=%d "
"pkts=%llu:%llu dir=%s,%s\n", seq, orig_seq, ack,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pd->p_len, ackskew, (unsigned long long)(*state)->packets[0],
(unsigned long long)(*state)->packets[1],
#else
@@ -3766,7 +3853,7 @@
/* Send RST for state mismatches during handshake */
if (!(th->th_flags & TH_RST))
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
#else
pf_send_tcp((*state)->rule.ptr, pd->af,
@@ -3775,7 +3862,7 @@
src->seqhi = 1;
src->max_win = 1;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
} else if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
} else if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -3784,7 +3871,7 @@
"pkts=%llu:%llu dir=%s,%s\n",
seq, orig_seq, ack, pd->p_len, ackskew,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(unsigned long long)(*state)->packets[0],
(unsigned long long)(*state)->packets[1],
#else
@@ -3793,7 +3880,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -3802,7 +3889,7 @@
return (PF_DROP);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
#else
pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
@@ -3811,7 +3898,7 @@
if ((*state)->dst.seqhi == 1)
(*state)->dst.seqhi = htonl(arc4random());
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
#else
pf_send_tcp((*state)->rule.ptr, pd->af,
@@ -3820,7 +3907,7 @@
(*state)->dst.max_win = MAX(ntohs(th->th_win), 1);
(*state)->dst.seqlo = ntohl(th->th_seq);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
#else
pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
@@ -3829,7 +3916,7 @@
TH_ACK, (*state)->src.max_win, 0, 0, 0,
(*state)->tag, NULL, NULL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
#else
pf_send_tcp((*state)->rule.ptr, pd->af,
@@ -3838,7 +3925,7 @@
dst->state >= TCPS_FIN_WAIT_2 &&
src->state >= TCPS_FIN_WAIT_2) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -3847,7 +3934,7 @@
/* Copyback sequence modulation or stateful scrub changes if needed */
if (copyback)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off, sizeof(*th), (caddr_t)th);
#else
m_copyback(m, off, sizeof(*th), th);
@@ -3856,7 +3943,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -3865,7 +3952,7 @@
&uh->uh_sum, &nk->addr[pd->didx],
nk->port[pd->didx], 1, pd->af);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
#else
m_copyback(m, off, sizeof(*uh), uh);
@@ -3874,7 +3961,7 @@
{
struct pf_addr *saddr = pd->src, *daddr = pd->dst;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int16_t icmpid = 0, *icmpsum;
#else
u_int16_t icmpid, *icmpsum;
@@ -3883,7 +3970,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -3892,7 +3979,7 @@
m_copyback(m, off, ICMP_MINLEN,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp);
@@ -3901,7 +3988,7 @@
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp6);
@@ -3910,7 +3997,7 @@
struct pf_pdesc pd2;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
bzero(&pd2, sizeof pd2);
#endif
#ifdef INET
@@ -3919,7 +4006,7 @@
int terminal = 0;
#endif /* INET6 */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int ipoff2 = 0;
int off2 = 0;
#else
@@ -3928,7 +4015,7 @@
key.port[pd2.didx] = th.th_dport;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -3937,7 +4024,7 @@
(!SEQ_GEQ(src->seqhi, seq) ||
!SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws)))) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -3946,7 +4033,7 @@
return (PF_DROP);
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -3955,13 +4042,13 @@
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp);
m_copyback(m, ipoff2, sizeof(h2),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
&h2);
@@ -3970,13 +4057,13 @@
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
&h2_6);
@@ -3984,7 +4071,7 @@
#endif /* INET6 */
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off2, 8, (caddr_t)&th);
#else
m_copyback(m, off2, 8, &th);
@@ -3993,7 +4080,7 @@
key.port[pd2.didx] = uh.uh_dport;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4002,12 +4089,12 @@
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, ipoff2, sizeof(h2), (caddr_t)&h2);
#else
m_copyback(m, ipoff2, sizeof(h2), &h2);
@@ -4016,13 +4103,13 @@
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
&h2_6);
@@ -4030,7 +4117,7 @@
#endif /* INET6 */
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off2, sizeof(uh), (caddr_t)&uh);
#else
m_copyback(m, off2, sizeof(uh), &uh);
@@ -4039,7 +4126,7 @@
key.port[0] = key.port[1] = iih.icmp_id;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4048,7 +4135,7 @@
pd->ip_sum, 0, AF_INET);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -4057,7 +4144,7 @@
key.port[0] = key.port[1] = iih.icmp6_id;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4066,7 +4153,7 @@
pd->ip_sum, 0, AF_INET6);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off, sizeof(struct icmp6_hdr),
(caddr_t)pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6), (caddr_t)&h2_6);
@@ -4075,7 +4162,7 @@
key.port[0] = key.port[1] = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4084,7 +4171,7 @@
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off, ICMP_MINLEN,
(caddr_t)pd->hdr.icmp);
m_copyback(m, ipoff2, sizeof(h2), (caddr_t)&h2);
@@ -4093,13 +4180,13 @@
m_copyback(m, off,
sizeof(struct icmp6_hdr),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
(caddr_t)
#endif
&h2_6);
@@ -4108,7 +4195,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag);
#else
STATE_LOOKUP(kif, &key, direction, *state, m);
@@ -4117,7 +4204,7 @@
struct pf_state_key *nk = (*state)->key[pd->didx];
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(nk, ("%s: nk is null", __FUNCTION__));
KASSERT(pd, ("%s: pd is null", __FUNCTION__));
KASSERT(pd->src, ("%s: pd->src is null", __FUNCTION__));
@@ -4126,7 +4213,7 @@
int rtableid)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef RADIX_MPATH
struct radix_node_head *rnh;
#endif
@@ -4135,12 +4222,12 @@
int ret = 1;
int check_mpath;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
extern int ipmultipath;
#endif
#ifdef INET6
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
extern int ip6_multipath;
#endif
struct sockaddr_in6 *dst6;
@@ -4149,7 +4236,7 @@
check_mpath = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef RADIX_MPATH
/* XXX: stick to table 0 for now */
rnh = rt_tables_get_rnh(0, af);
@@ -4158,7 +4245,7 @@
dst->sin_len = sizeof(*dst);
dst->sin_addr = addr->v4;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if (ipmultipath)
check_mpath = 1;
#endif
@@ -4167,7 +4254,7 @@
dst6->sin6_len = sizeof(*dst6);
dst6->sin6_addr = addr->v6;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if (ip6_multipath)
check_mpath = 1;
#endif
@@ -4176,7 +4263,7 @@
goto out;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
switch (af) {
#ifdef INET6
case AF_INET6:
@@ -4185,7 +4272,7 @@
do {
rt = (struct rtentry *)rn;
-#ifndef __FreeBSD__ /* CARPDEV */
-+#ifndef __FreeBSD_kernel__ /* CARPDEV */
++#if 0 /* CARPDEV */
if (rt->rt_ifp->if_type == IFT_CARP)
ifp = rt->rt_ifp->if_carpdev;
else
@@ -4194,7 +4281,7 @@
if (kif->pfik_ifp == ifp)
ret = 1;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef RADIX_MPATH
rn = rn_mpath_next(rn);
#endif
@@ -4203,7 +4290,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
switch (af) {
#ifdef INET6
case AF_INET6:
@@ -4212,7 +4299,7 @@
if (ro.ro_rt != NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX_IMPORT: later */
#else
if (ro.ro_rt->rt_labelid == aw->v.rtlabel)
@@ -4221,7 +4308,7 @@
struct pf_src_node *sn = NULL;
int error = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int sw_csum;
#endif
#ifdef IPSEC
@@ -4230,7 +4317,7 @@
panic("pf_route: invalid parameters");
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pd->pf_mtag->routed++ > 3) {
#else
if ((*m)->m_pkthdr.pf.routed++ > 3) {
@@ -4239,7 +4326,7 @@
if (r->rt == PF_DUPTO) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((m0 = m_dup(*m, M_DONTWAIT)) == NULL)
#else
if ((m0 = m_copym2(*m, 0, M_COPYALL, M_NOWAIT)) == NULL)
@@ -4248,14 +4335,14 @@
if (r->rt == PF_FASTROUTE) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
in_rtalloc_ign(ro, 0, M_GETFIB(m0));
#else
rtalloc(ro);
#endif
if (ro->ro_rt == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KMOD_IPSTAT_INC(ips_noroute);
#else
ipstat.ips_noroute++;
@@ -4264,7 +4351,7 @@
if (oifp != ifp) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
if (pf_test(PF_OUT, ifp, &m0, NULL, NULL) != PF_PASS) {
PF_LOCK();
@@ -4273,7 +4360,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* 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;
@@ -4282,7 +4369,7 @@
ifp->if_bridge == NULL) {
m0->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KMOD_IPSTAT_INC(ips_outhwcsum);
#else
ipstat.ips_outhwcsum++;
@@ -4291,14 +4378,14 @@
*/
if (ip->ip_off & htons(IP_DF)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KMOD_IPSTAT_INC(ips_cantfrag);
#else
ipstat.ips_cantfrag++;
#endif
if (r->rt != PF_DUPTO) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* icmp_error() expects host byte ordering */
NTOHS(ip->ip_len);
NTOHS(ip->ip_off);
@@ -4307,7 +4394,7 @@
m1 = m0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXX: is cheaper + less error prone than own function
*/
@@ -4316,7 +4403,7 @@
#endif
if (error) {
-#ifndef __FreeBSD__ /* ip_fragment does not do m_freem() on FreeBSD */
-+#ifndef __FreeBSD_kernel__ /* ip_fragment does not do m_freem() on FreeBSD */
++#if 0 /* ip_fragment does not do m_freem() on FreeBSD */
m0 = NULL;
#endif
goto bad;
@@ -4325,7 +4412,7 @@
m1 = m0->m_nextpkt;
m0->m_nextpkt = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (error == 0) {
PF_UNLOCK();
error = (*ifp->if_output)(ifp, m0, sintosa(dst),
@@ -4334,7 +4421,7 @@
if (error == 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KMOD_IPSTAT_INC(ips_fragmented);
#else
ipstat.ips_fragmented++;
@@ -4343,7 +4430,7 @@
panic("pf_route6: invalid parameters");
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pd->pf_mtag->routed++ > 3) {
#else
if ((*m)->m_pkthdr.pf.routed++ > 3) {
@@ -4352,7 +4439,7 @@
if (r->rt == PF_DUPTO) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((m0 = m_dup(*m, M_DONTWAIT)) == NULL)
#else
if ((m0 = m_copym2(*m, 0, M_COPYALL, M_NOWAIT)) == NULL)
@@ -4361,7 +4448,7 @@
/* Cheat. XXX why only in the v6 case??? */
if (r->rt == PF_FASTROUTE) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m0->m_flags |= M_SKIP_FIREWALL;
PF_UNLOCK();
ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL);
@@ -4370,7 +4457,7 @@
if (oifp != ifp) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
if (pf_test6(PF_OUT, ifp, &m0, NULL, NULL) != PF_PASS) {
PF_LOCK();
@@ -4379,18 +4466,18 @@
dst->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
nd6_output(ifp, ifp, m0, dst, NULL);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
} else {
in6_ifstat_inc(ifp, ifs6_in_toobig);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (r->rt != PF_DUPTO) {
PF_UNLOCK();
icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu);
@@ -4399,7 +4486,7 @@
#endif /* INET6 */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* FreeBSD supports cksum offloads for the following drivers.
* em(4), fxp(4), ixgb(4), lge(4), ndis(4), nge(4), re(4),
@@ -4408,7 +4495,7 @@
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
struct pf_divert *
pf_find_divert(struct mbuf *m)
{
@@ -4417,7 +4504,7 @@
#ifdef INET
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_test(int dir, struct ifnet *ifp, struct mbuf **m0,
struct ether_header *eh, struct inpcb *inp)
#else
@@ -4426,7 +4513,7 @@
u_short action, reason = 0, log = 0;
struct mbuf *m = *m0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ip *h = NULL;
struct m_tag *ipfwtag;
struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr;
@@ -4435,7 +4522,7 @@
int off, dirndx, pqid = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
if (!V_pf_status.running)
{
@@ -4444,7 +4531,7 @@
memset(&pd, 0, sizeof(pd));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((pd.pf_mtag = pf_get_mtag(m)) == NULL) {
PF_UNLOCK();
DPFPRINTF(PF_DEBUG_URGENT,
@@ -4453,7 +4540,7 @@
}
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if (ifp->if_type == IFT_CARP && ifp->if_carpdev)
kif = (struct pfi_kif *)ifp->if_carpdev->if_pf_kif;
else
@@ -4462,7 +4549,7 @@
if (kif == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
DPFPRINTF(PF_DEBUG_URGENT,
@@ -4471,18 +4558,18 @@
}
if (kif->pfik_flags & PFI_IFLAG_SKIP)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
PF_UNLOCK();
#endif
return (PF_PASS);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
}
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
M_ASSERTPKTHDR(m);
#else
#ifdef DIAGNOSTIC
@@ -4491,7 +4578,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (m->m_flags & M_SKIP_FIREWALL) {
PF_UNLOCK();
return (PF_PASS);
@@ -4500,7 +4587,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -4509,7 +4596,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4518,7 +4605,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -4527,7 +4614,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4536,7 +4623,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -4545,7 +4632,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4554,7 +4641,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -4563,7 +4650,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4572,7 +4659,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif, m, off, h,
&pd, &a, &ruleset, NULL, inp);
#else
@@ -4581,7 +4668,7 @@
if ((s && s->tag) || r->rtableid >= 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag);
#else
pf_tag_packet(m, s ? s->tag : 0, r->rtableid);
@@ -4589,7 +4676,7 @@
if (dir == PF_IN && s && s->key[PF_SK_STACK])
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pd.pf_mtag->statekey = s->key[PF_SK_STACK];
#else
m->m_pkthdr.pf.statekey = s->key[PF_SK_STACK];
@@ -4598,7 +4685,7 @@
#ifdef ALTQ
if (action == PF_PASS && r->qid) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pqid || (pd.tos & IPTOS_LOWDELAY))
pd.pf_mtag->qid = r->pqid;
else
@@ -4607,14 +4694,14 @@
s->nat_rule.ptr->action == PF_BINAT) &&
(ntohl(pd.dst->v4.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m->m_flags |= M_SKIP_FIREWALL;
#else
m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (action == PF_PASS && r->divert.port &&
ip_divert_ptr != NULL && !PACKET_LOOPED()) {
@@ -4623,7 +4710,7 @@
tr = r;
nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (nr != NULL && r == &V_pf_default_rule)
#else
if (nr != NULL && r == &pf_default_rule)
@@ -4632,7 +4719,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
return (action);
@@ -4641,7 +4728,7 @@
#ifdef INET6
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0,
struct ether_header *eh, struct inpcb *inp)
#else
@@ -4650,7 +4737,7 @@
u_short action, reason = 0, log = 0;
struct mbuf *m = *m0, *n = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ip6_hdr *h = NULL;
struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr;
#else
@@ -4659,7 +4746,7 @@
int off, terminal = 0, dirndx, rh_cnt = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
if (!V_pf_status.running) {
PF_UNLOCK();
@@ -4668,7 +4755,7 @@
memset(&pd, 0, sizeof(pd));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((pd.pf_mtag = pf_get_mtag(m)) == NULL) {
PF_UNLOCK();
DPFPRINTF(PF_DEBUG_URGENT,
@@ -4677,7 +4764,7 @@
}
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
if (ifp->if_type == IFT_CARP && ifp->if_carpdev)
kif = (struct pfi_kif *)ifp->if_carpdev->if_pf_kif;
else
@@ -4686,7 +4773,7 @@
if (kif == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
DPFPRINTF(PF_DEBUG_URGENT,
@@ -4695,18 +4782,18 @@
}
if (kif->pfik_flags & PFI_IFLAG_SKIP)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
{
PF_UNLOCK();
#endif
return (PF_PASS);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
}
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
M_ASSERTPKTHDR(m);
#else
#ifdef DIAGNOSTIC
@@ -4715,7 +4802,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pd.pf_mtag->flags & PF_TAG_GENERATED) {
PF_UNLOCK();
#else
@@ -4723,7 +4810,7 @@
#endif
return (PF_PASS);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
}
#endif
@@ -4732,7 +4819,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4741,7 +4828,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -4750,7 +4837,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4759,7 +4846,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -4768,7 +4855,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4777,7 +4864,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif,
m, off, h, &pd, &a, &ruleset, NULL, inp);
#else
@@ -4786,7 +4873,7 @@
if (action == PF_PASS) {
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_update_state_ptr != NULL)
pfsync_update_state_ptr(s);
#else
@@ -4795,7 +4882,7 @@
log = s->log;
} else if (s == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
action = pf_test_rule(&r, &s, dir, kif, m, off, h,
&pd, &a, &ruleset, NULL, inp);
#else
@@ -4804,7 +4891,7 @@
if ((s && s->tag) || r->rtableid >= 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag);
#else
pf_tag_packet(m, s ? s->tag : 0, r->rtableid);
@@ -4812,7 +4899,7 @@
if (dir == PF_IN && s && s->key[PF_SK_STACK])
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pd.pf_mtag->statekey = s->key[PF_SK_STACK];
#else
m->m_pkthdr.pf.statekey = s->key[PF_SK_STACK];
@@ -4821,7 +4908,7 @@
#ifdef ALTQ
if (action == PF_PASS && r->qid) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pd.tos & IPTOS_LOWDELAY)
pd.pf_mtag->qid = r->pqid;
else
@@ -4830,14 +4917,14 @@
s->nat_rule.ptr->action == PF_BINAT) &&
IN6_IS_ADDR_LOOPBACK(&pd.dst->v6))
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m->m_flags |= M_SKIP_FIREWALL;
#else
m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX: Anybody working on it?! */
if (r->divert.port)
printf("pf: divert(9) is not supported for IPv6\n");
@@ -4846,7 +4933,7 @@
tr = r;
nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (nr != NULL && r == &V_pf_default_rule)
#else
if (nr != NULL && r == &pf_default_rule)
@@ -4855,7 +4942,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
return (action);
@@ -4864,7 +4951,7 @@
pf_check_congestion(struct ifqueue *ifq)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX_IMPORT: later */
return (0);
#else
@@ -4873,7 +4960,7 @@
pf_pkt_addr_changed(struct mbuf *m)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pf_mtag *pf_tag;
if ((pf_tag = pf_find_mtag(m)) != NULL)
@@ -4884,7 +4971,7 @@
*/
-#if defined(__FreeBSD__)
-+#if defined(__FreeBSD_kernel__)
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -4893,7 +4980,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/malloc.h>
#endif
#include <sys/mbuf.h>
@@ -4902,19 +4989,19 @@
#include <sys/socketvar.h>
#include <sys/kernel.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/device.h>
#endif
#include <sys/time.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/pool.h>
#endif
#include <net/if.h>
#include <net/if_types.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <net/vnet.h>
#endif
@@ -4923,7 +5010,7 @@
#endif /* INET6 */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
VNET_DEFINE(struct pfi_kif *, pfi_all);
VNET_DEFINE(uma_zone_t, pfi_addr_pl);
VNET_DEFINE(struct pfi_ifhead, pfi_ifs);
@@ -4932,7 +5019,7 @@
int pfi_buffer_max;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
eventhandler_tag pfi_attach_cookie;
eventhandler_tag pfi_detach_cookie;
eventhandler_tag pfi_attach_group_cookie;
@@ -4941,7 +5028,7 @@
int pfi_skip_if(const char *, struct pfi_kif *);
int pfi_unmask(void *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 *);
@@ -4950,7 +5037,7 @@
pfi_initialize(void)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pfi_all != NULL) /* already initialized */
#else
if (pfi_all != NULL) /* already initialized */
@@ -4958,12 +5045,12 @@
return;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
pool_init(&V_pfi_addr_pl, sizeof(struct pfi_dynaddr), 0, 0, 0,
"pfiaddrpl", &pool_allocator_nointr);
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_buffer_max = 64;
V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*V_pfi_buffer),
PFI_MTYPE, M_WAITOK);
@@ -4972,7 +5059,7 @@
#endif
panic("pfi_kif_get for pfi_all failed");
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ifg_group *ifg;
struct ifnet *ifp;
@@ -4981,7 +5068,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void
pfi_cleanup(void)
{
@@ -4990,7 +5077,7 @@
bzero(&s, sizeof(s));
strlcpy(s.pfik_name, kif_name, sizeof(s.pfik_name));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -4999,7 +5086,7 @@
/* create new one */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -5008,7 +5095,7 @@
strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* It seems that the value of time_second is in unintialzied state
* when pf sets interface statistics clear time in boot phase if pf
@@ -5017,7 +5104,7 @@
TAILQ_INIT(&kif->pfik_dynaddrs);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_INSERT(pfi_ifhead, &V_pfi_ifs, kif);
#else
RB_INSERT(pfi_ifhead, &pfi_ifs, kif);
@@ -5026,7 +5113,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -5035,7 +5122,7 @@
return;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pfi_ifhead, &V_pfi_ifs, kif);
#else
RB_REMOVE(pfi_ifhead, &pfi_ifs, kif);
@@ -5044,7 +5131,7 @@
pfi_initialize();
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_update++;
#else
pfi_update++;
@@ -5053,7 +5140,7 @@
ifp->if_pf_kif = (caddr_t)kif;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
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",
@@ -5062,13 +5149,13 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_update++;
#else
pfi_update++;
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
hook_disestablish(ifp->if_addrhooks, kif->pfik_ah_cookie);
#endif
pfi_kif_update(kif);
@@ -5077,7 +5164,7 @@
pfi_initialize();
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_update++;
#else
pfi_update++;
@@ -5086,7 +5173,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_update++;
#else
pfi_update++;
@@ -5095,7 +5182,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_update++;
#else
pfi_update++;
@@ -5104,7 +5191,7 @@
if (aw->type != PF_ADDR_DYNIFTL)
return (0);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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))
@@ -5113,7 +5200,7 @@
if (dyn->pfid_kif != NULL)
pfi_kif_unref(dyn->pfid_kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pfi_addr_pl, dyn);
#else
pool_put(&pfi_addr_pl, dyn);
@@ -5122,7 +5209,7 @@
kt = dyn->pfid_kt;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (kt->pfrkt_larg != V_pfi_update) {
#else
if (kt->pfrkt_larg != pfi_update) {
@@ -5130,7 +5217,7 @@
/* this table needs to be brought up-to-date */
pfi_table_update(kt, kif, dyn->pfid_net, dyn->pfid_iflags);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
kt->pfrkt_larg = V_pfi_update;
#else
kt->pfrkt_larg = pfi_update;
@@ -5139,7 +5226,7 @@
struct ifg_member *ifgm;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_buffer_cnt = 0;
#else
pfi_buffer_cnt = 0;
@@ -5148,7 +5235,7 @@
pfi_instance_add(ifgm->ifgm_ifp, net, flags);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 "
@@ -5157,7 +5244,7 @@
if (af != AF_INET && af != AF_INET6)
continue;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXX: For point-to-point interfaces, (ifname:0) and IPv4,
* jump over addresses without a proper route to work
@@ -5166,7 +5253,7 @@
int i;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pfi_buffer_cnt >= V_pfi_buffer_max) {
int new_max = V_pfi_buffer_max * 2;
#else
@@ -5175,7 +5262,7 @@
if (new_max > PFI_BUFFER_MAX) {
printf("pfi_address_add: address buffer full (%d/%d)\n",
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_buffer_cnt, PFI_BUFFER_MAX);
#else
pfi_buffer_cnt, PFI_BUFFER_MAX);
@@ -5184,7 +5271,7 @@
}
p = malloc(new_max * sizeof(*V_pfi_buffer), PFI_MTYPE,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
M_NOWAIT);
#else
M_DONTWAIT);
@@ -5192,7 +5279,7 @@
if (p == NULL) {
printf("pfi_address_add: no memory to grow buffer "
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
"(%d/%d)\n", V_pfi_buffer_cnt, PFI_BUFFER_MAX);
#else
"(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX);
@@ -5200,7 +5287,7 @@
return;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
memcpy(V_pfi_buffer, p, V_pfi_buffer_cnt * sizeof(*V_pfi_buffer));
/* no need to zero buffer */
free(V_pfi_buffer, PFI_MTYPE);
@@ -5209,7 +5296,7 @@
if (af == AF_INET && net > 32)
net = 128;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
p = V_pfi_buffer + V_pfi_buffer_cnt++;
#else
p = pfi_buffer + pfi_buffer_cnt++;
@@ -5218,7 +5305,7 @@
pfr_detach_table(aw->p.dyn->pfid_kt);
aw->p.dyn->pfid_kt = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pfi_addr_pl, aw->p.dyn);
#else
pool_put(&pfi_addr_pl, aw->p.dyn);
@@ -5227,7 +5314,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfi_update++;
#else
pfi_update++;
@@ -5236,7 +5323,7 @@
strlcpy(key.pfik_name, name, sizeof(key.pfik_name));
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&key);
#else
p = RB_FIND(pfi_ifhead, &pfi_ifs, (struct pfi_kif *)&key);
@@ -5245,13 +5332,13 @@
struct pfi_kif *p, *nextp;
int s, n = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int error;
#endif
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
for (p = RB_MIN(pfi_ifhead, &V_pfi_ifs); p; p = nextp) {
nextp = RB_NEXT(pfi_ifhead, &V_pfi_ifs, p);
#else
@@ -5260,7 +5347,7 @@
p->pfik_tzero = time_second;
pfi_kif_ref(p, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYOUT(p, buf++, sizeof(*buf), error);
if (error) {
#else
@@ -5269,7 +5356,7 @@
return (EFAULT);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
nextp = RB_NEXT(pfi_ifhead, &V_pfi_ifs, p);
#else
nextp = RB_NEXT(pfi_ifhead, &pfi_ifs, p);
@@ -5278,7 +5365,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(p, pfi_ifhead, &V_pfi_ifs) {
#else
RB_FOREACH(p, pfi_ifhead, &pfi_ifs) {
@@ -5287,7 +5374,7 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(p, pfi_ifhead, &V_pfi_ifs) {
#else
RB_FOREACH(p, pfi_ifhead, &pfi_ifs) {
@@ -5296,7 +5383,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void
pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp)
{
@@ -5307,7 +5394,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -5316,7 +5403,7 @@
#include <sys/kernel.h>
#include <sys/time.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/ucred.h>
#include <sys/jail.h>
#include <sys/module.h>
@@ -5325,7 +5412,7 @@
#include <sys/malloc.h>
#include <sys/kthread.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/rwlock.h>
#include <uvm/uvm_extern.h>
#endif
@@ -5333,7 +5420,7 @@
#include <net/if.h>
#include <net/if_types.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <net/vnet.h>
#endif
#include <net/route.h>
@@ -5342,7 +5429,7 @@
#include <netinet/ip_icmp.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/md5.h>
#else
#include <dev/rndvar.h>
@@ -5351,7 +5438,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
@@ -5359,7 +5446,7 @@
#endif /* __FreeBSD__ */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void init_zone_var(void);
void cleanup_pf_zone(void);
int pfattach(void);
@@ -5368,7 +5455,7 @@
void pf_mv_pool(struct pf_palist *, struct pf_palist *);
void pf_empty_pool(struct pf_palist *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int pfioctl(struct cdev *, u_long, caddr_t, int, struct thread *);
#else
int pfioctl(dev_t, u_long, caddr_t, int, struct proc *);
@@ -5377,7 +5464,7 @@
#define TAGID_MAX 50000
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
VNET_DEFINE(struct pf_rule, pf_default_rule);
VNET_DEFINE(struct sx, pf_consistency_lock);
@@ -5386,14 +5473,14 @@
void pf_rtlabel_copyout(struct pf_addr_wrap *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#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 __FreeBSD_kernel__
++#if 1
struct cdev *pf_dev;
/*
@@ -5402,7 +5489,7 @@
pfi_kif_unref(empty_pool_pa->kif, PFI_KIF_REF_RULE);
TAILQ_REMOVE(poola, empty_pool_pa, entries);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, empty_pool_pa);
#else
pool_put(&pf_pooladdr_pl, empty_pool_pa);
@@ -5411,7 +5498,7 @@
pf_anchor_remove(rule);
pf_empty_pool(&rule->rpool.list);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -5420,7 +5507,7 @@
pf_tagname2tag(char *tagname)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
return (tagname2tag(&V_pf_tags, tagname));
#else
return (tagname2tag(&pf_tags, tagname));
@@ -5429,7 +5516,7 @@
pf_tag2tagname(u_int16_t tagid, char *p)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
tag2tagname(&V_pf_tags, tagid, p);
#else
tag2tagname(&pf_tags, tagid, p);
@@ -5438,7 +5525,7 @@
struct pf_tagname *t;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(t, &V_pf_tags, entries)
#else
TAILQ_FOREACH(t, &pf_tags, entries)
@@ -5447,7 +5534,7 @@
pf_tag_unref(u_int16_t tag)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
tag_unref(&V_pf_tags, tag);
#else
tag_unref(&pf_tags, tag);
@@ -5456,7 +5543,7 @@
pf_rtlabel_add(struct pf_addr_wrap *a)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX_IMPORT: later */
return (0);
#else
@@ -5465,7 +5552,7 @@
pf_rtlabel_remove(struct pf_addr_wrap *a)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX_IMPORT: later */
#else
if (a->type == PF_ADDR_RTLABEL)
@@ -5474,7 +5561,7 @@
pf_rtlabel_copyout(struct pf_addr_wrap *a)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* XXX_IMPORT: later */
if (a->type == PF_ADDR_RTLABEL && a->v.rtlabel)
strlcpy(a->v.rtlabelname, "?", sizeof(a->v.rtlabelname));
@@ -5483,7 +5570,7 @@
pf_qname2qid(char *qname)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
return ((u_int32_t)tagname2tag(&V_pf_qids, qname));
#else
return ((u_int32_t)tagname2tag(&pf_qids, qname));
@@ -5492,7 +5579,7 @@
pf_qid2qname(u_int32_t qid, char *p)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
tag2tagname(&V_pf_qids, (u_int16_t)qid, p);
#else
tag2tagname(&pf_qids, (u_int16_t)qid, p);
@@ -5501,7 +5588,7 @@
pf_qid_unref(u_int32_t qid)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
tag_unref(&V_pf_qids, (u_int16_t)qid);
#else
tag_unref(&pf_qids, (u_int16_t)qid);
@@ -5510,7 +5597,7 @@
/* Purge the old altq list */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
while ((altq = TAILQ_FIRST(V_pf_altqs_inactive)) != NULL) {
TAILQ_REMOVE(V_pf_altqs_inactive, altq, entries);
if (altq->qname[0] == 0 &&
@@ -5519,7 +5606,7 @@
} else
pf_qid_unref(altq->qid);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -5528,7 +5615,7 @@
if (error)
return (error);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*ticket = ++V_ticket_altqs_inactive;
V_altqs_inactive_open = 1;
#else
@@ -5537,7 +5624,7 @@
int error = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!V_altqs_inactive_open || ticket != V_ticket_altqs_inactive)
return (0);
/* Purge the old altq list */
@@ -5546,14 +5633,14 @@
} else
pf_qid_unref(altq->qid);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
#endif
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_altqs_inactive_open = 0;
#else
altqs_inactive_open = 0;
@@ -5562,7 +5649,7 @@
int s, err, error = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!V_altqs_inactive_open || ticket != V_ticket_altqs_inactive)
#else
if (!altqs_inactive_open || ticket != ticket_altqs_inactive)
@@ -5571,7 +5658,7 @@
/* swap altqs, keep the old. */
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
old_altqs = V_pf_altqs_active;
V_pf_altqs_active = V_pf_altqs_inactive;
V_pf_altqs_inactive = old_altqs;
@@ -5580,7 +5667,7 @@
/* Attach new disciplines */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(altq, V_pf_altqs_active, entries) {
if (altq->qname[0] == 0 &&
(altq->local_flags & PFALTQ_FLAG_IF_REMOVED) == 0) {
@@ -5589,7 +5676,7 @@
/* attach the discipline */
error = altq_pfattach(altq);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (error == 0 && V_pf_altq_running)
#else
if (error == 0 && pf_altq_running)
@@ -5598,7 +5685,7 @@
/* Purge the old altq list */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
while ((altq = TAILQ_FIRST(V_pf_altqs_inactive)) != NULL) {
TAILQ_REMOVE(V_pf_altqs_inactive, altq, entries);
if (altq->qname[0] == 0 &&
@@ -5607,7 +5694,7 @@
#endif
/* detach and destroy the discipline */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_altq_running)
#else
if (pf_altq_running)
@@ -5616,7 +5703,7 @@
} else
pf_qid_unref(altq->qid);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -5625,7 +5712,7 @@
splx(s);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_altqs_inactive_open = 0;
#else
altqs_inactive_open = 0;
@@ -5634,12 +5721,12 @@
tb.depth = altq->tbrsize;
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
error = tbr_set(&ifp->if_snd, &tb);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
splx(s);
@@ -5648,12 +5735,12 @@
tb.rate = 0;
s = splnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
error = tbr_set(&ifp->if_snd, &tb);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
splx(s);
@@ -5662,7 +5749,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void
pf_altq_ifnet_event(struct ifnet *ifp, int remove)
{
@@ -5671,7 +5758,7 @@
/* Interrupt userland queue modifications */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_altqs_inactive_open)
pf_rollback_altq(V_ticket_altqs_inactive);
#else
@@ -5680,7 +5767,7 @@
/* Copy the current active set */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(a1, V_pf_altqs_active, entries) {
a2 = pool_get(&V_pf_altq_pl, PR_NOWAIT);
#else
@@ -5689,7 +5776,7 @@
if ((a2->qid = pf_qname2qid(a2->qname)) == 0) {
error = EBUSY;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, a2);
#else
pool_put(&pf_altq_pl, a2);
@@ -5698,7 +5785,7 @@
}
a2->altq_disc = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(a3, V_pf_altqs_inactive, entries) {
#else
TAILQ_FOREACH(a3, pf_altqs_inactive, entries) {
@@ -5707,7 +5794,7 @@
PF_LOCK();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (ticket != V_ticket_altqs_inactive)
#else
if (ticket != ticket_altqs_inactive)
@@ -5716,7 +5803,7 @@
if (error) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, a2);
#else
pool_put(&pf_altq_pl, a2);
@@ -5725,7 +5812,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_INSERT_TAIL(V_pf_altqs_inactive, a2, entries);
#else
TAILQ_INSERT_TAIL(pf_altqs_inactive, a2, entries);
@@ -5734,7 +5821,7 @@
MD5Final(digest, &ctx);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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));
@@ -5743,7 +5830,7 @@
int
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -5752,7 +5839,7 @@
struct pf_pooladdr *pa = NULL;
struct pf_pool *pool = NULL;
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
int s;
#endif
int error = 0;
@@ -5761,7 +5848,7 @@
/* XXX keep in sync with switch() below */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (securelevel_gt(td->td_ucred, 2))
#else
if (securelevel > 1)
@@ -5770,7 +5857,7 @@
case DIOCCLRSRCNODES:
case DIOCIGETIFACES:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
case DIOCGIFSPEED:
#endif
case DIOCSETIFFLAG:
@@ -5779,7 +5866,7 @@
case DIOCGETSRCNODES:
case DIOCIGETIFACES:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
case DIOCGIFSPEED:
#endif
break;
@@ -5788,7 +5875,7 @@
if (flags & FWRITE)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
sx_xlock(&V_pf_consistency_lock);
else
sx_slock(&V_pf_consistency_lock);
@@ -5797,7 +5884,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#else
s = splsoftnet();
@@ -5806,7 +5893,7 @@
case DIOCSTART:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.running)
#else
if (pf_status.running)
@@ -5814,7 +5901,7 @@
error = EEXIST;
else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
error = hook_pf();
PF_LOCK();
@@ -5823,7 +5910,7 @@
case DIOCSTOP:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!V_pf_status.running)
error = ENOENT;
else {
@@ -5832,7 +5919,7 @@
}
if (pr->ticket != ruleset->rules[rs_num].inactive.ticket) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
DPFPRINTF(PF_DEBUG_MISC,
("ticket: %d != [%d]%d\n", pr->ticket, rs_num,
ruleset->rules[rs_num].inactive.ticket));
@@ -5841,7 +5928,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pr->pool_ticket != V_ticket_pabuf) {
DPFPRINTF(PF_DEBUG_MISC,
("pool_ticket: %d != %d\n", pr->pool_ticket,
@@ -5850,7 +5937,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
rule = pool_get(&V_pf_rule_pl, PR_NOWAIT);
#else
rule = pool_get(&pf_rule_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -5859,7 +5946,7 @@
}
bcopy(&pr->rule, rule, sizeof(struct pf_rule));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
rule->cuid = td->td_ucred->cr_ruid;
rule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
#else
@@ -5868,7 +5955,7 @@
#ifndef INET
if (rule->af == AF_INET) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -5877,7 +5964,7 @@
#ifndef INET6
if (rule->af == AF_INET6) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -5886,7 +5973,7 @@
rule->kif = pfi_kif_get(rule->ifname);
if (rule->kif == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, rule);
#else
pool_put(&pf_rule_pl, rule);
@@ -5895,7 +5982,7 @@
}
-#ifdef __FreeBSD__ /* ROUTING */
-+#ifdef __FreeBSD_kernel__ /* ROUTING */
++#if 1 /* ROUTING */
if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs)
#else
if (rule->rtableid > 0 && !rtable_exists(rule->rtableid))
@@ -5904,7 +5991,7 @@
if (pf_anchor_setup(rule, ruleset, pr->anchor_call))
error = EINVAL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(pa, &V_pf_pabuf, entries)
#else
TAILQ_FOREACH(pa, &pf_pabuf, entries)
@@ -5913,7 +6000,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_mv_pool(&V_pf_pabuf, &rule->rpool.list);
#else
pf_mv_pool(&pf_pabuf, &rule->rpool.list);
@@ -5922,7 +6009,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!V_debug_pfugidhack && (rule->uid.op || rule->gid.op ||
rule->log & PF_LOG_SOCKET_LOOKUP)) {
DPFPRINTF(PF_DEBUG_MISC,
@@ -5931,7 +6018,7 @@
if (!(pcr->action == PF_CHANGE_REMOVE ||
pcr->action == PF_CHANGE_GET_TICKET) &&
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pcr->pool_ticket != V_ticket_pabuf) {
#else
pcr->pool_ticket != ticket_pabuf) {
@@ -5940,7 +6027,7 @@
if (pcr->action != PF_CHANGE_REMOVE) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
newrule = pool_get(&V_pf_rule_pl, PR_NOWAIT);
#else
newrule = pool_get(&pf_rule_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -5949,7 +6036,7 @@
}
bcopy(&pcr->rule, newrule, sizeof(struct pf_rule));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
newrule->cuid = td->td_ucred->cr_ruid;
newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
#else
@@ -5958,7 +6045,7 @@
#ifndef INET
if (newrule->af == AF_INET) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, newrule);
#else
pool_put(&pf_rule_pl, newrule);
@@ -5967,7 +6054,7 @@
#ifndef INET6
if (newrule->af == AF_INET6) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, newrule);
#else
pool_put(&pf_rule_pl, newrule);
@@ -5976,7 +6063,7 @@
newrule->kif = pfi_kif_get(newrule->ifname);
if (newrule->kif == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_rule_pl, newrule);
#else
pool_put(&pf_rule_pl, newrule);
@@ -5985,7 +6072,7 @@
if (newrule->rtableid > 0 &&
-#ifdef __FreeBSD__ /* ROUTING */
-+#ifdef __FreeBSD_kernel__ /* ROUTING */
++#if 1 /* ROUTING */
newrule->rtableid >= rt_numfibs)
#else
!rtable_exists(newrule->rtableid))
@@ -5994,7 +6081,7 @@
if (pf_anchor_setup(newrule, ruleset, pcr->anchor_call))
error = EINVAL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(pa, &V_pf_pabuf, entries)
#else
TAILQ_FOREACH(pa, &pf_pabuf, entries)
@@ -6003,7 +6090,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_mv_pool(&V_pf_pabuf, &newrule->rpool.list);
#else
pf_mv_pool(&pf_pabuf, &newrule->rpool.list);
@@ -6012,7 +6099,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!V_debug_pfugidhack && (newrule->uid.op ||
newrule->gid.op ||
newrule->log & PF_LOG_SOCKET_LOOKUP)) {
@@ -6021,7 +6108,7 @@
newrule->bytes[0] = newrule->bytes[1] = 0;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_empty_pool(&V_pf_pabuf);
#else
pf_empty_pool(&pf_pabuf);
@@ -6030,7 +6117,7 @@
u_int killed = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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
@@ -6039,7 +6126,7 @@
psk->psk_killed = killed;
#if NPFSYNC > 0
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_clear_states_ptr != NULL)
pfsync_clear_states_ptr(V_pf_status.hostid, psk->psk_ifname);
#else
@@ -6048,7 +6135,7 @@
if (psk->psk_pfcmp.id) {
if (psk->psk_pfcmp.creatorid == 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
psk->psk_pfcmp.creatorid = V_pf_status.hostid;
#else
psk->psk_pfcmp.creatorid = pf_status.hostid;
@@ -6057,7 +6144,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -6066,7 +6153,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pfsync_state_import_ptr != NULL)
error = pfsync_state_import_ptr(sp, PFSYNC_SI_IOCTL);
#else
@@ -6075,7 +6162,7 @@
if (ps->ps_len == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
nr = V_pf_status.states;
#else
nr = pf_status.states;
@@ -6084,19 +6171,19 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
pstore = malloc(sizeof(*pstore), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
p = ps->ps_states;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
state = TAILQ_FIRST(&V_state_list);
#else
state = TAILQ_FIRST(&state_list);
@@ -6105,7 +6192,7 @@
break;
pfsync_state_export(pstore, state);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYOUT(pstore, p, sizeof(*p), error);
#else
error = copyout(pstore, p, sizeof(*p));
@@ -6114,7 +6201,7 @@
case DIOCGETSTATUS: {
struct pf_status *s = (struct pf_status *)addr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
bcopy(&V_pf_status, s, sizeof(struct pf_status));
#else
bcopy(&pf_status, s, sizeof(struct pf_status));
@@ -6123,7 +6210,7 @@
if (pi->ifname[0] == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
bzero(V_pf_status.ifname, IFNAMSIZ);
#else
bzero(pf_status.ifname, IFNAMSIZ);
@@ -6131,7 +6218,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
strlcpy(V_pf_status.ifname, pi->ifname, IFNAMSIZ);
#else
strlcpy(pf_status.ifname, pi->ifname, IFNAMSIZ);
@@ -6140,7 +6227,7 @@
case DIOCCLRSTATUS: {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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));
@@ -6149,7 +6236,7 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
old = V_pf_default_rule.timeout[pt->timeout];
#else
old = pf_default_rule.timeout[pt->timeout];
@@ -6157,7 +6244,7 @@
if (pt->timeout == PFTM_INTERVAL && pt->seconds == 0)
pt->seconds = 1;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_default_rule.timeout[pt->timeout] = pt->seconds;
#else
pf_default_rule.timeout[pt->timeout] = pt->seconds;
@@ -6166,7 +6253,7 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pt->seconds = V_pf_default_rule.timeout[pt->timeout];
#else
pt->seconds = pf_default_rule.timeout[pt->timeout];
@@ -6175,7 +6262,7 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pl->limit = V_pf_pool_limits[pl->index].limit;
#else
pl->limit = pf_pool_limits[pl->index].limit;
@@ -6184,7 +6271,7 @@
if (pl->index < 0 || pl->index >= PF_LIMIT_MAX ||
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_pool_limits[pl->index].pp == NULL) {
#else
pf_pool_limits[pl->index].pp == NULL) {
@@ -6193,7 +6280,7 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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;
@@ -6202,7 +6289,7 @@
u_int32_t *level = (u_int32_t *)addr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.debug = *level;
#else
pf_status.debug = *level;
@@ -6211,7 +6298,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
case DIOCGIFSPEED: {
struct pf_ifspeed *psp = (struct pf_ifspeed *)addr;
struct pf_ifspeed ps;
@@ -6220,7 +6307,7 @@
/* enable all altq interfaces on active list */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(altq, V_pf_altqs_active, entries) {
if (altq->qname[0] == 0 && (altq->local_flags &
PFALTQ_FLAG_IF_REMOVED) == 0) {
@@ -6229,7 +6316,7 @@
}
if (error == 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_altq_running = 1;
#else
pf_altq_running = 1;
@@ -6238,7 +6325,7 @@
/* disable all altq interfaces on active list */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(altq, V_pf_altqs_active, entries) {
if (altq->qname[0] == 0 && (altq->local_flags &
PFALTQ_FLAG_IF_REMOVED) == 0) {
@@ -6247,7 +6334,7 @@
}
if (error == 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_altq_running = 0;
#else
pf_altq_running = 0;
@@ -6256,7 +6343,7 @@
struct pf_altq *altq, *a;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pa->ticket != V_ticket_altqs_inactive) {
#else
if (pa->ticket != ticket_altqs_inactive) {
@@ -6265,7 +6352,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
altq = pool_get(&V_pf_altq_pl, PR_NOWAIT);
#else
altq = pool_get(&pf_altq_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -6274,7 +6361,7 @@
}
bcopy(&pa->altq, altq, sizeof(struct pf_altq));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
altq->local_flags = 0;
#endif
@@ -6283,7 +6370,7 @@
if ((altq->qid = pf_qname2qid(altq->qname)) == 0) {
error = EBUSY;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -6292,7 +6379,7 @@
}
altq->altq_disc = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(a, V_pf_altqs_inactive, entries) {
#else
TAILQ_FOREACH(a, pf_altqs_inactive, entries) {
@@ -6301,7 +6388,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct ifnet *ifp;
if ((ifp = ifunit(altq->ifname)) == NULL) {
@@ -6310,13 +6397,13 @@
#endif
error = altq_add(altq);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
}
#endif
if (error) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_altq_pl, altq);
#else
pool_put(&pf_altq_pl, altq);
@@ -6325,7 +6412,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_INSERT_TAIL(V_pf_altqs_inactive, altq, entries);
#else
TAILQ_INSERT_TAIL(pf_altqs_inactive, altq, entries);
@@ -6334,7 +6421,7 @@
pa->nr = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_FOREACH(altq, V_pf_altqs_active, entries)
pa->nr++;
pa->ticket = V_ticket_altqs_active;
@@ -6343,7 +6430,7 @@
u_int32_t nr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pa->ticket != V_ticket_altqs_active) {
#else
if (pa->ticket != ticket_altqs_active) {
@@ -6352,7 +6439,7 @@
}
nr = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
altq = TAILQ_FIRST(V_pf_altqs_active);
#else
altq = TAILQ_FIRST(pf_altqs_active);
@@ -6361,7 +6448,7 @@
int nbytes;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pq->ticket != V_ticket_altqs_active) {
#else
if (pq->ticket != ticket_altqs_active) {
@@ -6370,7 +6457,7 @@
nbytes = pq->nbytes;
nr = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
altq = TAILQ_FIRST(V_pf_altqs_active);
#else
altq = TAILQ_FIRST(pf_altqs_active);
@@ -6379,7 +6466,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((altq->local_flags & PFALTQ_FLAG_IF_REMOVED) != 0) {
error = ENXIO;
break;
@@ -6388,7 +6475,7 @@
#endif
error = altq_getqstats(altq, pq->buf, &nbytes);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
if (error == 0) {
@@ -6397,7 +6484,7 @@
struct pfioc_pooladdr *pp = (struct pfioc_pooladdr *)addr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_empty_pool(&V_pf_pabuf);
pp->ticket = ++V_ticket_pabuf;
#else
@@ -6406,7 +6493,7 @@
struct pfioc_pooladdr *pp = (struct pfioc_pooladdr *)addr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pp->ticket != V_ticket_pabuf) {
#else
if (pp->ticket != ticket_pabuf) {
@@ -6415,7 +6502,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pa = pool_get(&V_pf_pooladdr_pl, PR_NOWAIT);
#else
pa = pool_get(&pf_pooladdr_pl, PR_WAITOK|PR_LIMITFAIL);
@@ -6424,7 +6511,7 @@
pa->kif = pfi_kif_get(pa->ifname);
if (pa->kif == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, pa);
#else
pool_put(&pf_pooladdr_pl, pa);
@@ -6433,7 +6520,7 @@
pfi_dynaddr_remove(&pa->addr);
pfi_kif_unref(pa->kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, pa);
#else
pool_put(&pf_pooladdr_pl, pa);
@@ -6442,7 +6529,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_INSERT_TAIL(&V_pf_pabuf, pa, entries);
#else
TAILQ_INSERT_TAIL(&pf_pabuf, pa, entries);
@@ -6451,7 +6538,7 @@
}
if (pca->action != PF_CHANGE_REMOVE) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
newpa = pool_get(&V_pf_pooladdr_pl,
PR_NOWAIT);
#else
@@ -6460,7 +6547,7 @@
#ifndef INET
if (pca->af == AF_INET) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -6469,7 +6556,7 @@
#ifndef INET6
if (pca->af == AF_INET6) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -6478,7 +6565,7 @@
newpa->kif = pfi_kif_get(newpa->ifname);
if (newpa->kif == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -6487,7 +6574,7 @@
pfi_dynaddr_remove(&newpa->addr);
pfi_kif_unref(newpa->kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, newpa);
#else
pool_put(&pf_pooladdr_pl, newpa);
@@ -6496,7 +6583,7 @@
pf_tbladdr_remove(&oldpa->addr);
pfi_kif_unref(oldpa->kif, PFI_KIF_REF_RULE);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_pooladdr_pl, oldpa);
#else
pool_put(&pf_pooladdr_pl, oldpa);
@@ -6505,7 +6592,7 @@
if (ruleset->anchor == NULL) {
/* XXX kludge for pf_main_ruleset */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(anchor, pf_anchor_global, &V_pf_anchors)
#else
RB_FOREACH(anchor, pf_anchor_global, &pf_anchors)
@@ -6514,7 +6601,7 @@
if (ruleset->anchor == NULL) {
/* XXX kludge for pf_main_ruleset */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(anchor, pf_anchor_global, &V_pf_anchors)
#else
RB_FOREACH(anchor, pf_anchor_global, &pf_anchors)
@@ -6523,18 +6610,18 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -6543,7 +6630,7 @@
break;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYOUT(ioe, io->array+i, sizeof(io->array[i]),
error);
if (error) {
@@ -6552,18 +6639,18 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -6572,19 +6659,19 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
/* first makes sure everything will succeed */
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -6593,7 +6680,7 @@
goto fail;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (!V_altqs_inactive_open || ioe->ticket !=
V_ticket_altqs_inactive) {
#else
@@ -6602,7 +6689,7 @@
/* now do the commit - no errors should happen here */
for (i = 0; i < io->size; i++) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
if (error) {
#else
@@ -6611,7 +6698,7 @@
if (space == 0) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking)
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking)
@@ -6620,17 +6707,17 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
#endif
pstore = malloc(sizeof(*pstore), M_TEMP, M_WAITOK);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK();
#endif
p = psn->psn_src_nodes;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
@@ -6639,7 +6726,7 @@
n->conn_rate.seconds;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_COPYOUT(pstore, p, sizeof(*p), error);
#else
error = copyout(pstore, p, sizeof(*p));
@@ -6648,7 +6735,7 @@
struct pf_state *state;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(state, pf_state_tree_id, &V_tree_id) {
#else
RB_FOREACH(state, pf_state_tree_id, &tree_id) {
@@ -6657,7 +6744,7 @@
state->nat_src_node = NULL;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
@@ -6666,7 +6753,7 @@
}
pf_purge_expired_src_nodes(1);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.src_nodes = 0;
#else
pf_status.src_nodes = 0;
@@ -6675,7 +6762,7 @@
u_int killed = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(sn, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(sn, pf_src_tree, &tree_src_tracking) {
@@ -6684,7 +6771,7 @@
if (sn->states != 0) {
RB_FOREACH(s, pf_state_tree_id,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
&V_tree_id) {
#else
&tree_id) {
@@ -6693,7 +6780,7 @@
u_int32_t *hostid = (u_int32_t *)addr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (*hostid == 0)
V_pf_status.hostid = arc4random();
else
@@ -6702,7 +6789,7 @@
}
fail:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_UNLOCK();
if (flags & FWRITE)
@@ -6711,7 +6798,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
void
pfsync_state_export(struct pfsync_state *sp, struct pf_state *st)
{
@@ -6720,7 +6807,7 @@
struct pf_state *state;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(state, pf_state_tree_id, &V_tree_id) {
#else
RB_FOREACH(state, pf_state_tree_id, &tree_id) {
@@ -6729,7 +6816,7 @@
struct pf_state *state;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(state, pf_state_tree_id, &V_tree_id) {
#else
RB_FOREACH(state, pf_state_tree_id, &tree_id) {
@@ -6738,7 +6825,7 @@
state->nat_src_node = NULL;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_FOREACH(n, pf_src_tree, &V_tree_src_tracking) {
#else
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
@@ -6749,7 +6836,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -6758,7 +6845,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_bpf.h"
#include "opt_pf.h"
@@ -6767,16 +6854,16 @@
#include <sys/kernel.h>
#include <sys/time.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/sysctl.h>
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/pool.h>
#endif
#include <sys/proc.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/sx.h>
@@ -6785,7 +6872,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/md5.h>
#else
#include <crypto/md5.h>
@@ -6794,7 +6881,7 @@
#include <netinet/if_ether.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <dev/rndvar.h>
#endif
#include <net/pfvar.h>
@@ -6803,7 +6890,7 @@
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x
#else
#define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x
@@ -6812,7 +6899,7 @@
dst->port[1], dport))
r = r->skip[PF_SKIP_DST_PORT].ptr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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))
@@ -6821,7 +6908,7 @@
NULL, NULL);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (pf_tag_packet(m, tag, rtableid, pd->pf_mtag))
#else
if (pf_tag_packet(m, tag, rtableid))
@@ -6830,7 +6917,7 @@
}
/* low < high */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
cut = htonl(arc4random()) % (1 + high - low) + low;
#else
cut = arc4random_uniform(1 + high - low) + low;
@@ -6839,7 +6926,7 @@
key.port[0] = htons(tmp);
if (pf_find_state_all(&key, PF_IN, NULL) ==
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
NULL) {
#else
NULL && !in_baddynamic(tmp, proto)) {
@@ -6848,7 +6935,7 @@
key.port[0] = htons(tmp);
if (pf_find_state_all(&key, PF_IN, NULL) ==
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
NULL) {
#else
NULL && !in_baddynamic(tmp, proto)) {
@@ -6857,7 +6944,7 @@
else
k.rule.ptr = NULL;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_status.scounters[SCNT_SRC_NODE_SEARCH]++;
*sn = RB_FIND(pf_src_tree, &V_tree_src_tracking, &k);
#else
@@ -6866,7 +6953,7 @@
if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) {
PF_ACPY(naddr, &(*sn)->raddr, af);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -6875,7 +6962,7 @@
PF_ACPY(&(*sn)->raddr, naddr, af);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC &&
#else
if (pf_status.debug >= PF_DEBUG_MISC &&
@@ -6884,7 +6971,7 @@
*/
if (!bcmp(*skp, *nkp, sizeof(struct pf_state_key_cmp))) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_state_key_pl, *nkp);
pool_put(&V_pf_state_key_pl, *skp);
#else
@@ -6895,7 +6982,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_pf.h"
@@ -6904,7 +6991,7 @@
#include <sys/kernel.h>
#include <sys/time.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/pool.h>
#include <dev/rndvar.h>
@@ -6913,7 +7000,7 @@
#include <net/pfvar.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
struct pf_frent {
LIST_ENTRY(pf_frent) fr_next;
struct ip *fr_ip;
@@ -6922,7 +7009,7 @@
#define BUFFER_FRAGMENTS(fr) (!((fr)->fr_flags & PFFRAG_NOBUFFER))
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
struct pf_fragment {
RB_ENTRY(pf_fragment) fr_entry;
TAILQ_ENTRY(pf_fragment) frag_next;
@@ -6931,7 +7018,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_HEAD(pf_fragqueue, pf_fragment);
TAILQ_HEAD(pf_cachequeue, pf_fragment);
VNET_DEFINE(struct pf_fragqueue, pf_fragqueue);
@@ -6940,7 +7027,7 @@
#endif
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
static __inline int pf_frag_compare(struct pf_fragment *,
struct pf_fragment *);
#else
@@ -6949,7 +7036,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -6958,7 +7045,7 @@
void pf_scrub_ip6(struct mbuf **, u_int8_t);
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define DPFPRINTF(x) do { \
if (V_pf_status.debug >= PF_DEBUG_MISC) { \
printf("%s: ", __func__); \
@@ -6967,7 +7054,7 @@
/* Globals */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
VNET_DEFINE(uma_zone_t, pf_frent_pl);
VNET_DEFINE(uma_zone_t, pf_frag_pl);
VNET_DEFINE(uma_zone_t, pf_cache_pl);
@@ -6976,7 +7063,7 @@
pf_normalize_init(void)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/*
* XXX
* No high water mark support(It's hint not hard limit).
@@ -6985,7 +7072,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_INIT(&V_pf_fragqueue);
TAILQ_INIT(&V_pf_cachequeue);
#else
@@ -6994,7 +7081,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static int
#else
static __inline int
@@ -7003,7 +7090,7 @@
{
struct pf_fragment *frag;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_int32_t expire = time_second -
V_pf_default_rule.timeout[PFTM_FRAG];
#else
@@ -7012,7 +7099,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
while ((frag = TAILQ_LAST(&V_pf_fragqueue, pf_fragqueue)) != NULL) {
KASSERT((BUFFER_FRAGMENTS(frag)),
("BUFFER_FRAGMENTS(frag) == 0: %s", __FUNCTION__));
@@ -7021,7 +7108,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
while ((frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue)) != NULL) {
KASSERT((!BUFFER_FRAGMENTS(frag)),
("BUFFER_FRAGMENTS(frag) != 0: %s", __FUNCTION__));
@@ -7030,7 +7117,7 @@
DPFPRINTF(("expiring %d(%p)\n", frag->fr_id, frag));
pf_free_fragment(frag);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((TAILQ_EMPTY(&V_pf_cachequeue) ||
TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue) != frag),
("!(TAILQ_EMPTY() || TAILQ_LAST() == farg): %s",
@@ -7039,7 +7126,7 @@
int goal;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
goal = V_pf_nfrents * 9 / 10;
DPFPRINTF(("trying to free > %d frents\n",
V_pf_nfrents - goal));
@@ -7048,7 +7135,7 @@
while (goal < pf_nfrents) {
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
frag = TAILQ_LAST(&V_pf_fragqueue, pf_fragqueue);
#else
frag = TAILQ_LAST(&pf_fragqueue, pf_fragqueue);
@@ -7057,7 +7144,7 @@
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
goal = V_pf_ncache * 9 / 10;
DPFPRINTF(("trying to free > %d cache entries\n",
V_pf_ncache - goal));
@@ -7066,7 +7153,7 @@
while (goal < pf_ncache) {
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue);
#else
frag = TAILQ_LAST(&pf_cachequeue, pf_cachequeue);
@@ -7075,7 +7162,7 @@
m_freem(frent->fr_m);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -7084,7 +7171,7 @@
LIST_REMOVE(frcache, fr_next);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((LIST_EMPTY(&frag->fr_cache) ||
LIST_FIRST(&frag->fr_cache)->fr_off >
frcache->fr_end),
@@ -7093,7 +7180,7 @@
frag->fr_timeout = time_second;
if (BUFFER_FRAGMENTS(frag)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_REMOVE(&V_pf_fragqueue, frag, frag_next);
TAILQ_INSERT_HEAD(&V_pf_fragqueue, frag, frag_next);
#else
@@ -7102,7 +7189,7 @@
#endif
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
TAILQ_REMOVE(&V_pf_cachequeue, frag, frag_next);
TAILQ_INSERT_HEAD(&V_pf_cachequeue, frag, frag_next);
#else
@@ -7111,7 +7198,7 @@
{
if (BUFFER_FRAGMENTS(frag)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -7120,7 +7207,7 @@
#endif
} else {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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);
@@ -7129,7 +7216,7 @@
u_int16_t max = ip_len + off;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((*frag == NULL || BUFFER_FRAGMENTS(*frag)),
("! (*frag == NULL || BUFFER_FRAGMENTS(*frag)): %s", __FUNCTION__));
#else
@@ -7138,7 +7225,7 @@
/* Create a new reassembly queue for this packet */
if (*frag == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*frag = pool_get(&V_pf_frag_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_frag_pl, PR_NOWAIT);
@@ -7146,7 +7233,7 @@
if (*frag == NULL) {
pf_flush_fragments();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*frag = pool_get(&V_pf_frag_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_frag_pl, PR_NOWAIT);
@@ -7155,7 +7242,7 @@
LIST_INIT(&(*frag)->fr_queue);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_INSERT(pf_frag_tree, &V_pf_frag_tree, *frag);
TAILQ_INSERT_HEAD(&V_pf_fragqueue, *frag, frag_next);
#else
@@ -7164,7 +7251,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((frep != NULL || frea != NULL),
("!(frep != NULL || frea != NULL): %s", __FUNCTION__));;
#else
@@ -7173,7 +7260,7 @@
m_freem(frea->fr_m);
LIST_REMOVE(frea, fr_next);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_frent_pl, frea);
V_pf_nfrents--;
#else
@@ -7182,7 +7269,7 @@
/* We have all the data */
frent = LIST_FIRST(&(*frag)->fr_queue);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((frent != NULL), ("frent == NULL: %s", __FUNCTION__));
#else
KASSERT(frent != NULL);
@@ -7191,7 +7278,7 @@
m->m_next = NULL;
m_cat(m, m2);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -7200,7 +7287,7 @@
m2 = frent->fr_m;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -7208,7 +7295,7 @@
pf_nfrents--;
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m->m_pkthdr.csum_flags &= m2->m_pkthdr.csum_flags;
m->m_pkthdr.csum_data += m2->m_pkthdr.csum_data;
#endif
@@ -7216,7 +7303,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
while (m->m_pkthdr.csum_data & 0xffff0000)
m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) +
(m->m_pkthdr.csum_data >> 16);
@@ -7225,7 +7312,7 @@
drop_fragment:
/* Oops - fail safe - drop packet */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_frent_pl, frent);
V_pf_nfrents--;
#else
@@ -7234,7 +7321,7 @@
int hosed = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((*frag == NULL || !BUFFER_FRAGMENTS(*frag)),
("!(*frag == NULL || !BUFFER_FRAGMENTS(*frag)): %s", __FUNCTION__));
#else
@@ -7243,7 +7330,7 @@
/* Create a new range queue for this packet */
if (*frag == NULL) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*frag = pool_get(&V_pf_cache_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_cache_pl, PR_NOWAIT);
@@ -7251,7 +7338,7 @@
if (*frag == NULL) {
pf_flush_fragments();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*frag = pool_get(&V_pf_cache_pl, PR_NOWAIT);
#else
*frag = pool_get(&pf_cache_pl, PR_NOWAIT);
@@ -7260,7 +7347,7 @@
/* Get an entry for the queue */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
cur = pool_get(&V_pf_cent_pl, PR_NOWAIT);
if (cur == NULL) {
pool_put(&V_pf_cache_pl, *frag);
@@ -7269,7 +7356,7 @@
goto no_mem;
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_ncache++;
#else
pf_ncache++;
@@ -7278,7 +7365,7 @@
LIST_INSERT_HEAD(&(*frag)->fr_cache, cur, fr_next);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_INSERT(pf_frag_tree, &V_pf_cache_tree, *frag);
TAILQ_INSERT_HEAD(&V_pf_cachequeue, *frag, frag_next);
#else
@@ -7287,7 +7374,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((frp != NULL || fra != NULL),
("!(frp != NULL || fra != NULL): %s", __FUNCTION__));
#else
@@ -7296,7 +7383,7 @@
* I'll pull a rabbit out of my laptop.
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
*m0 = m_dup(m, M_DONTWAIT);
#else
*m0 = m_copym2(m, 0, h->ip_hl << 2, M_NOWAIT);
@@ -7304,7 +7391,7 @@
if (*m0 == NULL)
goto no_mem;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
/* From KAME Project : We have missed this! */
m_adj(*m0, (h->ip_hl << 2) -
(*m0)->m_pkthdr.len);
@@ -7313,7 +7400,7 @@
h = mtod(m, struct ip *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(((int)m->m_len ==
ntohs(h->ip_len) - precut),
("m->m_len != ntohs(h->ip_len) - precut: %s",
@@ -7322,7 +7409,7 @@
max));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
cur = pool_get(&V_pf_cent_pl, PR_NOWAIT);
#else
cur = pool_get(&pf_cent_pl, PR_NOWAIT);
@@ -7330,7 +7417,7 @@
if (cur == NULL)
goto no_mem;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_ncache++;
#else
pf_ncache++;
@@ -7339,7 +7426,7 @@
}
h = mtod(m, struct ip *);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT(((int)m->m_len == ntohs(h->ip_len) - aftercut),
("m->m_len != ntohs(h->ip_len) - aftercut: %s",
__FUNCTION__));
@@ -7348,7 +7435,7 @@
fra->fr_end));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
cur = pool_get(&V_pf_cent_pl, PR_NOWAIT);
#else
cur = pool_get(&pf_cent_pl, PR_NOWAIT);
@@ -7356,7 +7443,7 @@
if (cur == NULL)
goto no_mem;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_ncache++;
#else
pf_ncache++;
@@ -7365,7 +7452,7 @@
fra->fr_off = cur->fr_off;
LIST_REMOVE(cur, fr_next);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_cent_pl, cur);
V_pf_ncache--;
#else
@@ -7374,7 +7461,7 @@
} else if (frp && fra->fr_off <= frp->fr_end) {
/* Need to merge in a modified 'frp' */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((cur == NULL), ("cur != NULL: %s",
__FUNCTION__));
#else
@@ -7383,7 +7470,7 @@
fra->fr_off = frp->fr_off;
LIST_REMOVE(frp, fr_next);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pf_cent_pl, frp);
V_pf_ncache--;
#else
@@ -7392,7 +7479,7 @@
r->dst.neg, NULL, M_GETFIB(m)))
r = r->skip[PF_SKIP_DST_ADDR].ptr;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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))
@@ -7401,7 +7488,7 @@
/* Fully buffer all of the fragments */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
frag = pf_find_fragment(h, &V_pf_frag_tree);
#else
frag = pf_find_fragment(h, &pf_frag_tree);
@@ -7410,7 +7497,7 @@
/* Get an entry for the fragment queue */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
frent = pool_get(&V_pf_frent_pl, PR_NOWAIT);
#else
frent = pool_get(&pf_frent_pl, PR_NOWAIT);
@@ -7419,7 +7506,7 @@
return (PF_DROP);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pf_nfrents++;
#else
pf_nfrents++;
@@ -7428,7 +7515,7 @@
int nomem = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (dir == PF_OUT && pd->pf_mtag->flags & PF_TAG_FRAGCACHE) {
#else
if (dir == PF_OUT && m->m_pkthdr.pf.flags & PF_TAG_FRAGCACHE) {
@@ -7437,7 +7524,7 @@
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
frag = pf_find_fragment(h, &V_pf_cache_tree);
#else
frag = pf_find_fragment(h, &pf_cache_tree);
@@ -7446,7 +7533,7 @@
#endif
if (dir == PF_IN)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pd->pf_mtag->flags |= PF_TAG_FRAGCACHE;
#else
m->m_pkthdr.pf.flags |= PF_TAG_FRAGCACHE;
@@ -7455,7 +7542,7 @@
/* copy back packet headers if we sanitized */
if (rewrite)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
m_copyback(m, off, sizeof(*th), (caddr_t)th);
#else
m_copyback(m, off, sizeof(*th), th);
@@ -7464,7 +7551,7 @@
u_int8_t *opt;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((src->scrub == NULL),
("pf_normalize_tcp_init: src->scrub != NULL"));
@@ -7473,7 +7560,7 @@
pf_normalize_tcp_cleanup(struct pf_state *state)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (state->src.scrub)
pool_put(&V_pf_state_scrub_pl, state->src.scrub);
if (state->dst.scrub)
@@ -7482,7 +7569,7 @@
int got_ts = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
KASSERT((src->scrub || dst->scrub),
("pf_normalize_tcp_statefull: src->scrub && dst->scrub!"));
#else
@@ -7491,7 +7578,7 @@
if (got_ts) {
/* Huh? Multiple timestamps!? */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -7500,7 +7587,7 @@
(uptime.tv_sec - src->scrub->pfss_last.tv_sec > TS_MAX_IDLE ||
time_second - state->creation > TS_MAX_CONN)) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -7509,7 +7596,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 __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -7518,7 +7605,7 @@
*/
if ((ts_fudge = state->rule.ptr->timeout[PFTM_TS_DIFF]) == 0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ts_fudge = V_pf_default_rule.timeout[PFTM_TS_DIFF];
#else
ts_fudge = pf_default_rule.timeout[PFTM_TS_DIFF];
@@ -7527,7 +7614,7 @@
#define TS_MAXFREQ 1100 /* RFC max TS freq of 1Khz + 10% skew */
#define TS_MICROSECS 1000000 /* microseconds per second */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifndef timersub
#define timersub(tvp, uvp, vvp) \
do { \
@@ -7536,7 +7623,7 @@
SEQ_GT(tsecr, dst->scrub->pfss_tsval) ? '2' : ' ',
SEQ_LT(tsecr, dst->scrub->pfss_tsval0)? '3' : ' '));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
DPFPRINTF((" tsval: %u tsecr: %u +ticks: %u "
"idle: %jus %lums\n",
tsval, tsecr, tsval_from_last,
@@ -7545,7 +7632,7 @@
dst->scrub->pfss_tsecr, dst->scrub->pfss_tsval0));
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -7554,7 +7641,7 @@
* stack changed its RFC1323 behavior?!?!
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC) {
#else
if (pf_status.debug >= PF_DEBUG_MISC) {
@@ -7563,7 +7650,7 @@
else {
src->scrub->pfss_flags |= PFSS_DATA_NOTS;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (V_pf_status.debug >= PF_DEBUG_MISC && dst->scrub &&
#else
if (pf_status.debug >= PF_DEBUG_MISC && dst->scrub &&
@@ -7572,7 +7659,7 @@
int opt, cnt, optlen = 0;
int rewrite = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
u_char opts[TCP_MAXOLEN];
#else
u_char opts[MAX_TCPOPTLEN];
@@ -7583,7 +7670,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#endif
@@ -7592,7 +7679,7 @@
#ifdef _KERNEL
#include <sys/systm.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <sys/pool.h>
#endif
#endif /* _KERNEL */
@@ -7601,7 +7688,7 @@
#ifdef _KERNEL
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define DPFPRINTF(format, x...) \
if (V_pf_status.debug >= PF_DEBUG_NOISY) \
printf(format , ##x)
@@ -7610,7 +7697,7 @@
printf(format , ##x)
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
typedef uma_zone_t pool_t;
#else
typedef struct pool pool_t;
@@ -7619,7 +7706,7 @@
#define pool_init(pool, size, a, ao, f, m, p) (*(pool)) = (size)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define NTOHS(x) (x) = ntohs((u_int16_t)(x))
#endif
@@ -7628,7 +7715,7 @@
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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)
@@ -7637,7 +7724,7 @@
fp.fp_wscale);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((fpresult = pf_osfp_find(&V_pf_osfp_list, &fp,
#else
if ((fpresult = pf_osfp_find(&pf_osfp_list, &fp,
@@ -7646,7 +7733,7 @@
/* Initialize the OS fingerprint system */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
int
#else
void
@@ -7654,7 +7741,7 @@
pf_osfp_initialize(void)
{
-#if defined(__FreeBSD__) && defined(_KERNEL)
-+#if defined(__FreeBSD_kernel__) && defined(_KERNEL)
++#if 1 && defined(_KERNEL)
int error = ENOMEM;
do {
@@ -7663,7 +7750,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#ifdef _KERNEL
return (error);
#else
@@ -7672,7 +7759,7 @@
}
-#if defined(__FreeBSD__) && (_KERNEL)
-+#if defined(__FreeBSD_kernel__) && (_KERNEL)
++#if 1 && (_KERNEL)
void
pf_osfp_cleanup(void)
{
@@ -7681,7 +7768,7 @@
struct pf_osfp_entry *entry;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
while ((fp = SLIST_FIRST(&V_pf_osfp_list))) {
SLIST_REMOVE_HEAD(&V_pf_osfp_list, fp_next);
#else
@@ -7690,7 +7777,7 @@
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((fp = pf_osfp_find_exact(&V_pf_osfp_list, &fpadd))) {
#else
if ((fp = pf_osfp_find_exact(&pf_osfp_list, &fpadd))) {
@@ -7699,7 +7786,7 @@
}
if ((entry = pool_get(&pf_osfp_entry_pl,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PR_NOWAIT)) == NULL)
#else
PR_WAITOK|PR_LIMITFAIL)) == NULL)
@@ -7708,7 +7795,7 @@
} else {
if ((fp = pool_get(&pf_osfp_pl,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PR_NOWAIT)) == NULL)
#else
PR_WAITOK|PR_LIMITFAIL)) == NULL)
@@ -7717,7 +7804,7 @@
SLIST_INIT(&fp->fp_oses);
if ((entry = pool_get(&pf_osfp_entry_pl,
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PR_NOWAIT)) == NULL) {
#else
PR_WAITOK|PR_LIMITFAIL)) == NULL) {
@@ -7726,7 +7813,7 @@
return (ENOMEM);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pf_osfp_insert(&V_pf_osfp_list, fp);
#else
pf_osfp_insert(&pf_osfp_list, fp);
@@ -7735,7 +7822,7 @@
memset(fpioc, 0, sizeof(*fpioc));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
SLIST_FOREACH(fp, &V_pf_osfp_list, fp_next) {
#else
SLIST_FOREACH(fp, &pf_osfp_list, fp_next) {
@@ -7744,7 +7831,7 @@
struct pf_os_fingerprint *f, *f2, find;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
SLIST_FOREACH(f, &V_pf_osfp_list, fp_next) {
#else
SLIST_FOREACH(f, &pf_osfp_list, fp_next) {
@@ -7753,7 +7840,7 @@
else if (f->fp_flags & PF_OSFP_WSIZE_MOD)
find.fp_wsize *= 2;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (f != (f2 = pf_osfp_find(&V_pf_osfp_list, &find, 0))) {
#else
if (f != (f2 = pf_osfp_find(&pf_osfp_list, &find, 0))) {
@@ -7764,7 +7851,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#endif
@@ -7773,7 +7860,7 @@
#ifdef _KERNEL
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#define DPFPRINTF(format, x...) \
if (V_pf_status.debug >= PF_DEBUG_NOISY) \
printf(format , ##x)
@@ -7782,7 +7869,7 @@
printf(format , ##x)
#endif
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#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)
@@ -7791,7 +7878,7 @@
#endif /* _KERNEL */
-#if defined(__FreeBSD__) && !defined(_KERNEL)
-+#if defined(__FreeBSD_kernel__) && !defined(_KERNEL)
++#if 1 && !defined(_KERNEL)
#undef V_pf_anchors
#define V_pf_anchors pf_anchors
@@ -7800,7 +7887,7 @@
#endif
-#if defined(__FreeBSD__) && defined(_KERNEL)
-+#if defined(__FreeBSD_kernel__) && defined(_KERNEL)
++#if 1 && defined(_KERNEL)
VNET_DEFINE(struct pf_anchor_global, pf_anchors);
VNET_DEFINE(struct pf_anchor, pf_main_anchor);
#else
@@ -7809,7 +7896,7 @@
return (NULL);
strlcpy(key->path, path, sizeof(key->path));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
found = RB_FIND(pf_anchor_global, &V_pf_anchors, key);
#else
found = RB_FIND(pf_anchor_global, &pf_anchors, key);
@@ -7818,7 +7905,7 @@
char *p, *q, *r;
struct pf_ruleset *ruleset;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pf_anchor *anchor = NULL, *dup, *parent = NULL;
#else
struct pf_anchor *anchor, *dup, *parent = NULL;
@@ -7827,7 +7914,7 @@
}
strlcat(anchor->path, anchor->name, sizeof(anchor->path));
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) !=
#else
if ((dup = RB_INSERT(pf_anchor_global, &pf_anchors, anchor)) !=
@@ -7836,7 +7923,7 @@
"'%s' '%s'\n", anchor->path, anchor->name,
dup->path, dup->name);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_anchor_global, &V_pf_anchors,
#else
RB_REMOVE(pf_anchor_global, &pf_anchors,
@@ -7845,7 +7932,7 @@
ruleset->rules[i].inactive.open)
return;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor);
#else
RB_REMOVE(pf_anchor_global, &pf_anchors, ruleset->anchor);
@@ -7856,7 +7943,7 @@
*/
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -7865,7 +7952,7 @@
#include <sys/mbuf.h>
#include <sys/kernel.h>
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
#include <sys/malloc.h>
#else
#include <sys/pool.h>
@@ -7874,7 +7961,7 @@
#include <net/route.h>
#include <netinet/in.h>
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
#include <netinet/ip_ipsp.h>
#endif
#include <net/pfvar.h>
@@ -7883,7 +7970,7 @@
} while (0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
static inline int
_copyin(const void *uaddr, void *kaddr, size_t len)
{
@@ -7892,7 +7979,7 @@
#define senderr(e) do { rv = (e); goto _bad; } while (0)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
VNET_DEFINE(uma_zone_t, pfr_ktable_pl);
VNET_DEFINE(uma_zone_t, pfr_kentry_pl);
VNET_DEFINE(uma_zone_t, pfr_kcounters_pl);
@@ -7901,7 +7988,7 @@
pfr_initialize(void)
{
-#ifndef __FreeBSD__
-+#ifndef __FreeBSD_kernel__
++#if 0
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,
@@ -7910,14 +7997,14 @@
w.pfrw_free = kt->pfrkt_cnt;
w.pfrw_flags = flags;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
rv = kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree,
&w);
#else
@@ -7926,14 +8013,14 @@
if (flags & PFR_FLAG_ATOMIC)
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
rv = kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree,
&w);
#else
@@ -7942,7 +8029,7 @@
w.pfrw_workq = workq;
if (kt->pfrkt_ip4 != NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree,
&w))
#else
@@ -7951,7 +8038,7 @@
printf("pfr_enqueue_addrs: IPv4 walktree failed.\n");
if (kt->pfrkt_ip6 != NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree,
&w))
#else
@@ -7960,14 +8047,14 @@
bzero(&w, sizeof(w));
w.pfrw_op = PFRW_MARK;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
if (kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree, &w))
#else
if (rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w))
@@ -7976,7 +8063,7 @@
{
union sockaddr_union sa, mask;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct radix_node_head *head = NULL;
#else
struct radix_node_head *head;
@@ -7985,7 +8072,7 @@
pfr_prepare_network(&mask, ad->pfra_af, ad->pfra_net);
s = splsoftnet(); /* rn_lookup makes use of globals */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#endif
ke = (struct pfr_kentry *)rn_lookup(&sa, &mask, head);
@@ -7994,7 +8081,7 @@
struct pfr_kentry *ke;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
#else
if (intr)
@@ -8003,7 +8090,7 @@
{
if (ke->pfrke_counters)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pfr_kcounters_pl, ke->pfrke_counters);
pool_put(&V_pfr_kentry_pl, ke);
#else
@@ -8012,7 +8099,7 @@
p->pfrke_not = !p->pfrke_not;
if (p->pfrke_counters) {
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pfr_kcounters_pl, p->pfrke_counters);
#else
pool_put(&pfr_kcounters_pl, p->pfrke_counters);
@@ -8021,7 +8108,7 @@
union sockaddr_union mask;
struct radix_node *rn;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct radix_node_head *head = NULL;
#else
struct radix_node_head *head;
@@ -8030,20 +8117,20 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#endif
if (KENTRY_NETWORK(ke)) {
pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
rn = rn_addroute(&ke->pfrke_sa, NULL, head, ke->pfrke_node);
#else
rn = rn_addroute(&ke->pfrke_sa, NULL, head, ke->pfrke_node, 0);
@@ -8052,7 +8139,7 @@
union sockaddr_union mask;
struct radix_node *rn;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct radix_node_head *head = NULL;
#else
struct radix_node_head *head;
@@ -8061,20 +8148,20 @@
s = splsoftnet();
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_LOCK_ASSERT();
#endif
if (KENTRY_NETWORK(ke)) {
pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
rn = rn_delete(&ke->pfrke_sa, &mask, head);
#else
rn = rn_delete(&ke->pfrke_sa, &mask, head, NULL);
#endif
} else
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
rn = rn_delete(&ke->pfrke_sa, NULL, head);
#else
rn = rn_delete(&ke->pfrke_sa, NULL, head, NULL);
@@ -8083,7 +8170,7 @@
if (w->pfrw_dyn->pfid_acnt4++ > 0)
break;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pfr_prepare_network(&V_pfr_mask, AF_INET, ke->pfrke_net);
#else
pfr_prepare_network(&pfr_mask, AF_INET, ke->pfrke_net);
@@ -8092,7 +8179,7 @@
&ke->pfrke_sa, AF_INET);
w->pfrw_dyn->pfid_mask4 = *SUNION2PF(
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
&V_pfr_mask, AF_INET);
#else
&pfr_mask, AF_INET);
@@ -8101,7 +8188,7 @@
if (w->pfrw_dyn->pfid_acnt6++ > 0)
break;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pfr_prepare_network(&V_pfr_mask, AF_INET6, ke->pfrke_net);
#else
pfr_prepare_network(&pfr_mask, AF_INET6, ke->pfrke_net);
@@ -8110,7 +8197,7 @@
&ke->pfrke_sa, AF_INET6);
w->pfrw_dyn->pfid_mask6 = *SUNION2PF(
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
&V_pfr_mask, AF_INET6);
#else
&pfr_mask, AF_INET6);
@@ -8119,7 +8206,7 @@
struct pf_ruleset *rs;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
#else
if (intr)
@@ -8128,7 +8215,7 @@
pfr_destroy_kentries(&addrq);
}
-#if defined(__FreeBSD__) && (__FreeBSD_version >= 500100)
-+#if defined(__FreeBSD_kernel__) && (__FreeBSD_version >= 500100)
++#if 1 && (__FreeBSD_version >= 500100)
if (kt->pfrkt_ip4 != NULL) {
RADIX_NODE_HEAD_DESTROY(kt->pfrkt_ip4);
free((caddr_t)kt->pfrkt_ip4, M_RTABLE);
@@ -8137,7 +8224,7 @@
pf_remove_if_empty_ruleset(kt->pfrkt_rs);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
pool_put(&V_pfr_ktable_pl, kt);
#else
pool_put(&pfr_ktable_pl, kt);
@@ -8146,7 +8233,7 @@
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfr_sin.sin_addr.s_addr = a->addr32[0];
ke = (struct pfr_kentry *)rn_match(&V_pfr_sin, kt->pfrkt_ip4);
#else
@@ -8155,7 +8242,7 @@
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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
@@ -8164,7 +8251,7 @@
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
V_pfr_sin.sin_addr.s_addr = a->addr32[0];
ke = (struct pfr_kentry *)rn_match(&V_pfr_sin, kt->pfrkt_ip4);
#else
@@ -8173,7 +8260,7 @@
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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
@@ -8182,7 +8269,7 @@
(kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) {
if (ke->pfrke_counters == NULL)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
ke->pfrke_counters = pool_get(&V_pfr_kcounters_pl,
#else
ke->pfrke_counters = pool_get(&pfr_kcounters_pl,
@@ -8191,7 +8278,7 @@
struct pf_addr **raddr, struct pf_addr **rmask, sa_family_t af)
{
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
struct pfr_kentry *ke, *ke2 = NULL;
struct pf_addr *addr = NULL;
#else
@@ -8200,7 +8287,7 @@
int idx = -1, use_counter = 0;
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (af == AF_INET)
addr = (struct pf_addr *)&V_pfr_sin.sin_addr;
else if (af == AF_INET6)
@@ -8209,14 +8296,14 @@
return (1);
}
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
*rmask = SUNION2PF(&V_pfr_mask, af);
#else
*rmask = SUNION2PF(&pfr_mask, af);
@@ -8225,7 +8312,7 @@
for (;;) {
/* we don't want to use a nested block */
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
if (af == AF_INET)
ke2 = (struct pfr_kentry *)rn_match(&V_pfr_sin,
kt->pfrkt_ip4);
@@ -8234,7 +8321,7 @@
/* we need to increase the counter past the nested block */
pfr_prepare_network(&mask, AF_INET, ke2->pfrke_net);
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
PF_POOLMASK(addr, addr, SUNION2PF(&mask, af), &V_pfr_ffaddr, af);
#else
PF_POOLMASK(addr, addr, SUNION2PF(&mask, af), &pfr_ffaddr, af);
@@ -8243,7 +8330,7 @@
#ifdef INET
case AF_INET:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
kt->pfrkt_ip4->rnh_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
@@ -8252,7 +8339,7 @@
#ifdef INET6
case AF_INET6:
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
@@ -8261,14 +8348,361 @@
dyn->pfid_acnt6 = 0;
if (!dyn->pfid_af || dyn->pfid_af == AF_INET)
-#ifdef __FreeBSD__
-+#ifdef __FreeBSD_kernel__
++#if 1
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 __FreeBSD_kernel__
++#if 1
kt->pfrkt_ip6->rnh_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
#else
rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
+--- a/sys/contrib/pf/net/pfvar.h
++++ b/sys/contrib/pf/net/pfvar.h
+@@ -37,7 +37,7 @@
+ #include <sys/types.h>
+ #include <sys/queue.h>
+ #include <sys/tree.h>
+-#ifdef __FreeBSD__
++#if 1
+ #include <sys/lock.h>
+ #include <sys/sx.h>
+ #else
+@@ -46,7 +46,7 @@
+
+ #include <net/radix.h>
+ #include <net/route.h>
+-#ifdef __FreeBSD__
++#if 1
+ #include <net/if_clone.h>
+ #include <net/pf_mtag.h>
+ #include <vm/uma.h>
+@@ -54,7 +54,7 @@
+ #include <netinet/ip_ipsp.h>
+ #endif
+
+-#ifdef __FreeBSD__
++#if 1
+ #include <netinet/in.h>
+ #endif
+
+@@ -62,7 +62,7 @@
+
+ struct ip;
+ struct ip6_hdr;
+-#ifdef __FreeBSD__
++#if 1
+ struct inpcb;
+ #endif
+
+@@ -173,7 +173,7 @@
+ } a;
+ char ifname[IFNAMSIZ];
+ char tblname[PF_TABLE_NAME_SIZE];
+-#ifdef __FreeBSD__
++#if 1
+ #define RTLABEL_LEN 32
+ #endif
+ char rtlabelname[RTLABEL_LEN];
+@@ -211,7 +211,7 @@
+ * Address manipulation macros
+ */
+
+-#ifdef __FreeBSD__
++#if 1
+ #define splsoftnet() splnet()
+
+ #define HTONL(x) (x) = htonl((__uint32_t)(x))
+@@ -236,7 +236,7 @@
+ if (var) \
+ uma_zdestroy(var)
+
+-#ifdef __FreeBSD__
++#if 1
+ extern struct mtx pf_task_mtx;
+
+ #define PF_LOCK_ASSERT() mtx_assert(&pf_task_mtx, MA_OWNED)
+@@ -830,7 +830,7 @@
+ u_int64_t id;
+ u_int32_t creatorid;
+ u_int8_t direction;
+-#ifdef __FreeBSD__
++#if 1
+ u_int8_t pad[2];
+ u_int8_t local_flags;
+ #define PFSTATE_EXPIRING 0x01
+@@ -920,7 +920,7 @@
+ sa_family_t af;
+ u_int8_t proto;
+ u_int8_t direction;
+-#ifdef __FreeBSD__
++#if 1
+ u_int8_t local_flags;
+ #define PFSTATE_EXPIRING 0x01
+ u_int8_t pad;
+@@ -932,7 +932,7 @@
+ u_int8_t updates;
+ } __packed;
+
+-#ifdef __FreeBSD__
++#if 1
+ #ifdef _KERNEL
+ /* pfsync */
+ typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t);
+@@ -1212,7 +1212,7 @@
+ RB_HEAD(pfi_ifhead, pfi_kif);
+
+ /* state tables */
+-#ifdef __FreeBSD__
++#if 1
+ #ifdef _KERNEL
+ VNET_DECLARE(struct pf_state_tree, pf_statetbl);
+ #define V_pf_statetbl VNET(pf_statetbl)
+@@ -1274,7 +1274,7 @@
+ struct pf_addr *dst; /* dst address */
+ u_int16_t *sport;
+ u_int16_t *dport;
+-#ifdef __FreeBSD__
++#if 1
+ struct pf_mtag *pf_mtag;
+ #endif
+
+@@ -1400,7 +1400,7 @@
+ *(a) = (x); \
+ } while (0)
+
+-#ifdef __FreeBSD__
++#if 1
+ #define REASON_SET(a, x) \
+ do { \
+ if ((a) != NULL) \
+@@ -1485,7 +1485,7 @@
+ u_int32_t parent_qid; /* parent queue id */
+ u_int32_t bandwidth; /* queue bandwidth */
+ u_int8_t priority; /* priority */
+-#ifdef __FreeBSD__
++#if 1
+ u_int8_t local_flags; /* dynamic interface */
+ #define PFALTQ_FLAG_IF_REMOVED 0x01
+ #endif
+@@ -1765,7 +1765,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__
++#if 1
+ struct pf_ifspeed {
+ char ifname[IFNAMSIZ];
+ u_int32_t baudrate;
+@@ -1776,7 +1776,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__
++#if 1
+ VNET_DECLARE(struct pf_src_tree, tree_src_tracking);
+ #define V_tree_src_tracking VNET(tree_src_tracking)
+ #else
+@@ -1786,7 +1786,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__
++#if 1
+ VNET_DECLARE(struct pf_state_tree_id, tree_id);
+ #define V_tree_id VNET(tree_id)
+ VNET_DECLARE(struct pf_state_queue, state_list);
+@@ -1797,14 +1797,14 @@
+ #endif
+
+ TAILQ_HEAD(pf_poolqueue, pf_pool);
+-#ifdef __FreeBSD__
++#if 1
+ VNET_DECLARE(struct pf_poolqueue, pf_pools[2]);
+ #define V_pf_pools VNET(pf_pools)
+ #else
+ extern struct pf_poolqueue pf_pools[2];
+ #endif
+ TAILQ_HEAD(pf_altqqueue, pf_altq);
+-#ifdef __FreeBSD__
++#if 1
+ VNET_DECLARE(struct pf_altqqueue, pf_altqs[2]);
+ #define V_pf_altqs VNET(pf_altqs)
+ VNET_DECLARE(struct pf_palist, pf_pabuf);
+@@ -1814,7 +1814,7 @@
+ extern struct pf_palist pf_pabuf;
+ #endif
+
+-#ifdef __FreeBSD__
++#if 1
+ 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);
+@@ -1846,7 +1846,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__
++#if 1
+ #ifdef ALTQ
+ extern void pf_altq_ifnet_event(struct ifnet *, int);
+ #endif
+@@ -1885,7 +1885,7 @@
+ extern struct pool pf_state_scrub_pl;
+ #endif
+ extern void pf_purge_thread(void *);
+-#ifdef __FreeBSD__
++#if 1
+ extern int pf_purge_expired_src_nodes(int);
+ extern int pf_purge_expired_states(u_int32_t , int);
+ #else
+@@ -1910,7 +1910,7 @@
+ extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
+ u_int8_t);
+
+-#ifdef __FreeBSD__
++#if 1
+ VNET_DECLARE(struct ifnet *, sync_ifp);
+ #define V_sync_ifp VNET(sync_ifp);
+ VNET_DECLARE(struct pf_rule, pf_default_rule);
+@@ -1923,12 +1923,12 @@
+ u_int8_t);
+ void pf_rm_rule(struct pf_rulequeue *,
+ struct pf_rule *);
+-#ifndef __FreeBSD__
++#if 0
+ struct pf_divert *pf_find_divert(struct mbuf *);
+ #endif
+
+ #ifdef INET
+-#ifdef __FreeBSD__
++#if 1
+ int pf_test(int, struct ifnet *, struct mbuf **, struct ether_header *,
+ struct inpcb *);
+ #else
+@@ -1937,7 +1937,7 @@
+ #endif /* INET */
+
+ #ifdef INET6
+-#ifdef __FreeBSD__
++#if 1
+ int pf_test6(int, struct ifnet *, struct mbuf **, struct ether_header *,
+ struct inpcb *);
+ #else
+@@ -1948,7 +1948,7 @@
+ void pf_addr_inc(struct pf_addr *, sa_family_t);
+ #endif /* INET6 */
+
+-#ifdef __FreeBSD__
++#if 1
+ u_int32_t pf_new_isn(struct pf_state *);
+ #endif
+ void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,
+@@ -1987,7 +1987,7 @@
+ int);
+ int pf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *,
+ int);
+-#ifdef __FreeBSD__
++#if 1
+ int pf_socket_lookup(int, struct pf_pdesc *, struct inpcb *);
+ #else
+ int pf_socket_lookup(int, struct pf_pdesc *);
+@@ -2032,7 +2032,7 @@
+ int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *,
+ int *, u_int32_t, int);
+
+-#ifdef __FreeBSD__
++#if 1
+ VNET_DECLARE(struct pfi_kif *, pfi_all);
+ #define V_pfi_all VNET(pfi_all)
+ #else
+@@ -2040,7 +2040,7 @@
+ #endif
+
+ void pfi_initialize(void);
+-#ifdef __FreeBSD__
++#if 1
+ void pfi_cleanup(void);
+ #endif
+ struct pfi_kif *pfi_kif_get(const char *);
+@@ -2062,7 +2062,7 @@
+ int pfi_set_flags(const char *, int);
+ int pfi_clear_flags(const char *, int);
+
+-#ifdef __FreeBSD__
++#if 1
+ int pf_match_tag(struct mbuf *, struct pf_rule *, int *,
+ struct pf_mtag *);
+ #else
+@@ -2072,7 +2072,7 @@
+ void pf_tag2tagname(u_int16_t, char *);
+ void pf_tag_ref(u_int16_t);
+ void pf_tag_unref(u_int16_t);
+-#ifdef __FreeBSD__
++#if 1
+ int pf_tag_packet(struct mbuf *, int, int, struct pf_mtag *);
+ #else
+ int pf_tag_packet(struct mbuf *, int, int);
+@@ -2081,14 +2081,14 @@
+ void pf_qid2qname(u_int32_t, char *);
+ void pf_qid_unref(u_int32_t);
+
+-#ifdef __FreeBSD__
++#if 1
+ VNET_DECLARE(struct pf_status, pf_status);
+ #define V_pf_status VNET(pf_status)
+ #else
+ extern struct pf_status pf_status;
+ #endif
+
+-#ifdef __FreeBSD__
++#if 1
+ 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);
+@@ -2104,14 +2104,14 @@
+ void *pp;
+ unsigned limit;
+ };
+-#ifdef __FreeBSD__
++#if 1
+ VNET_DECLARE(struct pf_pool_limit, pf_pool_limits[PF_LIMIT_MAX]);
+ #define V_pf_pool_limits VNET(pf_pool_limits)
+ #else
+ extern struct pf_pool_limit pf_pool_limits[PF_LIMIT_MAX];
+ #endif
+
+-#ifdef __FreeBSD__
++#if 1
+ struct pf_frent {
+ LIST_ENTRY(pf_frent) fr_next;
+ struct ip *fr_ip;
+@@ -2145,7 +2145,7 @@
+
+ #endif /* _KERNEL */
+
+-#ifdef __FreeBSD__
++#if 1
+ #ifdef _KERNEL
+ VNET_DECLARE(struct pf_anchor_global, pf_anchors);
+ #define V_pf_anchors VNET(pf_anchors)
+@@ -2173,7 +2173,7 @@
+ struct pf_ruleset *pf_find_or_create_ruleset(const char *);
+ void pf_rs_initialize(void);
+
+-#ifndef __FreeBSD__
++#if 0
+ #ifdef _KERNEL
+ int pf_anchor_copyout(const struct pf_ruleset *,
+ const struct pf_rule *, struct pfioc_rule *);
+@@ -2194,7 +2194,7 @@
+ const struct tcphdr *);
+ void pf_osfp_flush(void);
+ int pf_osfp_get(struct pf_osfp_ioctl *);
+-#ifdef __FreeBSD__
++#if 1
+ int pf_osfp_initialize(void);
+ void pf_osfp_cleanup(void);
+ #else
Modified: trunk/freebsd-utils/debian/patches/pf_regex_followup.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/pf_regex_followup.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/pf_regex_followup.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -12,7 +12,7 @@
else
shell = pw->pw_shell;
--#ifndef __FreeBSD_kernel__
+-#if 0
+#ifndef __FreeBSD__
login_close(lc);
#endif
@@ -21,7 +21,7 @@
strcmp(shell, PATH_AUTHPF_SHELL_NOIP)) {
syslog(LOG_ERR, "wrong shell for user %s, uid %u",
pw->pw_name, pw->pw_uid);
--#ifdef __FreeBSD_kernel__
+-#if 1
+#ifdef __FreeBSD__
login_close(lc);
#else
@@ -30,7 +30,7 @@
goto die;
}
--#ifdef __FreeBSD_kernel__
+-#if 1
+#ifdef __FreeBSD__
login_close(lc);
#else
@@ -45,15 +45,6 @@
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/time.h>
-@@ -585,7 +586,7 @@
-
- /* We don't care about truncation. */
- vsnprintf(buf, sizeof buf, message, ap);
--#ifdef __FreeBSD_kernel__
-+#ifdef __FreeBSD__
- strvis(visbuf, buf, VIS_CSTYLE | VIS_NL);
- #else
- strnvis(visbuf, buf, sizeof visbuf, VIS_CSTYLE | VIS_NL);
--- a/contrib/pf/libevent/kqueue.c
+++ b/contrib/pf/libevent/kqueue.c
@@ -30,6 +30,7 @@
@@ -83,7 +74,7 @@
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
- #ifdef __FreeBSD_kernel__
+ #if 1
--- a/contrib/pf/pfctl/pfctl.c
+++ b/contrib/pf/pfctl/pfctl.c
@@ -34,6 +34,7 @@
Deleted: trunk/freebsd-utils/debian/patches/pf_regex_h.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/pf_regex_h.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/pf_regex_h.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -1,439 +0,0 @@
-
-Generated with:
-
-find . -type f ! -name \*.c ! -name \*.y | grep -v "/\.svn/" | \
- while read i ; do \
- sed -i $i \
- -e 's/defined\( \|\t\)*(\( \|\t\)*__FreeBSD__\( \|\t\)*)/defined(__FreeBSD__) || defined(__FreeBSD_kernel__)/g' \
- -e 's/#\( \|\t\)*ifdef\( \|\t\)*__FreeBSD__/#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)/g' \
- -e 's/#\( \|\t\)*ifndef\( \|\t\)*__FreeBSD__/#if !defined(__FreeBSD__) \&\& !defined(__FreeBSD_kernel__)/g' \
- ; done
---- a/contrib/pf/pfctl/pfctl.h
-+++ b/contrib/pf/pfctl/pfctl.h
-@@ -86,7 +86,7 @@
- int pfctl_show_ifaces(const char *, int);
- FILE *pfctl_fopen(const char *, const char *);
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- extern int altqsupport;
- extern int dummynetsupport;
- #define HTONL(x) (x) = htonl((__uint32_t)(x))
---- a/contrib/pf/pfctl/pfctl_parser.h
-+++ b/contrib/pf/pfctl/pfctl_parser.h
-@@ -159,7 +159,7 @@
- } data;
- };
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- /*
- * XXX
- * Absolutely this is not correct location to define this.
---- a/sys/contrib/pf/net/if_pflog.h
-+++ b/sys/contrib/pf/net/if_pflog.h
-@@ -30,7 +30,7 @@
- #define PFLOGIFS_MAX 16
-
- struct pflog_softc {
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct ifnet *sc_ifp; /* the interface pointer */
- #else
- struct ifnet sc_if; /* the interface */
-@@ -74,7 +74,7 @@
- #define OLD_PFLOG_HDRLEN sizeof(struct old_pfloghdr)
-
- #ifdef _KERNEL
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct pf_rule;
- struct pf_ruleset;
- struct pfi_kif;
---- a/sys/contrib/pf/net/if_pflow.h
-+++ b/sys/contrib/pf/net/if_pflow.h
-@@ -66,7 +66,7 @@
- unsigned int sc_maxcount;
- u_int64_t sc_gcounter;
- struct ip_moptions sc_imo;
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct callout sc_tmo;
- #else
- struct timeout sc_tmo;
---- a/sys/contrib/pf/net/if_pfsync.h
-+++ b/sys/contrib/pf/net/if_pfsync.h
-@@ -268,7 +268,7 @@
- int pfsyncr_authlevel;
- };
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #define SIOCSETPFSYNC _IOW('i', 247, struct ifreq)
- #define SIOCGETPFSYNC _IOWR('i', 248, struct ifreq)
- #endif
-@@ -288,7 +288,7 @@
- #define PFSYNC_S_DEFER 0xfe
- #define PFSYNC_S_NONE 0xff
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- void pfsync_input(struct mbuf *, __unused int);
- #else
- void pfsync_input(struct mbuf *, ...);
-@@ -300,7 +300,7 @@
- #define PFSYNC_SI_CKSUM 0x02
- #define PFSYNC_SI_ACK 0x04
- int pfsync_state_import(struct pfsync_state *, u_int8_t);
--#ifndef __FreeBSD__
-+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
- void pfsync_state_export(struct pfsync_state *,
- struct pf_state *);
- #endif
---- a/sys/contrib/pf/net/pfvar.h
-+++ b/sys/contrib/pf/net/pfvar.h
-@@ -37,7 +37,7 @@
- #include <sys/types.h>
- #include <sys/queue.h>
- #include <sys/tree.h>
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #include <sys/lock.h>
- #include <sys/sx.h>
- #else
-@@ -46,7 +46,7 @@
-
- #include <net/radix.h>
- #include <net/route.h>
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #include <net/if_clone.h>
- #include <net/pf_mtag.h>
- #include <vm/uma.h>
-@@ -54,7 +54,7 @@
- #include <netinet/ip_ipsp.h>
- #endif
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #include <netinet/in.h>
- #endif
-
-@@ -62,7 +62,7 @@
-
- struct ip;
- struct ip6_hdr;
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct inpcb;
- #endif
-
-@@ -173,7 +173,7 @@
- } a;
- char ifname[IFNAMSIZ];
- char tblname[PF_TABLE_NAME_SIZE];
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #define RTLABEL_LEN 32
- #endif
- char rtlabelname[RTLABEL_LEN];
-@@ -211,7 +211,7 @@
- * Address manipulation macros
- */
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #define splsoftnet() splnet()
-
- #define HTONL(x) (x) = htonl((__uint32_t)(x))
-@@ -236,7 +236,7 @@
- if (var) \
- uma_zdestroy(var)
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- extern struct mtx pf_task_mtx;
-
- #define PF_LOCK_ASSERT() mtx_assert(&pf_task_mtx, MA_OWNED)
-@@ -830,7 +830,7 @@
- u_int64_t id;
- u_int32_t creatorid;
- u_int8_t direction;
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- u_int8_t pad[2];
- u_int8_t local_flags;
- #define PFSTATE_EXPIRING 0x01
-@@ -920,7 +920,7 @@
- sa_family_t af;
- u_int8_t proto;
- u_int8_t direction;
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- u_int8_t local_flags;
- #define PFSTATE_EXPIRING 0x01
- u_int8_t pad;
-@@ -932,7 +932,7 @@
- u_int8_t updates;
- } __packed;
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #ifdef _KERNEL
- /* pfsync */
- typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t);
-@@ -1212,7 +1212,7 @@
- RB_HEAD(pfi_ifhead, pfi_kif);
-
- /* state tables */
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #ifdef _KERNEL
- VNET_DECLARE(struct pf_state_tree, pf_statetbl);
- #define V_pf_statetbl VNET(pf_statetbl)
-@@ -1274,7 +1274,7 @@
- struct pf_addr *dst; /* dst address */
- u_int16_t *sport;
- u_int16_t *dport;
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct pf_mtag *pf_mtag;
- #endif
-
-@@ -1400,7 +1400,7 @@
- *(a) = (x); \
- } while (0)
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #define REASON_SET(a, x) \
- do { \
- if ((a) != NULL) \
-@@ -1485,7 +1485,7 @@
- u_int32_t parent_qid; /* parent queue id */
- u_int32_t bandwidth; /* queue bandwidth */
- u_int8_t priority; /* priority */
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- u_int8_t local_flags; /* dynamic interface */
- #define PFALTQ_FLAG_IF_REMOVED 0x01
- #endif
-@@ -1765,7 +1765,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__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct pf_ifspeed {
- char ifname[IFNAMSIZ];
- u_int32_t baudrate;
-@@ -1776,7 +1776,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__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pf_src_tree, tree_src_tracking);
- #define V_tree_src_tracking VNET(tree_src_tracking)
- #else
-@@ -1786,7 +1786,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__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pf_state_tree_id, tree_id);
- #define V_tree_id VNET(tree_id)
- VNET_DECLARE(struct pf_state_queue, state_list);
-@@ -1797,14 +1797,14 @@
- #endif
-
- TAILQ_HEAD(pf_poolqueue, pf_pool);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pf_poolqueue, pf_pools[2]);
- #define V_pf_pools VNET(pf_pools)
- #else
- extern struct pf_poolqueue pf_pools[2];
- #endif
- TAILQ_HEAD(pf_altqqueue, pf_altq);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pf_altqqueue, pf_altqs[2]);
- #define V_pf_altqs VNET(pf_altqs)
- VNET_DECLARE(struct pf_palist, pf_pabuf);
-@@ -1814,7 +1814,7 @@
- extern struct pf_palist pf_pabuf;
- #endif
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- 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);
-@@ -1846,7 +1846,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__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #ifdef ALTQ
- extern void pf_altq_ifnet_event(struct ifnet *, int);
- #endif
-@@ -1885,7 +1885,7 @@
- extern struct pool pf_state_scrub_pl;
- #endif
- extern void pf_purge_thread(void *);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- extern int pf_purge_expired_src_nodes(int);
- extern int pf_purge_expired_states(u_int32_t , int);
- #else
-@@ -1910,7 +1910,7 @@
- extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
- u_int8_t);
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct ifnet *, sync_ifp);
- #define V_sync_ifp VNET(sync_ifp);
- VNET_DECLARE(struct pf_rule, pf_default_rule);
-@@ -1923,12 +1923,12 @@
- u_int8_t);
- void pf_rm_rule(struct pf_rulequeue *,
- struct pf_rule *);
--#ifndef __FreeBSD__
-+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
- struct pf_divert *pf_find_divert(struct mbuf *);
- #endif
-
- #ifdef INET
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int pf_test(int, struct ifnet *, struct mbuf **, struct ether_header *,
- struct inpcb *);
- #else
-@@ -1937,7 +1937,7 @@
- #endif /* INET */
-
- #ifdef INET6
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int pf_test6(int, struct ifnet *, struct mbuf **, struct ether_header *,
- struct inpcb *);
- #else
-@@ -1948,7 +1948,7 @@
- void pf_addr_inc(struct pf_addr *, sa_family_t);
- #endif /* INET6 */
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- u_int32_t pf_new_isn(struct pf_state *);
- #endif
- void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,
-@@ -1987,7 +1987,7 @@
- int);
- int pf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *,
- int);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int pf_socket_lookup(int, struct pf_pdesc *, struct inpcb *);
- #else
- int pf_socket_lookup(int, struct pf_pdesc *);
-@@ -2032,7 +2032,7 @@
- int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *,
- int *, u_int32_t, int);
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pfi_kif *, pfi_all);
- #define V_pfi_all VNET(pfi_all)
- #else
-@@ -2040,7 +2040,7 @@
- #endif
-
- void pfi_initialize(void);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- void pfi_cleanup(void);
- #endif
- struct pfi_kif *pfi_kif_get(const char *);
-@@ -2062,7 +2062,7 @@
- int pfi_set_flags(const char *, int);
- int pfi_clear_flags(const char *, int);
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int pf_match_tag(struct mbuf *, struct pf_rule *, int *,
- struct pf_mtag *);
- #else
-@@ -2072,7 +2072,7 @@
- void pf_tag2tagname(u_int16_t, char *);
- void pf_tag_ref(u_int16_t);
- void pf_tag_unref(u_int16_t);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int pf_tag_packet(struct mbuf *, int, int, struct pf_mtag *);
- #else
- int pf_tag_packet(struct mbuf *, int, int);
-@@ -2081,14 +2081,14 @@
- void pf_qid2qname(u_int32_t, char *);
- void pf_qid_unref(u_int32_t);
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pf_status, pf_status);
- #define V_pf_status VNET(pf_status)
- #else
- extern struct pf_status pf_status;
- #endif
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- 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);
-@@ -2104,14 +2104,14 @@
- void *pp;
- unsigned limit;
- };
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- VNET_DECLARE(struct pf_pool_limit, pf_pool_limits[PF_LIMIT_MAX]);
- #define V_pf_pool_limits VNET(pf_pool_limits)
- #else
- extern struct pf_pool_limit pf_pool_limits[PF_LIMIT_MAX];
- #endif
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct pf_frent {
- LIST_ENTRY(pf_frent) fr_next;
- struct ip *fr_ip;
-@@ -2145,7 +2145,7 @@
-
- #endif /* _KERNEL */
-
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #ifdef _KERNEL
- VNET_DECLARE(struct pf_anchor_global, pf_anchors);
- #define V_pf_anchors VNET(pf_anchors)
-@@ -2173,7 +2173,7 @@
- struct pf_ruleset *pf_find_or_create_ruleset(const char *);
- void pf_rs_initialize(void);
-
--#ifndef __FreeBSD__
-+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
- #ifdef _KERNEL
- int pf_anchor_copyout(const struct pf_ruleset *,
- const struct pf_rule *, struct pfioc_rule *);
-@@ -2194,7 +2194,7 @@
- const struct tcphdr *);
- void pf_osfp_flush(void);
- int pf_osfp_get(struct pf_osfp_ioctl *);
--#ifdef __FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int pf_osfp_initialize(void);
- void pf_osfp_cleanup(void);
- #else
Modified: trunk/freebsd-utils/debian/patches/series
===================================================================
--- trunk/freebsd-utils/debian/patches/series 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/series 2013-10-02 23:25:49 UTC (rev 4991)
@@ -6,7 +6,6 @@
# Patches that are in good shape for merging upstream
pf_regex_c.diff
-pf_regex_h.diff
pf_regex_followup.diff
mount_cli_compat.diff
ppp_macros.diff
Modified: trunk/freebsd-utils/debian/patches/stablerestart-fhs-compliance.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/stablerestart-fhs-compliance.diff 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/patches/stablerestart-fhs-compliance.diff 2013-10-02 23:25:49 UTC (rev 4991)
@@ -13,9 +13,9 @@
pid_t children[MAXNFSDCNT]; /* PIDs of children */
--- a/usr.sbin/nfsd/nfsv4.4
+++ b/usr.sbin/nfsd/nfsv4.4
-@@ -288,10 +288,10 @@
- .Xr rc.conf 5
- variables.
+@@ -311,10 +311,10 @@
+ If all other nfsd threads are blocked waiting for lock(s) held by this nfsd
+ thread, then there isn't an nfsd thread to service the Close RPC.
.Sh FILES
-.Bl -tag -width /var/db/nfs-stablerestart.bak -compact
-.It Pa /var/db/nfs-stablerestart
Modified: trunk/freebsd-utils/debian/rules
===================================================================
--- trunk/freebsd-utils/debian/rules 2013-10-02 23:22:36 UTC (rev 4990)
+++ trunk/freebsd-utils/debian/rules 2013-10-02 23:25:49 UTC (rev 4991)
@@ -7,7 +7,6 @@
CFLAGS = -Wall -g -pipe -fPIC -D_GNU_SOURCE \
-isystem /usr/include/tirpc \
- -D__FreeBSD_version=__FreeBSD_kernel_version \
-Werror=implicit-function-declaration \
-isystem /usr/include/freebsd -I$(CURDIR)/debian/local/include -I$(CURDIR)/include -lbsd \
$(NULL)
More information about the Glibc-bsd-commits
mailing list