pass "struct pfil_head *" to pfil_add_hook and pfil_remove hook rather

than "struct protosw *".
This commit is contained in:
darrenr 2000-02-20 00:56:33 +00:00
parent f2c5f2ab2c
commit 4b3916780b
7 changed files with 23 additions and 29 deletions

View File

@ -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_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:

View File

@ -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 @@ 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)

View File

@ -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

View File

@ -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,

View File

@ -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);

View File

@ -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),

View File

@ -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);