diff options
author | Ken Williams <kenneth.j.williams@intel.com> | 2014-04-15 02:23:11 +0000 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2014-04-22 21:17:26 +0200 |
commit | 24c84dbe806084552d7bb14b9f1d00514a048b9d (patch) | |
tree | cb53212866638b8aa559e573aa320f027d7ed8b7 /zebra/router-id.c | |
parent | 4becea724ccd87e88f8454622ae227308b5fa3ce (diff) | |
download | quagga-24c84dbe806084552d7bb14b9f1d00514a048b9d.tar.bz2 quagga-24c84dbe806084552d7bb14b9f1d00514a048b9d.tar.xz |
zebra: Change the mechanism for comparing route ID's.
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>
Diffstat (limited to 'zebra/router-id.c')
-rw-r--r-- | zebra/router-id.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/zebra/router-id.c b/zebra/router-id.c index 3d6b511c..b738027e 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -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 |