Source-Changes-HG archive

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

[src/trunk]: src/sys/net For pfil_add_hook(..., PFIL_ALL, ...), if we fail to...



details:   https://anonhg.NetBSD.org/src/rev/e6bbfada7a90
branches:  trunk
changeset: 482841:e6bbfada7a90
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Wed Feb 23 02:35:42 2000 +0000

description:
For pfil_add_hook(..., PFIL_ALL, ...), if we fail to add the output filter,
make sure to remove the input filter.

diffstat:

 sys/net/pfil.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r c49d0b82a245 -r e6bbfada7a90 sys/net/pfil.c
--- a/sys/net/pfil.c    Wed Feb 23 02:11:05 2000 +0000
+++ b/sys/net/pfil.c    Wed Feb 23 02:35:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.14 2000/02/22 11:30:22 darrenr Exp $        */
+/*     $NetBSD: pfil.c,v 1.15 2000/02/23 02:35:42 mycroft Exp $        */
 
 /*
  * Copyright (c) 1996 Matthew R. Green
@@ -78,9 +78,16 @@
 
        if (flags & PFIL_IN)
                err = pfil_list_add(&ph->ph_in, func, flags & ~PFIL_OUT);
-       if ((err == 0) && (flags & PFIL_OUT))
+       if (err)
+               return err;
+       if (flags & PFIL_OUT)
                err = pfil_list_add(&ph->ph_out, func, flags & ~PFIL_IN);
-       return err;
+       if (err) {
+               if (flags & PFIL_IN)
+                       pfil_list_remove(&ph->ph_in, func);
+               return err;
+       }
+       return 0;
 }
 
 static int



Home | Main Index | Thread Index | Old Index