Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/npf npfctl_rule: fixes for the dynamic rules.
details: https://anonhg.NetBSD.org/src/rev/446b89ef7041
branches: trunk
changeset: 790102:446b89ef7041
user: rmind <rmind%NetBSD.org@localhost>
date: Thu Sep 19 00:50:56 2013 +0000
description:
npfctl_rule: fixes for the dynamic rules.
diffstat:
sys/net/npf/npf_ctl.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diffs (56 lines):
diff -r 696e27d2d10a -r 446b89ef7041 sys/net/npf/npf_ctl.c
--- a/sys/net/npf/npf_ctl.c Thu Sep 19 00:48:48 2013 +0000
+++ b/sys/net/npf/npf_ctl.c Thu Sep 19 00:50:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_ctl.c,v 1.26 2013/06/02 02:20:04 rmind Exp $ */
+/* $NetBSD: npf_ctl.c,v 1.27 2013/09/19 00:50:56 rmind Exp $ */
/*-
* Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.26 2013/06/02 02:20:04 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.27 2013/09/19 00:50:56 rmind Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -273,7 +273,7 @@
}
break;
case NPF_CODE_BPF:
- if (!bpf_validate(cptr, clen)) {
+ if (!bpf_validate(cptr, clen / sizeof(struct bpf_insn))) {
return EINVAL;
}
break;
@@ -586,14 +586,16 @@
prop_dictionary_get_uint32(npf_rule, "command", &rcmd);
if (!prop_dictionary_get_cstring_nocopy(npf_rule,
"ruleset-name", &ruleset_name)) {
- return EINVAL;
+ error = EINVAL;
+ goto out;
}
if (rcmd == NPF_CMD_RULE_ADD) {
- if ((rl = npf_rule_alloc(npf_rule)) == NULL) {
- return EINVAL;
+ retdict = prop_dictionary_create();
+ if (npf_mk_singlerule(npf_rule, NULL, &rl, retdict) != 0) {
+ error = EINVAL;
+ goto out;
}
- retdict = prop_dictionary_create();
}
npf_config_enter();
@@ -654,6 +656,7 @@
if (rl) {
npf_rule_free(rl);
}
+out:
if (retdict) {
prop_object_release(npf_rule);
prop_dictionary_copyout_ioctl(pref, cmd, retdict);
Home |
Main Index |
Thread Index |
Old Index