Source-Changes-HG archive

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

[src/netbsd-6-1]: src/sys/net/npf Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/c65a000f1b84
branches:  netbsd-6-1
changeset: 775856:c65a000f1b84
user:      riz <riz%NetBSD.org@localhost>
date:      Sun Sep 22 17:27:45 2013 +0000

description:
Pull up following revision(s) (requested by rmind in ticket #952):
        sys/net/npf/npf_ctl.c: revision 1.27
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 edd9a7b6d2fa -r c65a000f1b84 sys/net/npf/npf_ctl.c
--- a/sys/net/npf/npf_ctl.c     Sun Sep 22 05:15:57 2013 +0000
+++ b/sys/net/npf/npf_ctl.c     Sun Sep 22 17:27:45 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_ctl.c,v 1.12.2.9 2013/02/18 18:26:14 riz Exp $     */
+/*     $NetBSD: npf_ctl.c,v 1.12.2.9.2.1 2013/09/22 17:27:45 riz 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.12.2.9 2013/02/18 18:26:14 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.12.2.9.2.1 2013/09/22 17:27:45 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -244,7 +244,7 @@
                }
                break;
        case NPF_CODE_BPF:
-               if (!bpf_validate(cptr, clen)) {
+               if (!bpf_validate(cptr, clen / sizeof(struct bpf_insn))) {
                        return EINVAL;
                }
                break;
@@ -550,14 +550,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();
@@ -618,6 +620,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