From 4b3916780b0695f520706e7965cf46f0cf4e2630 Mon Sep 17 00:00:00 2001 From: darrenr Date: Sun, 20 Feb 2000 00:56:33 +0000 Subject: [PATCH] pass "struct pfil_head *" to pfil_add_hook and pfil_remove hook rather than "struct protosw *". --- 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(-) diff --git a/sys/net/pfil.c b/sys/net/pfil.c index 268e30535312..58546a6b02b3 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -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 #include #include -#include #include #include @@ -66,13 +65,12 @@ pfil_init(ph) * 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 @@ pfil_list_add(list, func, flags) * 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 @@ pfil_list_remove(list, func) } 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 --git a/sys/net/pfil.h b/sys/net/pfil.h index 002521be1600..498e09ae0205 100644 --- a/sys/net/pfil.h +++ b/sys/net/pfil.h @@ -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 -struct protosw; struct mbuf; struct ifnet; @@ -61,11 +60,11 @@ struct pfil_head { 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 --git a/sys/netinet/ip_fil.c b/sys/netinet/ip_fil.c index 9426fe69cff4..1affdda70ecd 100644 --- a/sys/netinet/ip_fil.c +++ b/sys/netinet/ip_fil.c @@ -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 @@ int iplattach() # 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 @@ int ipldetach() # 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 --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index a75b8bf31456..a70a4dcf458e 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -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 @@ ip_input(struct mbuf *m) * 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 --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 73013fb0a693..bc9187b03f56 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -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 @@ sendit: * 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 --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 12f6e7c8fca3..e7e427481843 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -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 @@ ip6_input(m) * 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 --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index e77ff8099dc0..c2fb78316065 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -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 @@ skip_ipsec2:; * 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);