From: Christian Hopps Date: Sun, 6 Feb 2022 20:01:28 +0000 (-0500) Subject: ospfd: compare prefix values in host order X-Git-Tag: frr-8.5-rc~11^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2b2061e2741f55a2c918cdc3ecf385c62a97c1c0;p=matthieu%2Ffrr.git ospfd: compare prefix values in host order Signed-off-by: Christian Hopps (cherry picked from commit 156a904cae87a1ea1cd51de5012c9bddc0d63747) --- diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 6fd1c82c24..ee29ed8aae 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -2593,9 +2593,12 @@ static inline int cmp_route_nodes(struct route_node *orn, return 1; else if (!nrn) return -1; - else if (orn->p.u.prefix4.s_addr < nrn->p.u.prefix4.s_addr) + + uint32_t opn = ntohl(orn->p.u.prefix4.s_addr); + uint32_t npn = ntohl(nrn->p.u.prefix4.s_addr); + if (opn < npn) return -1; - else if (orn->p.u.prefix4.s_addr > nrn->p.u.prefix4.s_addr) + else if (opn > npn) return 1; else return 0;