Source-Changes-HG archive

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

[src/trunk]: src/sys/net pass a pointer to the list, rather than passing a co...



details:   https://anonhg.NetBSD.org/src/rev/d7993800ae02
branches:  trunk
changeset: 477078:d7993800ae02
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Oct 10 09:07:32 1999 +0000

description:
pass a pointer to the list, rather than passing a copy of it, when removing
functions from the pfil hook lists.  this fixes the "missing function" problem.
also, re-add support for WAITOK that was lost several deltas ago.

diffstat:

 sys/net/pfil.c |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (63 lines):

diff -r c49dd1c93e44 -r d7993800ae02 sys/net/pfil.c
--- a/sys/net/pfil.c    Sun Oct 10 02:44:55 1999 +0000
+++ b/sys/net/pfil.c    Sun Oct 10 09:07:32 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.8 1999/06/18 05:59:20 mrg Exp $     */
+/*     $NetBSD: pfil.c,v 1.9 1999/10/10 09:07:32 mrg Exp $     */
 
 /*
  * Copyright (c) 1996 Matthew R. Green
@@ -48,7 +48,7 @@
 static void pfil_init __P((void));
 static void pfil_list_add(pfil_list_t *,
     int (*) __P((void *, int, struct ifnet *, int, struct mbuf **)), int);
-static void pfil_list_remove(pfil_list_t,
+static void pfil_list_remove(pfil_list_t *,
     int (*) __P((void *, int, struct ifnet *, int, struct mbuf **)));
 
 static void
@@ -79,9 +79,11 @@
                pfil_init();
 
        if (flags & PFIL_IN)
-               pfil_list_add(&pfil_in_list, func, PFIL_IN);
+               pfil_list_add(&pfil_in_list, func, PFIL_IN |
+                   (flags & PFIL_WAITOK));
        if (flags & PFIL_OUT)
-               pfil_list_add(&pfil_out_list, func, PFIL_OUT);
+               pfil_list_add(&pfil_out_list, func, PFIL_OUT |
+                   (flags & PFIL_WAITOK));
 }
 
 static void
@@ -124,9 +126,9 @@
                pfil_init();
 
        if (flags & PFIL_IN)
-               pfil_list_remove(pfil_in_list, func);
+               pfil_list_remove(&pfil_in_list, func);
        if (flags & PFIL_OUT)
-               pfil_list_remove(pfil_out_list, func);
+               pfil_list_remove(&pfil_out_list, func);
 }
 
 /*
@@ -135,15 +137,15 @@
  */
 static void
 pfil_list_remove(list, func)
-       pfil_list_t list;
+       pfil_list_t *list;
        int     (*func) __P((void *, int, struct ifnet *, int,
                             struct mbuf **));
 {
        struct packet_filter_hook *pfh;
 
-       for (pfh = list.tqh_first; pfh; pfh = pfh->pfil_link.tqe_next)
+       for (pfh = list->tqh_first; pfh; pfh = pfh->pfil_link.tqe_next)
                if (pfh->pfil_func == func) {
-                       TAILQ_REMOVE(&list, pfh, pfil_link);
+                       TAILQ_REMOVE(list, pfh, pfil_link);
                        free(pfh, M_IFADDR);
                        return;
                }



Home | Main Index | Thread Index | Old Index