summaryrefslogtreecommitdiffstats
path: root/ripd/rip_peer.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-10-17 21:31:09 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-10-19 19:14:43 +0200
commit27fa33984bd6276942459a4c68abd15d04a9333e (patch)
tree223e43ebd4d4c95f303fa63d62bfe25825d8c937 /ripd/rip_peer.c
parentMerge pull request #3203 from opensourcerouting/buildfoo-20181015 (diff)
downloadfrr-27fa33984bd6276942459a4c68abd15d04a9333e.tar.xz
frr-27fa33984bd6276942459a4c68abd15d04a9333e.zip
*: Fixup to use proper list_cmp functions
We had a variety of issues with sorted list compare functions. This commit identifies and fixes these issues. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ripd/rip_peer.c')
-rw-r--r--ripd/rip_peer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c
index ae62835a7..548dab9c0 100644
--- a/ripd/rip_peer.c
+++ b/ripd/rip_peer.c
@@ -172,7 +172,10 @@ void rip_peer_display(struct vty *vty)
static int rip_peer_list_cmp(struct rip_peer *p1, struct rip_peer *p2)
{
- return htonl(p1->addr.s_addr) > htonl(p2->addr.s_addr);
+ if (p2->addr.s_addr == p1->addr.s_addr)
+ return 0;
+
+ return (htonl(p2->addr.s_addr) < htonl(p1->addr.s_addr)) ? -1 : 1;
}
void rip_peer_init(void)