lib/if.c part from [quagga-dev 552] and lib/inklist.c part from [quagga-dev
555]. Okayed by Paul.
diff --git a/lib/linklist.c b/lib/linklist.c
index 049ab0b..6fc03e1 100644
--- a/lib/linklist.c
+++ b/lib/linklist.c
@@ -87,17 +87,15 @@
   struct listnode *n;
   struct listnode *new;
 
+  new = listnode_new ();
+  new->data = val;
 
   if (list->cmp)
     {
       for (n = list->head; n; n = n->next)
 	{
-	  if ((*list->cmp) (val, n->data) == 0)
-	    return;
-	  if ((*list->cmp) (val, n->data) < 0)
+	  if ((*list->cmp) (val, n->data) <= 0)
 	    {	    
-  	      new = listnode_new ();
-  	      new->data = val;
 	      new->next = n;
 	      new->prev = n->prev;
 
@@ -112,8 +110,6 @@
 	}
     }
 
-  new = listnode_new ();
-  new->data = val;
   new->prev = list->tail;
 
   if (list->tail)