Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net/npf Allow npf to be used "normally" from a rump kern...



details:   https://anonhg.NetBSD.org/src/rev/b67ed632b847
branches:  trunk
changeset: 823986:b67ed632b847
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 17 18:56:12 2017 +0000

description:
Allow npf to be used "normally" from a rump kernel, not just from the
test harness (problem reported by Frank Kardel)

diffstat:

 sys/net/npf/npf_ctl.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (54 lines):

diff -r ec514ba12b67 -r b67ed632b847 sys/net/npf/npf_ctl.c
--- a/sys/net/npf/npf_ctl.c     Wed May 17 18:55:13 2017 +0000
+++ b/sys/net/npf/npf_ctl.c     Wed May 17 18:56:12 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_ctl.c,v 1.47 2017/01/29 00:15:54 christos Exp $    */
+/*     $NetBSD: npf_ctl.c,v 1.48 2017/05/17 18:56:12 christos Exp $    */
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.47 2017/01/29 00:15:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.48 2017/05/17 18:56:12 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -491,6 +491,10 @@
        return error;
 }
 
+#if defined(_NPF_TESTING) || defined(_NPF_STANDALONE)
+int npfctl_testing;
+#endif
+
 /*
  * npfctl_load: store passed data i.e. update settings, create passed
  * tables, rules and atomically activate all them.
@@ -512,14 +516,17 @@
        int error;
 
        /* Retrieve the dictionary. */
-#if !defined(_NPF_TESTING) && !defined(_NPF_STANDALONE)
-       error = prop_dictionary_copyin_ioctl_size(pref, cmd, &npf_dict,
-           4 * 1024 * 1024);
-       if (error)
-               return error;
-#else
-       npf_dict = (prop_dictionary_t)pref;
+#if defined(_NPF_TESTING) || defined(_NPF_STANDALONE)
+       if (npfctl_testing)
+               npf_dict = (prop_dictionary_t)pref;
+       else
 #endif
+       {
+               error = prop_dictionary_copyin_ioctl_size(pref, cmd, &npf_dict,
+                   4 * 1024 * 1024);
+               if (error)
+                   return error;
+       }
 
        /* Dictionary for error reporting and version check. */
        errdict = prop_dictionary_create();



Home | Main Index | Thread Index | Old Index