Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add a PFIL_HOOKS filtering point to every network in...



details:   https://anonhg.NetBSD.org/src/rev/f9e18fbfc1d8
branches:  trunk
changeset: 508388:f9e18fbfc1d8
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Apr 10 21:45:39 2001 +0000

description:
Add a PFIL_HOOKS filtering point to every network interface.

diffstat:

 sys/net/if.c |  15 ++++++++++++++-
 sys/net/if.h |   4 +++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diffs (68 lines):

diff -r 80c771f8e8a5 -r f9e18fbfc1d8 sys/net/if.c
--- a/sys/net/if.c      Tue Apr 10 21:33:00 2001 +0000
+++ b/sys/net/if.c      Tue Apr 10 21:45:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.86 2001/03/03 03:29:20 thorpej Exp $  */
+/*     $NetBSD: if.c,v 1.87 2001/04/10 21:45:39 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -106,6 +106,7 @@
 #include "opt_compat_svr4.h"
 #include "opt_compat_43.h"
 #include "opt_atalk.h"
+#include "opt_pfil_hooks.h"
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -408,6 +409,14 @@
        ifp->if_snd.altq_ifp  = ifp;
 #endif
 
+#ifdef PFIL_HOOKS
+       ifp->if_pfil.ph_type = PFIL_TYPE_IFNET;
+       ifp->if_pfil.ph_ifnet = ifp;
+       if (pfil_head_register(&ifp->if_pfil) != 0)
+               printf("%s: WARNING: unable to register pfil hook\n",
+                   ifp->if_xname);
+#endif
+
        /* Announce the interface. */
        rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
 }
@@ -480,6 +489,10 @@
                altq_detach(&ifp->if_snd);
 #endif
 
+#ifdef PFIL_HOOKS
+       (void) pfil_head_unregister(&ifp->if_pfil);
+#endif
+
        if_free_sadl(ifp);
 
        /*
diff -r 80c771f8e8a5 -r f9e18fbfc1d8 sys/net/if.h
--- a/sys/net/if.h      Tue Apr 10 21:33:00 2001 +0000
+++ b/sys/net/if.h      Tue Apr 10 21:45:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.66 2001/04/07 04:24:31 thorpej Exp $  */
+/*     $NetBSD: if.h,v 1.67 2001/04/10 21:45:39 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -78,6 +78,7 @@
 
 #include <sys/queue.h>
 #include <net/dlt.h>
+#include <net/pfil.h>
 
 /*
  * Always include ALTQ glue here -- we use the ALTQ interface queue
@@ -275,6 +276,7 @@
        struct ifprefix *if_prefixlist; /* linked list of prefixes per if */
        void    *if_bridge;             /* bridge glue */
        int     if_dlt;                 /* data link type (<net/dlt.h>) */
+       struct pfil_head if_pfil;       /* filterint point */
 };
 #define        if_mtu          if_data.ifi_mtu
 #define        if_type         if_data.ifi_type



Home | Main Index | Thread Index | Old Index