Tue Oct 30 19:52:57 2018 UTC ()
Pull up following revision(s) (requested by sborrill in ticket #1646):

	sys/net/npf/npf_ctl.c: revision 1.47 (partial, via patch)

- Increase copyin buffer size to 4M


(martin)
diff -r1.38.2.3 -r1.38.2.4 src/sys/net/npf/npf_ctl.c

cvs diff -r1.38.2.3 -r1.38.2.4 src/sys/net/npf/npf_ctl.c (expand / switch to unified diff)

--- src/sys/net/npf/npf_ctl.c 2015/06/10 16:57:58 1.38.2.3
+++ src/sys/net/npf/npf_ctl.c 2018/10/30 19:52:56 1.38.2.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: npf_ctl.c,v 1.38.2.3 2015/06/10 16:57:58 snj Exp $ */ 1/* $NetBSD: npf_ctl.c,v 1.38.2.4 2018/10/30 19:52:56 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009-2014 The NetBSD Foundation, Inc. 4 * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This material is based upon work partially supported by The 7 * This material is based upon work partially supported by The
8 * NetBSD Foundation under a contract with Mindaugas Rasiukevicius. 8 * NetBSD Foundation under a contract with Mindaugas Rasiukevicius.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * NPF device control. 33 * NPF device control.
34 * 34 *
35 * Implementation of (re)loading, construction of tables and rules. 35 * Implementation of (re)loading, construction of tables and rules.
36 * NPF proplib(9) dictionary consumer. 36 * NPF proplib(9) dictionary consumer.
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.38.2.3 2015/06/10 16:57:58 snj Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.38.2.4 2018/10/30 19:52:56 martin Exp $");
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/conf.h> 43#include <sys/conf.h>
44#include <sys/kmem.h> 44#include <sys/kmem.h>
45#include <net/bpf.h> 45#include <net/bpf.h>
46 46
47#include <prop/proplib.h> 47#include <prop/proplib.h>
48 48
49#include "npf_impl.h" 49#include "npf_impl.h"
50#include "npf_conn.h" 50#include "npf_conn.h"
51 51
52#define NPF_ERR_DEBUG(e) \ 52#define NPF_ERR_DEBUG(e) \
53 prop_dictionary_set_cstring_nocopy((e), "source-file", __FILE__); \ 53 prop_dictionary_set_cstring_nocopy((e), "source-file", __FILE__); \
@@ -502,27 +502,28 @@ npfctl_load(u_long cmd, void *data) @@ -502,27 +502,28 @@ npfctl_load(u_long cmd, void *data)
502 prop_array_t alglist, natlist, tables, rprocs, rules, conlist; 502 prop_array_t alglist, natlist, tables, rprocs, rules, conlist;
503 npf_tableset_t *tblset = NULL; 503 npf_tableset_t *tblset = NULL;
504 npf_rprocset_t *rpset = NULL; 504 npf_rprocset_t *rpset = NULL;
505 npf_ruleset_t *rlset = NULL; 505 npf_ruleset_t *rlset = NULL;
506 npf_ruleset_t *nset = NULL; 506 npf_ruleset_t *nset = NULL;
507 npf_conndb_t *conndb = NULL; 507 npf_conndb_t *conndb = NULL;
508 uint32_t ver = 0; 508 uint32_t ver = 0;
509 size_t nitems; 509 size_t nitems;
510 bool flush; 510 bool flush;
511 int error; 511 int error;
512 512
513 /* Retrieve the dictionary. */ 513 /* Retrieve the dictionary. */
514#ifndef _NPF_TESTING 514#ifndef _NPF_TESTING
515 error = prop_dictionary_copyin_ioctl(pref, cmd, &npf_dict); 515 error = prop_dictionary_copyin_ioctl_size(pref, cmd, &npf_dict,
 516 4 * 1024 * 1024);
516 if (error) 517 if (error)
517 return error; 518 return error;
518#else 519#else
519 npf_dict = (prop_dictionary_t)pref; 520 npf_dict = (prop_dictionary_t)pref;
520#endif 521#endif
521 522
522 /* Dictionary for error reporting and version check. */ 523 /* Dictionary for error reporting and version check. */
523 errdict = prop_dictionary_create(); 524 errdict = prop_dictionary_create();
524 prop_dictionary_get_uint32(npf_dict, "version", &ver); 525 prop_dictionary_get_uint32(npf_dict, "version", &ver);
525 if (ver != NPF_VERSION) { 526 if (ver != NPF_VERSION) {
526 error = EPROGMISMATCH; 527 error = EPROGMISMATCH;
527 goto fail; 528 goto fail;
528 } 529 }