]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Ensure that evpn_vtep_ip_cmp actually returns useful data 3179/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 15 Oct 2018 15:48:03 +0000 (11:48 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 15 Oct 2018 15:48:03 +0000 (11:48 -0400)
The evpn_vtep_ip_cmp function must return positive and negative
numbers for when we are doing sorted linked list inserts.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_evpn.c

index 743fc4baa2f399747acbe6604568da1702e857b3..d6ed84ff561505f775f9a88e8b94e974449b0511 100644 (file)
@@ -70,16 +70,12 @@ static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn);
  */
 
 /* compare two IPV4 VTEP IPs */
-static int evpn_vtep_ip_cmp(const void *p1, const void *p2)
+static int evpn_vtep_ip_cmp(void *p1, void *p2)
 {
        const struct in_addr *ip1 = p1;
        const struct in_addr *ip2 = p2;
 
-       if (!ip1 && !ip2)
-               return 1;
-       if (!ip1 || !ip2)
-               return 0;
-       return (ip1->s_addr == ip2->s_addr);
+       return ip1->s_addr - ip2->s_addr;
 }
 
 /*
@@ -5073,7 +5069,7 @@ struct evpnes *bgp_evpn_es_new(struct bgp *bgp,
 
        /* Initialise the VTEP list */
        es->vtep_list = list_new();
-       es->vtep_list->cmp = (int (*)(void *, void *))evpn_vtep_ip_cmp;
+       es->vtep_list->cmp = evpn_vtep_ip_cmp;
 
        /* auto derive RD for this es */
        bf_assign_index(bm->rd_idspace, es->rd_id);