mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 20:48:27 +00:00
bgpd: Cleanup grabbag of coverity scan issues found
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
ccb6c0e574
commit
daf9ddbbc6
@ -506,18 +506,22 @@ lcommunity_str_get (struct lcommunity *lcom, int i)
|
|||||||
static int
|
static int
|
||||||
lcommunity_regexp_include (regex_t * reg, struct lcommunity *lcom, int i)
|
lcommunity_regexp_include (regex_t * reg, struct lcommunity *lcom, int i)
|
||||||
{
|
{
|
||||||
const char *str;
|
char *str;
|
||||||
|
|
||||||
/* When there is no communities attribute it is treated as empty string. */
|
/* When there is no communities attribute it is treated as empty string. */
|
||||||
if (lcom == NULL || lcom->size == 0)
|
if (lcom == NULL || lcom->size == 0)
|
||||||
str = "";
|
str = XSTRDUP (MTYPE_LCOMMUNITY_STR, "");
|
||||||
else
|
else
|
||||||
str = lcommunity_str_get (lcom, i);
|
str = lcommunity_str_get (lcom, i);
|
||||||
|
|
||||||
/* Regular expression match. */
|
/* Regular expression match. */
|
||||||
if (regexec (reg, str, 0, NULL, 0) == 0)
|
if (regexec (reg, str, 0, NULL, 0) == 0)
|
||||||
return 1;
|
{
|
||||||
|
XFREE (MTYPE_LCOMMUNITY_STR, str);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
XFREE (MTYPE_LCOMMUNITY_STR, str);
|
||||||
/* No match. */
|
/* No match. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -589,24 +589,27 @@ DEFUN (show_bgp_ipv4_encap_neighbor_routes,
|
|||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Display routes learned from neighbor\n")
|
"Display routes learned from neighbor\n")
|
||||||
{
|
{
|
||||||
int idx_peer = 5;
|
int idx_peer = 0;
|
||||||
union sockunion su;
|
union sockunion *su;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
|
||||||
if (sockunion_str2su (argv[idx_peer]->arg))
|
argv_find(argv, argc, "A.B.C.D", &idx_peer);
|
||||||
|
su = sockunion_str2su (argv[idx_peer]->arg);
|
||||||
|
|
||||||
|
if (!su)
|
||||||
{
|
{
|
||||||
vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
|
vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
peer = peer_lookup (NULL, &su);
|
peer = peer_lookup (NULL, su);
|
||||||
if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP])
|
if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP])
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0);
|
return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_neighbor, su, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_bgp_ipv6_encap_neighbor_routes,
|
DEFUN (show_bgp_ipv6_encap_neighbor_routes,
|
||||||
|
@ -125,7 +125,7 @@ bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
|
|||||||
if (route_length - 4 - 10 - 8 -
|
if (route_length - 4 - 10 - 8 -
|
||||||
3 /* label to be read */ >= 32) {
|
3 /* label to be read */ >= 32) {
|
||||||
p_evpn_p->flags = IP_PREFIX_V6;
|
p_evpn_p->flags = IP_PREFIX_V6;
|
||||||
memcpy(&(p_evpn_p->ip.v4_addr), pnt, 16);
|
memcpy(&(p_evpn_p->ip.v6_addr), pnt, 16);
|
||||||
pnt += 16;
|
pnt += 16;
|
||||||
memcpy(&evpn.gw_ip.ipv6, pnt, 16);
|
memcpy(&evpn.gw_ip.ipv6, pnt, 16);
|
||||||
pnt += 16;
|
pnt += 16;
|
||||||
|
@ -11093,6 +11093,8 @@ DEFUN (no_ip_community_list_standard_all,
|
|||||||
|
|
||||||
int ret = community_list_unset (bgp_clist, cl_name_or_number, str, direct, style, delete_all);
|
int ret = community_list_unset (bgp_clist, cl_name_or_number, str, direct, style, delete_all);
|
||||||
|
|
||||||
|
XFREE (MTYPE_TMP, str);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
community_list_perror (vty, ret);
|
community_list_perror (vty, ret);
|
||||||
@ -11170,6 +11172,8 @@ DEFUN (no_ip_community_list_expanded_all,
|
|||||||
|
|
||||||
int ret = community_list_unset (bgp_clist, cl_name_or_number, str, direct, style, delete_all);
|
int ret = community_list_unset (bgp_clist, cl_name_or_number, str, direct, style, delete_all);
|
||||||
|
|
||||||
|
XFREE (MTYPE_TMP, str);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
community_list_perror (vty, ret);
|
community_list_perror (vty, ret);
|
||||||
|
@ -2524,7 +2524,7 @@ peer_group_delete (struct peer_group *group)
|
|||||||
list_delete (group->listen_range[afi]);
|
list_delete (group->listen_range[afi]);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFREE(MTYPE_BGP_PEER_HOST, group->name);
|
XFREE(MTYPE_PEER_GROUP_HOST, group->name);
|
||||||
group->name = NULL;
|
group->name = NULL;
|
||||||
|
|
||||||
group->conf->group = NULL;
|
group->conf->group = NULL;
|
||||||
@ -5458,7 +5458,7 @@ peer_prefix_list_unset (struct peer *peer, afi_t afi, safi_t safi, int direct)
|
|||||||
if (gfilter->plist[direct].name)
|
if (gfilter->plist[direct].name)
|
||||||
{
|
{
|
||||||
if (filter->plist[direct].name)
|
if (filter->plist[direct].name)
|
||||||
XSTRDUP(MTYPE_BGP_FILTER_NAME, filter->plist[direct].name);
|
XFREE(MTYPE_BGP_FILTER_NAME, filter->plist[direct].name);
|
||||||
filter->plist[direct].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, gfilter->plist[direct].name);
|
filter->plist[direct].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, gfilter->plist[direct].name);
|
||||||
filter->plist[direct].plist = gfilter->plist[direct].plist;
|
filter->plist[direct].plist = gfilter->plist[direct].plist;
|
||||||
peer_on_policy_change(peer, afi, safi,
|
peer_on_policy_change(peer, afi, safi,
|
||||||
|
@ -547,6 +547,7 @@ vnc_zebra_route_msg (
|
|||||||
api.nexthop = nhp_ary;
|
api.nexthop = nhp_ary;
|
||||||
api.ifindex_num = 0;
|
api.ifindex_num = 0;
|
||||||
api.instance = 0;
|
api.instance = 0;
|
||||||
|
api.safi = SAFI_UNICAST;
|
||||||
|
|
||||||
if (BGP_DEBUG (zebra, ZEBRA))
|
if (BGP_DEBUG (zebra, ZEBRA))
|
||||||
{
|
{
|
||||||
@ -582,6 +583,7 @@ vnc_zebra_route_msg (
|
|||||||
api.ifindex_num = 1;
|
api.ifindex_num = 1;
|
||||||
api.ifindex = &ifindex;
|
api.ifindex = &ifindex;
|
||||||
api.instance = 0;
|
api.instance = 0;
|
||||||
|
api.safi = SAFI_UNICAST;
|
||||||
|
|
||||||
if (BGP_DEBUG (zebra, ZEBRA))
|
if (BGP_DEBUG (zebra, ZEBRA))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user