From: Donald Sharp Date: Mon, 15 Oct 2018 15:48:03 +0000 (-0400) Subject: bgpd: Ensure that evpn_vtep_ip_cmp actually returns useful data X-Git-Tag: frr-7.1-dev~269^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ce1677906e9db258aebc74793d4c027c74e31ec5;p=matthieu%2Ffrr.git bgpd: Ensure that evpn_vtep_ip_cmp actually returns useful data 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 --- diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 743fc4baa2..d6ed84ff56 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -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);