]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_route.c
Merge pull request #3113 from donaldsharp/uninited_value
[mirror_frr.git] / bgpd / bgp_route.c
index a04ed8eef53489a19eb10cfadf00e830241950c2..715393b91db62ffdc6cc2fb265a78e5606aaecd5 100644 (file)
@@ -215,7 +215,7 @@ static void bgp_info_extra_free(struct bgp_info_extra **extra)
                bgp_unlock(e->bgp_orig);
 
        if ((*extra)->bgp_fs_pbr)
-               list_delete_and_null(&((*extra)->bgp_fs_pbr));
+               list_delete(&((*extra)->bgp_fs_pbr));
        XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra);
 
        *extra = NULL;
@@ -2775,30 +2775,40 @@ static bool overlay_index_equal(afi_t afi, struct bgp_info *info,
 {
        struct eth_segment_id *info_eth_s_id, *info_eth_s_id_remote;
        union gw_addr *info_gw_ip, *info_gw_ip_remote;
-       char temp[16];
+       union {
+               struct eth_segment_id esi;
+               union gw_addr ip;
+       } temp;
 
        if (afi != AFI_L2VPN)
                return true;
        if (!info->attr) {
-               memset(&temp, 0, 16);
-               info_eth_s_id = (struct eth_segment_id *)&temp;
-               info_gw_ip = (union gw_addr *)&temp;
+               memset(&temp, 0, sizeof(temp));
+               info_eth_s_id = &temp.esi;
+               info_gw_ip = &temp.ip;
+
                if (eth_s_id == NULL && gw_ip == NULL)
                        return true;
        } else {
                info_eth_s_id = &(info->attr->evpn_overlay.eth_s_id);
                info_gw_ip = &(info->attr->evpn_overlay.gw_ip);
        }
-       if (gw_ip == NULL)
-               info_gw_ip_remote = (union gw_addr *)&temp;
-       else
+
+       if (gw_ip == NULL) {
+               memset(&temp, 0, sizeof(temp));
+               info_gw_ip_remote = &temp.ip;
+       } else
                info_gw_ip_remote = gw_ip;
-       if (eth_s_id == NULL)
-               info_eth_s_id_remote = (struct eth_segment_id *)&temp;
-       else
+
+       if (eth_s_id == NULL) {
+               memset(&temp, 0, sizeof(temp));
+               info_eth_s_id_remote = &temp.esi;
+       } else
                info_eth_s_id_remote = eth_s_id;
+
        if (!memcmp(info_gw_ip, info_gw_ip_remote, sizeof(union gw_addr)))
                return false;
+
        return !memcmp(info_eth_s_id, info_eth_s_id_remote,
                       sizeof(struct eth_segment_id));
 }
@@ -5478,6 +5488,9 @@ static int bgp_aggregate_info_same(struct bgp_info *ri, uint8_t origin,
        if (!community_cmp(ri->attr->community, comm))
                return 0;
 
+       if (!CHECK_FLAG(ri->flags, BGP_INFO_VALID))
+               return 0;
+
        return 1;
 }