Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net * pfil_add_hook() no longer treats PFIL_IFADDR and P...
details: https://anonhg.NetBSD.org/src/rev/0083c217961d
branches: trunk
changeset: 350478:0083c217961d
user: ryo <ryo%NetBSD.org@localhost>
date: Thu Jan 12 17:19:17 2017 +0000
description:
* pfil_add_hook() no longer treats PFIL_IFADDR and PFIL_IFNET. delete them from pfil_flag_cases[].
* add/fix KASSERT
* fix comment
diffstat:
sys/net/pfil.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diffs (69 lines):
diff -r 7dad28460908 -r 0083c217961d sys/net/pfil.c
--- a/sys/net/pfil.c Thu Jan 12 17:14:23 2017 +0000
+++ b/sys/net/pfil.c Thu Jan 12 17:19:17 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pfil.c,v 1.30 2017/01/04 13:03:41 ryo Exp $ */
+/* $NetBSD: pfil.c,v 1.31 2017/01/12 17:19:17 ryo Exp $ */
/*
* Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.30 2017/01/04 13:03:41 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.31 2017/01/12 17:19:17 ryo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,7 +67,7 @@
};
static const int pfil_flag_cases[] = {
- PFIL_IN, PFIL_OUT, PFIL_IFADDR, PFIL_IFNET
+ PFIL_IN, PFIL_OUT
};
static LIST_HEAD(, pfil_head) pfil_head_list __read_mostly =
@@ -208,18 +208,20 @@
}
/*
- * pfil_add_hook: add an interface-event function (hook) to the packet
+ * pfil_add_ihook: add an interface-event function (hook) to the packet
* filter head. The possible flags are:
*
- * PFIL_IFADDR call on interface reconfig (mbuf is ioctl #)
- * PFIL_IFNET call on interface attach/detach (mbuf is PFIL_IFNET_*)
+ * PFIL_IFADDR call on interface reconfig (cmd is ioctl #)
+ * PFIL_IFNET call on interface attach/detach (cmd is PFIL_IFNET_*)
*/
int
pfil_add_ihook(pfil_ifunc_t func, void *arg, int flags, pfil_head_t *ph)
{
pfil_list_t *phlist;
+ KASSERT(func != NULL);
KASSERT(flags == PFIL_IFADDR || flags == PFIL_IFNET);
+
phlist = pfil_hook_get(flags, ph);
return pfil_list_add(phlist, (pfil_polyfunc_t)func, arg, flags);
}
@@ -253,6 +255,8 @@
int
pfil_remove_hook(pfil_func_t func, void *arg, int flags, pfil_head_t *ph)
{
+ KASSERT((flags & ~PFIL_ALL) == 0);
+
for (u_int i = 0; i < __arraycount(pfil_flag_cases); i++) {
const int fcase = pfil_flag_cases[i];
pfil_list_t *pflist;
@@ -287,7 +291,7 @@
pfil_list_t *phlist;
int ret = 0;
- KASSERT((dir & ~PFIL_ALL) == 0);
+ KASSERT(dir == PFIL_IN || dir == PFIL_OUT);
if (__predict_false((phlist = pfil_hook_get(dir, ph)) == NULL)) {
return ret;
}
Home |
Main Index |
Thread Index |
Old Index