Module Name: src Committed By: christos Date: Wed May 17 18:56:12 UTC 2017
Modified Files: src/sys/net/npf: npf_ctl.c Log Message: Allow npf to be used "normally" from a rump kernel, not just from the test harness (problem reported by Frank Kardel) To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/net/npf/npf_ctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/npf/npf_ctl.c diff -u src/sys/net/npf/npf_ctl.c:1.47 src/sys/net/npf/npf_ctl.c:1.48 --- src/sys/net/npf/npf_ctl.c:1.47 Sat Jan 28 19:15:54 2017 +++ src/sys/net/npf/npf_ctl.c Wed May 17 14:56:12 2017 @@ -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 @@ npf_mk_connlist(npf_t *npf, prop_array_t 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 @@ npfctl_load(npf_t *npf, u_long cmd, void 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();