From 46c3ce832799c53b90ce914b4b4c09b0589ea136 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 15 May 2017 07:33:48 -0400 Subject: [PATCH] bgpd: Cleanup some SA Signed-off-by: Donald Sharp --- bgpd/bgp_attr.c | 3 +-- bgpd/bgp_clist.c | 18 +++++++----------- bgpd/bgp_dump.c | 2 +- bgpd/bgp_packet.c | 5 +++-- bgpd/bgp_route.c | 10 +++++++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index b97ba61c95..7d5a98fec6 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -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; } diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 3def97c73d..91cd7e3762 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -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; diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 10ddf1660c..c552ceab5a 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -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; diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 0800dd74ba..ca211589f7 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -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); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 834b9e073e..01032193a5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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 -- 2.39.5