Back out the sledgehammer damage applied by wiz while I was out for

the holiday.
This commit is contained in:
thorpej 2000-12-28 21:40:59 +00:00
parent 0dae1b3d9a
commit ad5b855ef0
5 changed files with 32 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfil.c,v 1.18 2000/12/25 02:00:46 wiz Exp $ */
/* $NetBSD: pfil.c,v 1.19 2000/12/28 21:40:59 thorpej Exp $ */
/*
* Copyright (c) 1996 Matthew R. Green
@ -84,8 +84,8 @@ pfil_head_register(struct pfil_head *ph)
for (lph = LIST_FIRST(&pfil_head_list); lph != NULL;
lph = LIST_NEXT(lph, ph_list)) {
if (lph->ph_key == ph->ph_key &&
lph->ph_dlt == ph->ph_dlt)
if (ph->ph_type == lph->ph_type &&
ph->ph_un.phu_val == lph->ph_un.phu_val)
return EEXIST;
}
@ -113,13 +113,14 @@ pfil_head_unregister(struct pfil_head *pfh)
* pfil_head_get() returns the pfil_head for a given key/dlt.
*/
struct pfil_head *
pfil_head_get(void *key, int dlt)
pfil_head_get(int type, u_long val)
{
struct pfil_head *ph;
for (ph = LIST_FIRST(&pfil_head_list); ph != NULL;
ph = LIST_NEXT(ph, ph_list)) {
if (ph->ph_key == key && ph->ph_dlt == dlt)
if (ph->ph_type == type &&
ph->ph_un.phu_val == val)
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfil.h,v 1.17 2000/12/25 02:00:47 wiz Exp $ */
/* $NetBSD: pfil.h,v 1.18 2000/12/28 21:40:59 thorpej Exp $ */
/*
* Copyright (c) 1996 Matthew R. Green
@ -55,11 +55,19 @@ struct packet_filter_hook {
typedef TAILQ_HEAD(pfil_list, packet_filter_hook) pfil_list_t;
#define PFIL_TYPE_AF 1 /* key is AF_* type */
#define PFIL_TYPE_IFNET 2 /* key is ifnet pointer */
struct pfil_head {
pfil_list_t ph_in;
pfil_list_t ph_out;
void *ph_key;
int ph_dlt;
int ph_type;
union {
u_long phu_val;
void *phu_ptr;
} ph_un;
#define ph_af ph_un.phu_val
#define ph_ifnet ph_un.phu_ptr
LIST_ENTRY(pfil_head) ph_list;
};
typedef struct pfil_head pfil_head_t;
@ -75,7 +83,7 @@ int pfil_remove_hook(int (*func)(void *, struct mbuf **,
int pfil_head_register(struct pfil_head *);
int pfil_head_unregister(struct pfil_head *);
struct pfil_head *pfil_head_get(void *, int);
struct pfil_head *pfil_head_get(int, u_long);
static __inline struct packet_filter_hook *
pfil_hook_get(int dir, struct pfil_head *ph)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_fil.c,v 1.62 2000/12/25 02:00:47 wiz Exp $ */
/* $NetBSD: ip_fil.c,v 1.63 2000/12/28 21:40:59 thorpej Exp $ */
/*
* Copyright (C) 1993-2000 by Darren Reed.
@ -9,7 +9,7 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.62 2000/12/25 02:00:47 wiz Exp $";
static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.63 2000/12/28 21:40:59 thorpej Exp $";
#else
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.42.2.15 2000/08/05 14:49:08 darrenr Exp";
@ -270,10 +270,10 @@ int iplattach()
return EIO;
# ifdef NETBSD_PF
# if __NetBSD_Version__ >= 105110000
ph_inet = pfil_head_get((void *)(u_long) AF_INET, DLT_RAW);
# if __NetBSD_Version__ >= 105150000
ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
#ifdef USE_INET6
ph_inet6 = pfil_head_get((void *)(u_long) AF_INET6, DLT_RAW);
ph_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET);
#endif
if (ph_inet == NULL
#ifdef USE_INET6
@ -393,12 +393,10 @@ int ipldetach()
{
int s, i = FR_INQUE|FR_OUTQUE;
#if defined(NETBSD_PF) && (__NetBSD_Version__ >= 104200000)
# if __NetBSD_Version__ >= 105110000
struct pfil_head *ph_inet = pfil_head_get((void *)(u_long) AF_INET,
DLT_RAW);
# if __NetBSD_Version__ >= 105150000
struct pfil_head *ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
#ifdef USE_INET6
struct pfil_head *ph_inet6 = pfil_head_get((void *)(u_long) AF_INET6,
DLT_RAW);
struct pfil_head *ph_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
#endif
# endif
int error = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.125 2000/12/25 02:00:47 wiz Exp $ */
/* $NetBSD: ip_input.c,v 1.126 2000/12/28 21:40:59 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -319,8 +319,8 @@ ip_init()
#ifdef PFIL_HOOKS
/* Register our Packet Filter hook. */
inet_pfil_hook.ph_key = (void *)(u_long) AF_INET;
inet_pfil_hook.ph_dlt = DLT_RAW;
inet_pfil_hook.ph_type = PFIL_TYPE_AF;
inet_pfil_hook.ph_af = AF_INET;
i = pfil_head_register(&inet_pfil_hook);
if (i != 0)
printf("ip_init: WARNING: unable to register pfil hook, "

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_input.c,v 1.32 2000/12/25 02:00:48 wiz Exp $ */
/* $NetBSD: ip6_input.c,v 1.33 2000/12/28 21:41:00 thorpej Exp $ */
/* $KAME: ip6_input.c,v 1.121 2000/08/31 06:07:29 itojun Exp $ */
/*
@ -188,8 +188,8 @@ ip6_init()
#ifdef PFIL_HOOKS
/* Register our Packet Filter hook. */
inet6_pfil_hook.ph_key = (void *)(u_long) AF_INET6;
inet6_pfil_hook.ph_dlt = DLT_RAW;
inet6_pfil_hook.ph_type = PFIL_TYPE_AF;
inet6_pfil_hook.ph_af = AF_INET6;
i = pfil_head_register(&inet6_pfil_hook);
if (i != 0)
printf("ip6_init: WARNING: unable to register pfil hook, "