Source-Changes-HG archive

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

[src/trunk]: src/sys/net/npf Convert NPF to the latest pfil(9) changes.



details:   https://anonhg.NetBSD.org/src/rev/2e8ae2a75015
branches:  trunk
changeset: 820020:2e8ae2a75015
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Dec 26 23:59:47 2016 +0000

description:
Convert NPF to the latest pfil(9) changes.

diffstat:

 sys/net/npf/npf_os.c |  33 ++++++++++++++-------------------
 1 files changed, 14 insertions(+), 19 deletions(-)

diffs (72 lines):

diff -r 864b4bf93595 -r 2e8ae2a75015 sys/net/npf/npf_os.c
--- a/sys/net/npf/npf_os.c      Mon Dec 26 23:49:53 2016 +0000
+++ b/sys/net/npf/npf_os.c      Mon Dec 26 23:59:47 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_os.c,v 1.1 2016/12/26 23:05:06 christos Exp $      */
+/*     $NetBSD: npf_os.c,v 1.2 2016/12/26 23:59:47 rmind Exp $ */
 
 /*-
  * Copyright (c) 2009-2016 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.1 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.2 2016/12/26 23:59:47 rmind Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pf.h"
@@ -345,23 +345,20 @@
 /*
  * npf_ifhook: hook handling interface changes.
  */
-static int
-npf_ifhook(void *arg, struct mbuf **mp, ifnet_t *ifp, int di)
+static void
+npf_ifhook(void *arg, unsigned long cmd, void *arg2)
 {
        npf_t *npf = npf_getkernctx();
-       u_long cmd = (u_long)mp;
+       ifnet_t *ifp = arg2;
 
-       if (di == PFIL_IFNET) {
-               switch (cmd) {
-               case PFIL_IFNET_ATTACH:
-                       npf_ifmap_attach(npf, ifp);
-                       break;
-               case PFIL_IFNET_DETACH:
-                       npf_ifmap_detach(npf, ifp);
-                       break;
-               }
+       switch (cmd) {
+       case PFIL_IFNET_ATTACH:
+               npf_ifmap_attach(npf, ifp);
+               break;
+       case PFIL_IFNET_DETACH:
+               npf_ifmap_detach(npf, ifp);
+               break;
        }
-       return 0;
 }
 
 /*
@@ -383,8 +380,7 @@
                        error = ENOENT;
                        goto out;
                }
-               error = pfil_add_hook(npf_ifhook, NULL,
-                   PFIL_IFADDR | PFIL_IFNET, npf_ph_if);
+               error = pfil_add_ihook(npf_ifhook, NULL, PFIL_IFNET, npf_ph_if);
                KASSERT(error == 0);
        }
        if (init) {
@@ -436,8 +432,7 @@
        KERNEL_LOCK(1, NULL);
 
        if (fini && npf_ph_if) {
-               (void)pfil_remove_hook(npf_ifhook, NULL,
-                   PFIL_IFADDR | PFIL_IFNET, npf_ph_if);
+               (void)pfil_remove_ihook(npf_ifhook, NULL, PFIL_IFNET, npf_ph_if);
        }
        if (npf_ph_inet) {
                (void)pfil_remove_hook(npfkern_packet_handler, npf,



Home | Main Index | Thread Index | Old Index