Sync with the new ipfw3 version.
[ipfw.git] / dummynet2 / radix.c
index 7c8c4bf..47aa0b3 100644 (file)
@@ -54,7 +54,7 @@
 #define log(x, arg...) fprintf(stderr, ## arg)
 #define panic(x)       fprintf(stderr, "PANIC: %s", x), exit(1)
 #define min(a, b) ((a) < (b) ? (a) : (b) )
-#include "include/net/radix.h"
+#include <net/radix.h>
 #endif /* !_KERNEL */
 
 static int     rn_walktree_from(struct radix_node_head *h, void *a, void *m,
@@ -935,7 +935,9 @@ on1:
                                        m = mm;
                                }
                        if (m)
-                               log(LOG_ERR, "rn_delete: Orphaned Mask %p at %p\n", m, x);
+                               log(LOG_ERR,
+                                   "rn_delete: Orphaned Mask %p at %p\n",
+                                   m, x);
                }
        }
        /*
@@ -1160,6 +1162,22 @@ rn_inithead(head, off)
        return (1);
 }
 
+int
+rn_detachhead(void **head)
+{
+       struct radix_node_head *rnh;
+
+       KASSERT((head != NULL && *head != NULL),
+           ("%s: head already freed", __func__));
+       rnh = *head;
+       
+       /* Free <left,root,right> nodes. */
+       Free(rnh);
+
+       *head = NULL;
+       return (1);
+}
+
 void
 rn_init(int maxk)
 {