bgpd: Cleanup some SA

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-05-15 07:33:48 -04:00
parent 56afaa8bcb
commit 46c3ce8327
5 changed files with 19 additions and 19 deletions

View File

@ -1500,8 +1500,7 @@ bgp_attr_as4_path (struct bgp_attr_parser_args *args, struct aspath **as4_path)
}
/* Set aspath attribute flag. */
if (as4_path)
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH);
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH);
return BGP_ATTR_PARSE_PROCEED;
}

View File

@ -1158,16 +1158,13 @@ extcommunity_list_set (struct community_list_handler *ch,
}
}
if (str)
{
if (style == EXTCOMMUNITY_LIST_STANDARD)
ecom = ecommunity_str2com (str, 0, 1);
else
regex = bgp_regcomp (str);
if (style == EXTCOMMUNITY_LIST_STANDARD)
ecom = ecommunity_str2com (str, 0, 1);
else
regex = bgp_regcomp (str);
if (! ecom && ! regex)
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
}
if (! ecom && ! regex)
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
if (ecom)
ecom->str = ecommunity_ecom2str (ecom, ECOMMUNITY_FORMAT_DISPLAY, 0);
@ -1180,8 +1177,7 @@ extcommunity_list_set (struct community_list_handler *ch,
entry->config = ecommunity_ecom2str (ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0);
else if (regex)
entry->config = XSTRDUP (MTYPE_COMMUNITY_LIST_CONFIG, str);
else
entry->config = NULL;
entry->u.ecom = ecom;
entry->reg = regex;

View File

@ -626,7 +626,7 @@ bgp_dump_parse_time (const char *str)
return 0;
total += time * 60;
time = 0;
seen_h = 1;
seen_m = 1;
}
else
return 0;

View File

@ -603,6 +603,8 @@ bgp_notify_send_with_data (struct peer *peer, u_char code, u_char sub_code,
struct stream *s;
int length;
assert (data);
/* Allocate new stream. */
s = stream_new (BGP_MAX_PACKET_SIZE);
@ -614,8 +616,7 @@ bgp_notify_send_with_data (struct peer *peer, u_char code, u_char sub_code,
stream_putc (s, sub_code); /* BGP notify sub_code */
/* If notify data is present. */
if (data)
stream_write (s, data, datalen);
stream_write (s, data, datalen);
/* Set BGP packet length. */
length = bgp_packet_set_size (s);

View File

@ -8887,6 +8887,7 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc,
int i;
char *str;
int first = 0;
int ret = 0;
b = buffer_new (1024);
for (i = 0; i < argc; i++)
@ -8915,9 +8916,12 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc,
return CMD_WARNING;
}
return bgp_show (vty, bgp, afi, safi,
(exact ? bgp_show_type_community_exact :
bgp_show_type_community), com, 0);
ret = bgp_show (vty, bgp, afi, safi,
(exact ? bgp_show_type_community_exact :
bgp_show_type_community), com, 0);
community_free (com);
return ret;
}
static int