mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 08:49:58 +00:00
Merge pull request #10322 from iqras23/coverity
bgpd: Addressing few coverity issues
This commit is contained in:
commit
aa6e3cef62
@ -404,9 +404,8 @@ static bool overlay_index_same(const struct attr *a1, const struct attr *a2)
|
|||||||
if (!a1 && !a2)
|
if (!a1 && !a2)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return !memcmp(bgp_attr_get_evpn_overlay(a1),
|
return bgp_route_evpn_same(bgp_attr_get_evpn_overlay(a1),
|
||||||
bgp_attr_get_evpn_overlay(a2),
|
bgp_attr_get_evpn_overlay(a2));
|
||||||
sizeof(struct bgp_route_evpn));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unknown transit attribute. */
|
/* Unknown transit attribute. */
|
||||||
|
@ -36,6 +36,14 @@
|
|||||||
#include "bgpd/bgp_evpn.h"
|
#include "bgpd/bgp_evpn.h"
|
||||||
#include "bgpd/bgp_evpn_private.h"
|
#include "bgpd/bgp_evpn_private.h"
|
||||||
|
|
||||||
|
bool bgp_route_evpn_same(const struct bgp_route_evpn *e1,
|
||||||
|
const struct bgp_route_evpn *e2)
|
||||||
|
{
|
||||||
|
return (e1->type == e2->type &&
|
||||||
|
!memcmp(&(e1->eth_s_id), &(e2->eth_s_id), sizeof(esi_t)) &&
|
||||||
|
!ipaddr_cmp(&(e1->gw_ip), &(e2->gw_ip)));
|
||||||
|
}
|
||||||
|
|
||||||
void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
|
void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
|
||||||
{
|
{
|
||||||
struct ecommunity_val routermac_ecom;
|
struct ecommunity_val routermac_ecom;
|
||||||
|
@ -59,4 +59,7 @@ extern void bgp_attr_evpn_na_flag(struct attr *attr, uint8_t *router_flag,
|
|||||||
bool *proxy);
|
bool *proxy);
|
||||||
extern uint16_t bgp_attr_df_pref_from_ec(struct attr *attr, uint8_t *alg);
|
extern uint16_t bgp_attr_df_pref_from_ec(struct attr *attr, uint8_t *alg);
|
||||||
|
|
||||||
|
|
||||||
|
extern bool bgp_route_evpn_same(const struct bgp_route_evpn *e1,
|
||||||
|
const struct bgp_route_evpn *e2);
|
||||||
#endif /* _QUAGGA_BGP_ATTR_EVPN_H */
|
#endif /* _QUAGGA_BGP_ATTR_EVPN_H */
|
||||||
|
@ -6146,7 +6146,7 @@ static bool bgp_evpn_remote_ip_hash_cmp(const void *p1, const void *p2)
|
|||||||
const struct evpn_remote_ip *ip1 = p1;
|
const struct evpn_remote_ip *ip1 = p1;
|
||||||
const struct evpn_remote_ip *ip2 = p2;
|
const struct evpn_remote_ip *ip2 = p2;
|
||||||
|
|
||||||
return (memcmp(&ip1->addr, &ip2->addr, sizeof(struct ipaddr)) == 0);
|
return !ipaddr_cmp(&ip1->addr, &ip2->addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bgp_evpn_remote_ip_hash_init(struct bgpevpn *vpn)
|
static void bgp_evpn_remote_ip_hash_init(struct bgpevpn *vpn)
|
||||||
|
@ -175,7 +175,6 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
|
|||||||
/* not expected */
|
/* not expected */
|
||||||
return BGP_IPV4_NODE;
|
return BGP_IPV4_NODE;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case AFI_IP6:
|
case AFI_IP6:
|
||||||
switch (safi) {
|
switch (safi) {
|
||||||
case SAFI_UNICAST:
|
case SAFI_UNICAST:
|
||||||
@ -192,7 +191,6 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
|
|||||||
/* not expected */
|
/* not expected */
|
||||||
return BGP_IPV4_NODE;
|
return BGP_IPV4_NODE;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case AFI_L2VPN:
|
case AFI_L2VPN:
|
||||||
return BGP_EVPN_NODE;
|
return BGP_EVPN_NODE;
|
||||||
case AFI_UNSPEC:
|
case AFI_UNSPEC:
|
||||||
@ -13599,49 +13597,58 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
|
|||||||
json_object_int_add(json_stat, "totalRecv", PEER_TOTAL_RX(p));
|
json_object_int_add(json_stat, "totalRecv", PEER_TOTAL_RX(p));
|
||||||
json_object_object_add(json_neigh, "messageStats", json_stat);
|
json_object_object_add(json_neigh, "messageStats", json_stat);
|
||||||
} else {
|
} else {
|
||||||
atomic_size_t outq_count, inq_count;
|
atomic_size_t outq_count, inq_count, open_out, open_in,
|
||||||
|
notify_out, notify_in, update_out, update_in,
|
||||||
|
keepalive_out, keepalive_in, refresh_out, refresh_in,
|
||||||
|
dynamic_cap_out, dynamic_cap_in;
|
||||||
outq_count = atomic_load_explicit(&p->obuf->count,
|
outq_count = atomic_load_explicit(&p->obuf->count,
|
||||||
memory_order_relaxed);
|
memory_order_relaxed);
|
||||||
inq_count = atomic_load_explicit(&p->ibuf->count,
|
inq_count = atomic_load_explicit(&p->ibuf->count,
|
||||||
memory_order_relaxed);
|
memory_order_relaxed);
|
||||||
|
open_out = atomic_load_explicit(&p->open_out,
|
||||||
|
memory_order_relaxed);
|
||||||
|
open_in =
|
||||||
|
atomic_load_explicit(&p->open_in, memory_order_relaxed);
|
||||||
|
notify_out = atomic_load_explicit(&p->notify_out,
|
||||||
|
memory_order_relaxed);
|
||||||
|
notify_in = atomic_load_explicit(&p->notify_in,
|
||||||
|
memory_order_relaxed);
|
||||||
|
update_out = atomic_load_explicit(&p->update_out,
|
||||||
|
memory_order_relaxed);
|
||||||
|
update_in = atomic_load_explicit(&p->update_in,
|
||||||
|
memory_order_relaxed);
|
||||||
|
keepalive_out = atomic_load_explicit(&p->keepalive_out,
|
||||||
|
memory_order_relaxed);
|
||||||
|
keepalive_in = atomic_load_explicit(&p->keepalive_in,
|
||||||
|
memory_order_relaxed);
|
||||||
|
refresh_out = atomic_load_explicit(&p->refresh_out,
|
||||||
|
memory_order_relaxed);
|
||||||
|
refresh_in = atomic_load_explicit(&p->refresh_in,
|
||||||
|
memory_order_relaxed);
|
||||||
|
dynamic_cap_out = atomic_load_explicit(&p->dynamic_cap_out,
|
||||||
|
memory_order_relaxed);
|
||||||
|
dynamic_cap_in = atomic_load_explicit(&p->dynamic_cap_in,
|
||||||
|
memory_order_relaxed);
|
||||||
|
|
||||||
/* Packet counts. */
|
/* Packet counts. */
|
||||||
vty_out(vty, " Message statistics:\n");
|
vty_out(vty, " Message statistics:\n");
|
||||||
vty_out(vty, " Inq depth is %zu\n", inq_count);
|
vty_out(vty, " Inq depth is %zu\n", inq_count);
|
||||||
vty_out(vty, " Outq depth is %zu\n", outq_count);
|
vty_out(vty, " Outq depth is %zu\n", outq_count);
|
||||||
vty_out(vty, " Sent Rcvd\n");
|
vty_out(vty, " Sent Rcvd\n");
|
||||||
vty_out(vty, " Opens: %10d %10d\n",
|
vty_out(vty, " Opens: %10zu %10zu\n", open_out,
|
||||||
atomic_load_explicit(&p->open_out,
|
open_in);
|
||||||
memory_order_relaxed),
|
vty_out(vty, " Notifications: %10zu %10zu\n", notify_out,
|
||||||
atomic_load_explicit(&p->open_in,
|
notify_in);
|
||||||
memory_order_relaxed));
|
vty_out(vty, " Updates: %10zu %10zu\n", update_out,
|
||||||
vty_out(vty, " Notifications: %10d %10d\n",
|
update_in);
|
||||||
atomic_load_explicit(&p->notify_out,
|
vty_out(vty, " Keepalives: %10zu %10zu\n", keepalive_out,
|
||||||
memory_order_relaxed),
|
keepalive_in);
|
||||||
atomic_load_explicit(&p->notify_in,
|
vty_out(vty, " Route Refresh: %10zu %10zu\n", refresh_out,
|
||||||
memory_order_relaxed));
|
refresh_in);
|
||||||
vty_out(vty, " Updates: %10d %10d\n",
|
vty_out(vty, " Capability: %10zu %10zu\n",
|
||||||
atomic_load_explicit(&p->update_out,
|
dynamic_cap_out, dynamic_cap_in);
|
||||||
memory_order_relaxed),
|
vty_out(vty, " Total: %10u %10u\n",
|
||||||
atomic_load_explicit(&p->update_in,
|
(uint32_t)PEER_TOTAL_TX(p), (uint32_t)PEER_TOTAL_RX(p));
|
||||||
memory_order_relaxed));
|
|
||||||
vty_out(vty, " Keepalives: %10d %10d\n",
|
|
||||||
atomic_load_explicit(&p->keepalive_out,
|
|
||||||
memory_order_relaxed),
|
|
||||||
atomic_load_explicit(&p->keepalive_in,
|
|
||||||
memory_order_relaxed));
|
|
||||||
vty_out(vty, " Route Refresh: %10d %10d\n",
|
|
||||||
atomic_load_explicit(&p->refresh_out,
|
|
||||||
memory_order_relaxed),
|
|
||||||
atomic_load_explicit(&p->refresh_in,
|
|
||||||
memory_order_relaxed));
|
|
||||||
vty_out(vty, " Capability: %10d %10d\n",
|
|
||||||
atomic_load_explicit(&p->dynamic_cap_out,
|
|
||||||
memory_order_relaxed),
|
|
||||||
atomic_load_explicit(&p->dynamic_cap_in,
|
|
||||||
memory_order_relaxed));
|
|
||||||
vty_out(vty, " Total: %10d %10d\n", PEER_TOTAL_TX(p),
|
|
||||||
PEER_TOTAL_RX(p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
|
@ -2843,8 +2843,8 @@ static int bgp_zebra_process_local_es_evi(ZAPI_CALLBACK_ARGS)
|
|||||||
|
|
||||||
if (BGP_DEBUG(zebra, ZEBRA))
|
if (BGP_DEBUG(zebra, ZEBRA))
|
||||||
zlog_debug("Rx %s ESI %s VNI %u",
|
zlog_debug("Rx %s ESI %s VNI %u",
|
||||||
ZEBRA_VNI_ADD ? "add" : "del",
|
(cmd == ZEBRA_VNI_ADD) ? "add" : "del",
|
||||||
esi_to_str(&esi, buf, sizeof(buf)), vni);
|
esi_to_str(&esi, buf, sizeof(buf)), vni);
|
||||||
|
|
||||||
if (cmd == ZEBRA_LOCAL_ES_EVI_ADD) {
|
if (cmd == ZEBRA_LOCAL_ES_EVI_ADD) {
|
||||||
frrtrace(2, frr_bgp, evpn_mh_local_es_evi_add_zrecv, &esi, vni);
|
frrtrace(2, frr_bgp, evpn_mh_local_es_evi_add_zrecv, &esi, vni);
|
||||||
|
Loading…
Reference in New Issue
Block a user