]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/router-id.c
lib: put route_types.txt to real use
[mirror_frr.git] / zebra / router-id.c
index 41bab5456bc37e1d6253f897abc6a8c05f66b5b4..3d6b511c53c223fc349c489d00b9c794b9f7b2b0 100644 (file)
@@ -136,7 +136,7 @@ router_id_add_address (struct connected *ifc)
     l = &rid_all_sorted_list;
   
   if (!router_id_find_node (l, ifc))
-    listnode_add (l, ifc);
+    listnode_add_sort (l, ifc);
 
   router_id_get (&after);
 
@@ -228,16 +228,12 @@ DEFUN (no_router_id,
 static int
 router_id_cmp (void *a, void *b)
 {
-  unsigned int A, B;
+  const struct connected *ifa = (const struct connected *)a;
+  const struct connected *ifb = (const struct connected *)b;
+  unsigned int A = ntohl(ifa->address->u.prefix4.s_addr);
+  unsigned int B = ntohl(ifb->address->u.prefix4.s_addr);
 
-  A = ((struct connected *) a)->address->u.prefix4.s_addr;
-  B = ((struct connected *) b)->address->u.prefix4.s_addr;
-
-  if (A > B)
-    return 1;
-  else if (A < B)
-    return -1;
-  return 0;
+  return (int) (A - B);
 }
 
 void