Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src Pull up following revision(s) (requested by rmind in tick...
details: https://anonhg.NetBSD.org/src/rev/709ad1a8ec23
branches: netbsd-7
changeset: 799430:709ad1a8ec23
user: snj <snj%NetBSD.org@localhost>
date: Wed Jun 10 16:57:58 2015 +0000
description:
Pull up following revision(s) (requested by rmind in ticket #835):
sys/net/npf/npf_ctl.c: revision 1.42
usr.sbin/npf/npfctl/npf_bpf_comp.c: revision 1.8
usr.sbin/npf/npfctl/npf_build.c: revision 1.40
- npfctl: fix the confusion in the parser (0/0 case with no other filter).
- Always populate the error dictionary, not only for DEBUG/DIAGNOSTIC.
diffstat:
sys/net/npf/npf_ctl.c | 8 ++------
usr.sbin/npf/npfctl/npf_bpf_comp.c | 8 ++++++--
usr.sbin/npf/npfctl/npf_build.c | 8 ++++++--
3 files changed, 14 insertions(+), 10 deletions(-)
diffs (90 lines):
diff -r 8a0d37cfdab0 -r 709ad1a8ec23 sys/net/npf/npf_ctl.c
--- a/sys/net/npf/npf_ctl.c Wed Jun 10 16:43:51 2015 +0000
+++ b/sys/net/npf/npf_ctl.c Wed Jun 10 16:57:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_ctl.c,v 1.38.2.2 2015/03/21 17:49:03 snj Exp $ */
+/* $NetBSD: npf_ctl.c,v 1.38.2.3 2015/06/10 16:57:58 snj Exp $ */
/*-
* Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.38.2.2 2015/03/21 17:49:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.38.2.3 2015/06/10 16:57:58 snj Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -49,13 +49,9 @@
#include "npf_impl.h"
#include "npf_conn.h"
-#if defined(DEBUG) || defined(DIAGNOSTIC)
#define NPF_ERR_DEBUG(e) \
prop_dictionary_set_cstring_nocopy((e), "source-file", __FILE__); \
prop_dictionary_set_uint32((e), "source-line", __LINE__);
-#else
-#define NPF_ERR_DEBUG(e)
-#endif
/*
* npfctl_switch: enable or disable packet inspection.
diff -r 8a0d37cfdab0 -r 709ad1a8ec23 usr.sbin/npf/npfctl/npf_bpf_comp.c
--- a/usr.sbin/npf/npfctl/npf_bpf_comp.c Wed Jun 10 16:43:51 2015 +0000
+++ b/usr.sbin/npf/npfctl/npf_bpf_comp.c Wed Jun 10 16:57:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_bpf_comp.c,v 1.7 2014/06/29 00:05:24 rmind Exp $ */
+/* $NetBSD: npf_bpf_comp.c,v 1.7.2.1 2015/06/10 16:57:58 snj Exp $ */
/*-
* Copyright (c) 2010-2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: npf_bpf_comp.c,v 1.7 2014/06/29 00:05:24 rmind Exp $");
+__RCSID("$NetBSD: npf_bpf_comp.c,v 1.7.2.1 2015/06/10 16:57:58 snj Exp $");
#include <stdlib.h>
#include <stdbool.h>
@@ -189,6 +189,10 @@
struct bpf_program *bp = &ctx->prog;
const u_int retoff = bp->bf_len;
+ /* No instructions (optimised out). */
+ if (!bp->bf_len)
+ return NULL;
+
/* Add the return fragment (success and failure paths). */
struct bpf_insn insns_ret[] = {
BPF_STMT(BPF_RET+BPF_K, NPF_BPF_SUCCESS),
diff -r 8a0d37cfdab0 -r 709ad1a8ec23 usr.sbin/npf/npfctl/npf_build.c
--- a/usr.sbin/npf/npfctl/npf_build.c Wed Jun 10 16:43:51 2015 +0000
+++ b/usr.sbin/npf/npfctl/npf_build.c Wed Jun 10 16:57:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_build.c,v 1.38.2.1 2015/03/21 17:49:03 snj Exp $ */
+/* $NetBSD: npf_build.c,v 1.38.2.2 2015/06/10 16:57:58 snj Exp $ */
/*-
* Copyright (c) 2011-2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: npf_build.c,v 1.38.2.1 2015/03/21 17:49:03 snj Exp $");
+__RCSID("$NetBSD: npf_build.c,v 1.38.2.2 2015/06/10 16:57:58 snj Exp $");
#include <sys/types.h>
#include <sys/mman.h>
@@ -368,6 +368,10 @@
/* Complete BPF byte-code and pass to the rule. */
struct bpf_program *bf = npfctl_bpf_complete(bc);
+ if (bf == NULL) {
+ npfctl_bpf_destroy(bc);
+ return true;
+ }
len = bf->bf_len * sizeof(struct bpf_insn);
if (npf_rule_setcode(rl, NPF_CODE_BPF, bf->bf_insns, len) == -1) {
Home |
Main Index |
Thread Index |
Old Index