]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Change the mechanism for comparing route ID's.
authorKen Williams <kenneth.j.williams@intel.com>
Tue, 15 Apr 2014 02:23:11 +0000 (02:23 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 22 Apr 2014 19:17:26 +0000 (21:17 +0200)
The current format uses subtraction of two ints. Unfortunately, the
subtraction method does not work for all combinations of numbers.
For example, the with numbers represented by 10.x.x.x and 192.x.x.x,
10.x.x.x - 192.x.x.x will yield a very large positive number indicating
that 10.x.x.x is larger.

Signed-off-by: Ken Williams <kenneth.j.williams@intel.com>
Acked-by: Feng Lu <lu.feng@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra/router-id.c

index 3d6b511c53c223fc349c489d00b9c794b9f7b2b0..b738027ec4cc4810c241472dbb3d88bb9c977a76 100644 (file)
@@ -230,10 +230,8 @@ router_id_cmp (void *a, void *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);
 
-  return (int) (A - B);
+  return IPV4_ADDR_CMP(&ifa->address->u.prefix4.s_addr,&ifb->address->u.prefix4.s_addr);
 }
 
 void