Source-Changes-HG archive

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

[src/trunk]: src/sys pass "struct pfil_head *" to pfil_add_hook and pfil_remo...



details:   https://anonhg.NetBSD.org/src/rev/03e51f56209f
branches:  trunk
changeset: 482707:03e51f56209f
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Sun Feb 20 00:56:33 2000 +0000

description:
pass "struct pfil_head *" to pfil_add_hook and pfil_remove hook rather
than "struct protosw *".

diffstat:

 sys/net/pfil.c            |  19 +++++++------------
 sys/net/pfil.h            |   9 ++++-----
 sys/netinet/ip_fil.c      |   8 ++++----
 sys/netinet/ip_input.c    |   4 ++--
 sys/netinet/ip_output.c   |   4 ++--
 sys/netinet6/ip6_input.c  |   4 ++--
 sys/netinet6/ip6_output.c |   4 ++--
 7 files changed, 23 insertions(+), 29 deletions(-)

diffs (204 lines):

diff -r a7d28a783ba4 -r 03e51f56209f sys/net/pfil.c
--- a/sys/net/pfil.c    Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/net/pfil.c    Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.10 2000/02/17 10:59:32 darrenr Exp $        */
+/*     $NetBSD: pfil.c,v 1.11 2000/02/20 00:56:33 darrenr Exp $        */
 
 /*
  * Copyright (c) 1996 Matthew R. Green
@@ -35,7 +35,6 @@
 #include <sys/socketvar.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
-#include <sys/protosw.h>
 #include <sys/queue.h>
 
 #include <net/if.h>
@@ -66,13 +65,12 @@
  *     PFIL_WAITOK     OK to call malloc with M_WAITOK.
  */
 void
-pfil_add_hook(func, flags, psw)
+pfil_add_hook(func, flags, ph)
        int     (*func) __P((void *, int, struct ifnet *, int,
                             struct mbuf **));
        int     flags;
-       struct  protosw *psw;
+       struct  pfil_head       *ph;
 {
-       struct  pfil_head       *ph = &psw->pr_pfh;
 
        if (ph->ph_init == 0)
                pfil_init(ph);
@@ -109,13 +107,12 @@
  * hook list.
  */
 void
-pfil_remove_hook(func, flags, psw)
+pfil_remove_hook(func, flags, ph)
        int     (*func) __P((void *, int, struct ifnet *, int,
                             struct mbuf **));
        int     flags;
-       struct  protosw *psw;
+       struct  pfil_head       *ph;
 {
-       struct  pfil_head       *ph = &psw->pr_pfh;
 
        if (ph->ph_init == 0)
                pfil_init(ph);
@@ -151,12 +148,10 @@
 }
 
 struct packet_filter_hook *
-pfil_hook_get(flag, psw)
+pfil_hook_get(flag, ph)
        int flag;
-       struct protosw *psw;
+       struct  pfil_head       *ph;
 {
-       struct  pfil_head       *ph = &psw->pr_pfh;     
-
        if (ph->ph_init != 0)
                switch (flag) {
                case PFIL_IN:
diff -r a7d28a783ba4 -r 03e51f56209f sys/net/pfil.h
--- a/sys/net/pfil.h    Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/net/pfil.h    Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.h,v 1.10 2000/02/17 10:59:32 darrenr Exp $        */
+/*     $NetBSD: pfil.h,v 1.11 2000/02/20 00:56:33 darrenr Exp $        */
 
 /*
  * Copyright (c) 1996 Matthew R. Green
@@ -33,7 +33,6 @@
 
 #include <sys/queue.h>
 
-struct protosw;
 struct mbuf;
 struct ifnet;
 
@@ -61,11 +60,11 @@
        int             ph_init;
 } pfil_head_t;
 
-struct packet_filter_hook *pfil_hook_get __P((int, struct protosw *));
+struct packet_filter_hook *pfil_hook_get __P((int, struct pfil_head *));
 void   pfil_add_hook __P((int (*func) __P((void *, int,
-           struct ifnet *, int, struct mbuf **)), int, struct protosw *));
+           struct ifnet *, int, struct mbuf **)), int, struct pfil_head *));
 void   pfil_remove_hook __P((int (*func) __P((void *, int,
-           struct ifnet *, int, struct mbuf **)), int, struct protosw *));
+           struct ifnet *, int, struct mbuf **)), int, struct pfil_head *));
 
 /* XXX */
 #if defined(_KERNEL) && !defined(_LKM)
diff -r a7d28a783ba4 -r 03e51f56209f sys/netinet/ip_fil.c
--- a/sys/netinet/ip_fil.c      Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/netinet/ip_fil.c      Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_fil.c,v 1.41 2000/02/17 10:59:35 darrenr Exp $      */
+/*     $NetBSD: ip_fil.c,v 1.42 2000/02/20 00:56:39 darrenr Exp $      */
 
 /*
  * Copyright (C) 1993-1998 by Darren Reed.
@@ -9,7 +9,7 @@
  */
 #if !defined(lint)
 #if defined(__NetBSD__)
-static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.41 2000/02/17 10:59:35 darrenr Exp $";
+static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.42 2000/02/20 00:56:39 darrenr Exp $";
 #else
 static const char sccsid[] = "@(#)ip_fil.c     2.41 6/5/96 (C) 1993-1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.4.2.16 2000/01/16 10:12:42 darrenr Exp";
@@ -264,7 +264,7 @@
 
 # ifdef NETBSD_PF
        pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
-                     &inetsw[ip_protox[IPPROTO_IP]]);
+                     &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
 # endif
 
 # ifdef __sgi
@@ -343,7 +343,7 @@
 
 # ifdef NETBSD_PF
        pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT,
-                        &inetsw[ip_protox[IPPROTO_IP]]);
+                        &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
 # endif
 
 # ifdef __sgi
diff -r a7d28a783ba4 -r 03e51f56209f sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/netinet/ip_input.c    Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_input.c,v 1.101 2000/02/17 10:59:35 darrenr Exp $   */
+/*     $NetBSD: ip_input.c,v 1.102 2000/02/20 00:56:39 darrenr Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -464,7 +464,7 @@
         * in the list may have previously cleared it.
         */
        m0 = m;
-       pfh = pfil_hook_get(PFIL_IN, &inetsw[ip_protox[IPPROTO_IP]]);
+       pfh = pfil_hook_get(PFIL_IN, &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
        for (; pfh; pfh = pfh->pfil_link.tqe_next)
                if (pfh->pfil_func) {
                        rv = pfh->pfil_func(ip, hlen,
diff -r a7d28a783ba4 -r 03e51f56209f sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/netinet/ip_output.c   Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.67 2000/02/17 10:59:35 darrenr Exp $   */
+/*     $NetBSD: ip_output.c,v 1.68 2000/02/20 00:56:40 darrenr Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -417,7 +417,7 @@
         * Run through list of hooks for output packets.
         */
        m1 = m;
-       pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IP]]);
+       pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
        for (; pfh; pfh = pfh->pfil_link.tqe_next)
                if (pfh->pfil_func) {
                        rv = pfh->pfil_func(ip, hlen, ifp, 1, &m1);
diff -r a7d28a783ba4 -r 03e51f56209f sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c  Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/netinet6/ip6_input.c  Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_input.c,v 1.15 2000/02/17 10:59:39 darrenr Exp $   */
+/*     $NetBSD: ip6_input.c,v 1.16 2000/02/20 00:56:43 darrenr Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -314,7 +314,7 @@
         * in the list may have previously cleared it.
         */
        m0 = m;
-       pfh = pfil_hook_get(PFIL_IN, &inetsw[ip_protox[IPPROTO_IPV6]]);
+       pfh = pfil_hook_get(PFIL_IN, &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh);
        for (; pfh; pfh = pfh->pfil_link.tqe_next)
                if (pfh->pfil_func) {
                        rv = pfh->pfil_func(ip6, sizeof(*ip6),
diff -r a7d28a783ba4 -r 03e51f56209f sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Sun Feb 20 00:23:10 2000 +0000
+++ b/sys/netinet6/ip6_output.c Sun Feb 20 00:56:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_output.c,v 1.15 2000/02/17 10:59:39 darrenr Exp $  */
+/*     $NetBSD: ip6_output.c,v 1.16 2000/02/20 00:56:43 darrenr Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -801,7 +801,7 @@
         * Run through list of hooks for output packets.
         */
        m1 = m;
-       pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IPV6]]);
+       pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh);
        for (; pfh; pfh = pfh->pfil_link.tqe_next)
                if (pfh->pfil_func) {
                        rv = pfh->pfil_func(ip6, sizeof(*ip6), ifp, 1, &m1);



Home | Main Index | Thread Index | Old Index