This repo is obsolete, please see git://git.code.sf.net/p/dummynet/code@master
[ipfw.git] / dummynet2 / radix.c
index 7c8c4bf..4bef996 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,
@@ -762,8 +762,10 @@ on2:
                if (m->rm_flags & RNF_NORMAL) {
                        mmask = m->rm_leaf->rn_mask;
                        if (tt->rn_flags & RNF_NORMAL) {
+#if !defined(RADIX_MPATH)
                            log(LOG_ERR,
                                "Non-unique normal route, mask not entered\n");
+#endif
                                return tt;
                        }
                } else
@@ -935,7 +937,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 +1164,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)
 {