From 4afc1b4d4b88484379a78d794e9eee7374cb8b08 Mon Sep 17 00:00:00 2001 From: Hung-Weic Chiu Date: Wed, 10 May 2017 02:51:28 +0000 Subject: Address the error "Dead assignment" of static analysif - Refer to https://ci1.netdef.org/browse/FRR-FRR4-44/artifact/shared/static_analysis/index.html - Remove unused variable Signed-off-by: Hung-Weic Chiu --- bgpd/bgp_btoa.c | 2 +- bgpd/bgpd.c | 2 +- bgpd/rfapi/rfapi_rib.c | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c index 37bef9b85..d3162a4ea 100644 --- a/bgpd/bgp_btoa.c +++ b/bgpd/bgp_btoa.c @@ -238,7 +238,7 @@ main (int argc, char **argv) printf ("len: %zd\n", len); - ret = fread (s->data + 12, len, 1, fp); + fread (s->data + 12, len, 1, fp); if (feof (fp)) { printf ("ENDOF FILE 2\n"); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 9af26f551..24ef4465f 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6116,7 +6116,7 @@ peer_ttl_security_hops_set (struct peer *peer, int gtsm_hops) * min & max ttls on the socket. The return value is * irrelevant. */ - ret = peer_ebgp_multihop_set (peer, MAXTTL); + peer_ebgp_multihop_set (peer, MAXTTL); } } } diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index d633023dc..8fb2fe44e 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -1306,7 +1306,6 @@ callback: if (!printedprefix) { vnc_zlog_debug_verbose ("%s: For prefix %s (d)", __func__, buf_prefix); - printedprefix = 1; } vnc_zlog_debug_verbose ("%s: delete_list has %d elements", __func__, delete_list->count); -- cgit v1.2.3 From 42025b43f265c042116d9432cf4d34aeb79152f6 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 10 May 2017 19:27:33 +0200 Subject: bgpd: fixup bgpd: allow VPN next hop to be different AFI than NLRI next hop for EVPN In the case of EVPN, add the nexthop attribute. Signed-off-by: Philippe Guibert --- bgpd/bgp_attr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 1fccd25c8..61dcbd1b2 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2737,8 +2737,9 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, stream_putw (s, pkt_afi); /* AFI */ stream_putc (s, pkt_safi); /* SAFI */ - - if (nh_afi == AFI_MAX) + if (afi == AFI_L2VPN) + nh_afi = AFI_L2VPN; + else if (nh_afi == AFI_MAX) nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len); /* Nexthop */ switch (nh_afi) -- cgit v1.2.3 From cefd435b19fda334c102ab020254658bee72ccec Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Thu, 11 May 2017 08:46:48 -0400 Subject: bgpd: Issue #198 - clean up duplicate command resulting from CLI refactoring Signed-off-by: Lou Berger --- bgpd/bgp_encap.c | 137 ------------------------------------------------------- 1 file changed, 137 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index 603979942..23be34c63 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -577,73 +577,6 @@ DEFUN (show_bgp_ipv6_encap_rd_tags, return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 1); } -DEFUN (show_bgp_ipv4_encap_neighbor_routes, - show_bgp_ipv4_encap_neighbor_routes_cmd, - "show [ip] bgp ipv4 encap neighbors A.B.C.D routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_peer = 0; - union sockunion *su; - struct peer *peer; - - 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); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_neighbor, su, 0); -} - -DEFUN (show_bgp_ipv6_encap_neighbor_routes, - show_bgp_ipv6_encap_neighbor_routes_cmd, - "show [ip] bgp ipv6 encap neighbors A.B.C.D routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_peer = 5; - union sockunion su; - struct peer *peer; - - if (str2sockunion(argv[idx_peer]->arg, &su)) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_neighbor, &su, 0); -} - DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, show_bgp_ipv4_encap_rd_neighbor_routes_cmd, "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors routes", @@ -734,72 +667,6 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_neighbor, &su, 0); } -DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, - show_bgp_ipv4_encap_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv4 encap neighbors A.B.C.D advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_peer = 5; - int ret; - struct peer *peer; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, NULL); -} - -DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, - show_bgp_ipv6_encap_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv6 encap neighbors A.B.C.D advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_peer = 5; - int ret; - struct peer *peer; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, NULL); -} - DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes", @@ -899,16 +766,12 @@ bgp_encap_init (void) install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_encap_tags_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_tags_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd); } -- cgit v1.2.3 From ff595214665edcf0564c7f08693e1eacb03f39c4 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 12 May 2017 09:19:42 -0300 Subject: bgpd: fix 'show bgp [...] longer-prefixes' Signed-off-by: Renato Westphal --- bgpd/bgp_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bgpd') diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d3a6e7e90..195e3811d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8421,7 +8421,7 @@ DEFUN (show_ip_bgp, } /* prefix-longer */ if (argv_find(argv, argc, "A.B.C.D/M", &idx) || argv_find(argv, argc, "X:X::X:X/M", &idx)) - return bgp_show_prefix_longer (vty, bgp, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_longer); + return bgp_show_prefix_longer (vty, bgp, argv[idx]->arg, afi, safi, bgp_show_type_prefix_longer); if (safi == SAFI_MPLS_VPN) return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, uj); -- cgit v1.2.3 From 92a8bd6e7a9b24a350e45c1a3db939b0f591fa0a Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 12 May 2017 09:40:21 -0300 Subject: bgpd: fix duplicate install of command Only happens when FRR is configured with --enable-oldvpn-commands. Signed-off-by: Renato Westphal --- bgpd/bgp_mplsvpn.c | 1 - 1 file changed, 1 deletion(-) (limited to 'bgpd') diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 421b62fba..97b40df28 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1196,7 +1196,6 @@ bgp_mplsvpn_init (void) install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd); #ifdef KEEP_OLD_VPN_COMMANDS install_element (VIEW_NODE, &show_ip_bgp_vpn_all_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpn_all_tags_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_tags_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpn_all_neighbor_routes_cmd); -- cgit v1.2.3 From 7c7f4284cf79cf973f9d50b2a40889e09e328d72 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 12 May 2017 11:01:02 -0300 Subject: bgpd: fix segfault with '[no] bgp network import-check' These commands were causing bgpd to crash if a static VPN route was configured. While here, fix a bug in bgp_static_add() and bgp_static_delete(). Signed-off-by: Renato Westphal --- bgpd/bgp_route.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 195e3811d..de51de7a6 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4314,7 +4314,7 @@ bgp_static_add (struct bgp *bgp) for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) { - bgp_static = rn->info; + bgp_static = rm->info; bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi); } } @@ -4348,7 +4348,7 @@ bgp_static_delete (struct bgp *bgp) for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) { - bgp_static = rn->info; + bgp_static = rm->info; bgp_static_withdraw_safi (bgp, &rm->p, AFI_IP, safi, (struct prefix_rd *)&rn->p, @@ -4375,6 +4375,8 @@ bgp_static_redo_import_check (struct bgp *bgp) afi_t afi; safi_t safi; struct bgp_node *rn; + struct bgp_node *rm; + struct bgp_table *table; struct bgp_static *bgp_static; /* Use this flag to force reprocessing of the route */ @@ -4384,8 +4386,21 @@ bgp_static_redo_import_check (struct bgp *bgp) for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn)) if (rn->info != NULL) { - bgp_static = rn->info; - bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP) || (safi == SAFI_EVPN)) + { + table = rn->info; + + for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) + { + bgp_static = rm->info; + bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi); + } + } + else + { + bgp_static = rn->info; + bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + } } bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS); } -- cgit v1.2.3