From 919e06667ab15d8a92882755d6b0bacf3af178ef Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 12 Nov 2015 20:25:46 +0000 Subject: [PATCH 01/12] BGP: "redistribute" is missing from the "address-family ipv4 unicast" sub-context Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-8164 --- bgpd/bgp_vty.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 6bbb5d8dd3..911cc5953b 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -13249,6 +13249,26 @@ bgp_vty_init (void) install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); + install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); + install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); #ifdef HAVE_IPV6 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); From 7dc9d4e4e3609804aee5c4665ed998b570bca8f2 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 12 Nov 2015 20:30:22 +0000 Subject: [PATCH 02/12] bgp may add multiple path entries with the same nexthop Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-8129 - We have 14 paths for each prefix, 7 are from ipv4 peers and 7 are from ipv6 peers - There are 7 unique nexthops - When comparing the exact same path from an v4 peer vs. a v6 peer the path from the v4 peer wins. This is due to the "lowest neighbor IP" check in the decision algorithm. For example below we learn NEXTHOP 210.2.4.2 from 210.2.4.2 and 2001:20:4::2 but only the one from the v4 peer is flagged as multipath. - The problem is when our bestpath is from a v6 peer, 2001:20:2::2 in this case (see line 85). 2001:20:2::2 sent us 210.2.2.2 so we will install that nexthop because it is from our bestpath, the problem is we flag the path from 210.2.2.2 (line 37) as multipath which causes us to install two paths with nexthop 210.2.2.2 1 superm-redxp-05# show ip bgp 2.23.24.192/28 2 BGP routing table entry for 2.23.24.192/28 3 Paths: (14 available, best #14, table Default-IP-Routing-Table) 4 Advertised to non peer-group peers: 5 210.2.0.2 210.2.1.2 210.2.2.2 210.2.3.2 210.2.4.2 210.2.5.2 210.2.6.2 210.4.1.4 2001:20::2 2001:20:1::2 2001:20:2::2 2001:20:3::2 2001:20:4::2 2001:2 6 205 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 7 210.2.4.2 from 210.2.4.2 (10.0.0.2) 8 Origin IGP, localpref 100, valid, external, multipath 9 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 10 Last update: Wed Nov 11 20:54:57 2015 11 12 204 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 13 210.2.3.2 from 210.2.3.2 (10.0.0.2) 14 Origin IGP, localpref 100, valid, external, multipath 15 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 16 Last update: Wed Nov 11 20:54:57 2015 17 18 202 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 19 210.2.1.2 from 210.2.1.2 (10.0.0.2) 20 Origin IGP, localpref 100, valid, external, multipath 21 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 22 Last update: Wed Nov 11 20:54:57 2015 23 24 206 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 25 210.2.5.2 from 2001:20:5::2 (10.0.0.2) 26 Origin IGP, localpref 100, valid, external 27 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 28 Last update: Wed Nov 11 20:54:57 2015 29 30 205 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 31 210.2.4.2 from 2001:20:4::2 (10.0.0.2) 32 Origin IGP, localpref 100, valid, external 33 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 34 Last update: Wed Nov 11 20:54:57 2015 35 36 203 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 37 210.2.2.2 from 210.2.2.2 (10.0.0.2) 38 Origin IGP, localpref 100, valid, external, multipath 39 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 40 Last update: Wed Nov 11 20:54:57 2015 41 42 202 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 43 210.2.1.2 from 2001:20:1::2 (10.0.0.2) 44 Origin IGP, localpref 100, valid, external 45 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 46 Last update: Wed Nov 11 20:54:57 2015 47 48 201 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 49 210.2.0.2 from 210.2.0.2 (10.0.0.2) 50 Origin IGP, localpref 100, valid, external, multipath 51 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 52 Last update: Wed Nov 11 20:54:57 2015 53 54 206 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 55 210.2.5.2 from 210.2.5.2 (10.0.0.2) 56 Origin IGP, localpref 100, valid, external, multipath 57 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 58 Last update: Wed Nov 11 20:54:57 2015 59 60 207 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 61 210.2.6.2 from 2001:20:6::2 (10.0.0.2) 62 Origin IGP, localpref 100, valid, external 63 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 64 Last update: Wed Nov 11 20:54:57 2015 65 66 207 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 67 210.2.6.2 from 210.2.6.2 (10.0.0.2) 68 Origin IGP, localpref 100, valid, external, multipath 69 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 70 Last update: Wed Nov 11 20:54:57 2015 71 72 201 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 73 210.2.0.2 from 2001:20::2 (10.0.0.2) 74 Origin IGP, localpref 100, valid, external 75 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 76 Last update: Wed Nov 11 20:54:57 2015 77 78 204 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 79 210.2.3.2 from 2001:20:3::2 (10.0.0.2) 80 Origin IGP, localpref 100, valid, external 81 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 82 Last update: Wed Nov 11 20:54:57 2015 83 84 203 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688 85 210.2.2.2 from 2001:20:2::2 (10.0.0.2) 86 Origin IGP, localpref 100, valid, external, multipath, best 87 Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754 88 Last update: Wed Nov 11 20:54:57 2015 89 90 superm-redxp-05# Here you can see the two paths with nexthop 210.2.2.2 superm-redxp-05# show ip route 2.23.24.192/28 Routing entry for 2.23.24.192/28 Known via "bgp", distance 20, metric 0, best Last update 00:32:12 ago * 210.2.2.2, via swp3 * 210.2.0.2, via swp1 * 210.2.1.2, via swp2 * 210.2.2.2, via swp3 * 210.2.3.2, via swp4 * 210.2.4.2, via swp5 * 210.2.5.2, via swp6 * 210.2.6.2, via swp7 superm-redxp-05# superm-redxp-05# The fix is to not flag a path as multipath if it has the same nexthop as the bestpath --- bgpd/bgp_mpath.c | 2 +- bgpd/bgp_mpath.h | 1 + bgpd/bgp_route.c | 10 +++++++++- bgpd/bgpd.c | 8 ++++---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 30eefdb5fe..c0e1a61636 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -103,7 +103,7 @@ bgp_maximum_paths_unset (struct bgp *bgp, afi_t afi, safi_t safi, * or greater than zero if bi1 is respectively less than, equal to, * or greater than bi2. */ -static int +int bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2) { struct attr_extra *ae1, *ae2; diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 0c8137041a..729b2c8cab 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -59,6 +59,7 @@ extern int bgp_maximum_paths_unset (struct bgp *, afi_t, safi_t, int); /* Functions used by bgp_best_selection to record current * multipath selections */ +extern int bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2); extern void bgp_mp_list_init (struct list *); extern void bgp_mp_list_clear (struct list *); extern void bgp_mp_list_add (struct list *, struct bgp_info *); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index eae8f61645..4d5d6ad690 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1637,12 +1637,20 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn, if (ri->peer->status != Established) continue; + if (!bgp_info_nexthop_cmp (ri, new_select)) + { + if (debug) + zlog_debug("%s: path %s has the same nexthop as the bestpath, skip it", + pfx_buf, ri->peer->host); + continue; + } + bgp_info_cmp (bgp, ri, new_select, &paths_eq, mpath_cfg, debug, pfx_buf); if (paths_eq) { if (debug) - zlog_debug("%s: %s path is equivalent to the bestpath, add to the multipath list", + zlog_debug("%s: path %s is equivalent to the bestpath, add to the multipath list", pfx_buf, ri->peer->host); bgp_mp_list_add (&mp_list, ri); } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index db97810013..3ad59ff0c1 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6899,10 +6899,10 @@ bgp_config_write (struct vty *vty) { vty_out (vty, " bgp bestpath as-path multipath-relax as-set%s", VTY_NEWLINE); } - } - else - { - vty_out (vty, " no bgp bestpath as-path multipath-relax%s", VTY_NEWLINE); + else + { + vty_out (vty, " bgp bestpath as-path multipath-relax%s", VTY_NEWLINE); + } } if (bgp_flag_check (bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) { From c3150466c860998e887e77bd61b00d5ef0e29fbb Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 13 Nov 2015 02:38:42 +0000 Subject: [PATCH 03/12] OSPF: remove deprecated commands Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-8142 --- ospfd/ospf_vty.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 3aee037445..22f38b212a 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -2534,37 +2534,6 @@ DEFUN (ospf_timers_throttle_spf, return ospf_timers_spf_set (vty, delay, hold, max); } -DEFUN_DEPRECATED (ospf_timers_spf, - ospf_timers_spf_cmd, - "timers spf <0-4294967295> <0-4294967295>", - "Adjust routing timers\n" - "OSPF SPF timers\n" - "Delay (s) between receiving a change to SPF calculation\n" - "Hold time (s) between consecutive SPF calculations\n") -{ - unsigned int delay, hold; - - if (argc != 2) - { - vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); - return CMD_WARNING; - } - - VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); - VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); - - /* truncate down the second values if they're greater than 600000ms */ - if (delay > (600000 / 1000)) - delay = 600000; - else if (delay == 0) - /* 0s delay was probably specified because of lack of ms resolution */ - delay = OSPF_SPF_DELAY_DEFAULT; - if (hold > (600000 / 1000)) - hold = 600000; - - return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000); -} - DEFUN (no_ospf_timers_throttle_spf, no_ospf_timers_throttle_spf_cmd, "no timers throttle spf", @@ -2590,13 +2559,6 @@ ALIAS (no_ospf_timers_throttle_spf, "Initial hold time (msec) between consecutive SPF calculations\n" "Maximum hold time (msec)\n") -ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, - no_ospf_timers_spf_cmd, - "no timers spf", - NO_STR - "Adjust routing timers\n" - "OSPF SPF timers\n") - DEFUN (ospf_timers_lsa, ospf_timers_lsa_cmd, "timers lsa min-arrival <0-600000>", @@ -10064,8 +10026,6 @@ ospf_vty_init (void) install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); /* SPF timer commands */ - install_element (OSPF_NODE, &ospf_timers_spf_cmd); - install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_val_cmd); From 47e9b2923f633d4112315c29c2cedab7ff2ccb96 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 13 Nov 2015 03:14:10 +0000 Subject: [PATCH 04/12] BGP: Remove deprecated commands and add warning that "show ipv6 bgp" will be deprecated in the future Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Reviewed-by: Vivek Venkatraman Ticket: CM-8144 --- bgpd/bgp_debug.c | 8 +- bgpd/bgp_route.c | 206 ++++++++------------------------------------ bgpd/bgp_routemap.c | 92 +++----------------- bgpd/bgp_vty.c | 72 ---------------- 4 files changed, 49 insertions(+), 329 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 3829a7d121..68106b449e 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -1732,7 +1732,7 @@ DEFUN (debug_bgp_normal, DEBUG_STR BGP_STR) { - vty_out (vty, "%% Ignoring old debugging command, please use the enhanced bgp debugs%s", + vty_out (vty, "%% This command will be deprecated in our next release, please use 'debug bgp neighbor-events'%s", VTY_NEWLINE); return CMD_SUCCESS; } @@ -1744,7 +1744,7 @@ DEFUN (debug_bgp_fsm, BGP_STR "deprecated BGP fsm command do not use") { - vty_out (vty, "%% Ignoring old debugging command, please use the enhanced bgp debugs%s", + vty_out (vty, "%% This command will be deprecated in our next release, please use 'debug bgp neighbor-events'%s", VTY_NEWLINE); return CMD_SUCCESS; } @@ -1756,7 +1756,7 @@ DEFUN (debug_bgp_events, BGP_STR "deprecated BGP events command do not use") { - vty_out (vty, "%% Ignoring old debugging command, please use the enhanced bgp debugs%s", + vty_out (vty, "%% This command will be deprecated in our next release, please use 'debug bgp neighbor-events'%s", VTY_NEWLINE); return CMD_SUCCESS; } @@ -1768,7 +1768,7 @@ DEFUN (debug_bgp_filter, BGP_STR "deprecated BGP filters command do not use") { - vty_out (vty, "%% Ignoring old debugging command, please use the enhanced bgp debugs%s", + vty_out (vty, "%% This command will be deprecated in our next release, please use 'debug bgp updates'%s", VTY_NEWLINE); return CMD_SUCCESS; } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4d5d6ad690..cf88b3ee8a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4270,129 +4270,6 @@ ALIAS (no_ipv6_bgp_network, "IPv6 prefix /, e.g., 3ffe::/16\n") #endif /* HAVE_IPV6 */ -/* stubs for removed AS-Pathlimit commands, kept for config compatibility */ -ALIAS_DEPRECATED (bgp_network, - bgp_network_ttl_cmd, - "network A.B.C.D/M pathlimit <0-255>", - "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (bgp_network_backdoor, - bgp_network_backdoor_ttl_cmd, - "network A.B.C.D/M backdoor pathlimit <0-255>", - "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (bgp_network_mask, - bgp_network_mask_ttl_cmd, - "network A.B.C.D mask A.B.C.D pathlimit <0-255>", - "Specify a network to announce via BGP\n" - "Network number\n" - "Network mask\n" - "Network mask\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (bgp_network_mask_backdoor, - bgp_network_mask_backdoor_ttl_cmd, - "network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>", - "Specify a network to announce via BGP\n" - "Network number\n" - "Network mask\n" - "Network mask\n" - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (bgp_network_mask_natural, - bgp_network_mask_natural_ttl_cmd, - "network A.B.C.D pathlimit <0-255>", - "Specify a network to announce via BGP\n" - "Network number\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (bgp_network_mask_natural_backdoor, - bgp_network_mask_natural_backdoor_ttl_cmd, - "network A.B.C.D backdoor pathlimit <1-255>", - "Specify a network to announce via BGP\n" - "Network number\n" - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_bgp_network, - no_bgp_network_ttl_cmd, - "no network A.B.C.D/M pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_bgp_network, - no_bgp_network_backdoor_ttl_cmd, - "no network A.B.C.D/M backdoor pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_bgp_network, - no_bgp_network_mask_ttl_cmd, - "no network A.B.C.D mask A.B.C.D pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Network mask\n" - "Network mask\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_bgp_network_mask, - no_bgp_network_mask_backdoor_ttl_cmd, - "no network A.B.C.D mask A.B.C.D backdoor pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Network mask\n" - "Network mask\n" - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_bgp_network_mask_natural, - no_bgp_network_mask_natural_ttl_cmd, - "no network A.B.C.D pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_bgp_network_mask_natural, - no_bgp_network_mask_natural_backdoor_ttl_cmd, - "no network A.B.C.D backdoor pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -#ifdef HAVE_IPV6 -ALIAS_DEPRECATED (ipv6_bgp_network, - ipv6_bgp_network_ttl_cmd, - "network X:X::X:X/M pathlimit <0-255>", - "Specify a network to announce via BGP\n" - "IPv6 prefix /\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -ALIAS_DEPRECATED (no_ipv6_bgp_network, - no_ipv6_bgp_network_ttl_cmd, - "no network X:X::X:X/M pathlimit <0-255>", - NO_STR - "Specify a network to announce via BGP\n" - "IPv6 prefix /\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -#endif /* HAVE_IPV6 */ - /* Aggreagete address: advertise-map Set condition to advertise attribute @@ -7995,6 +7872,14 @@ DEFUN (show_bgp_ipv6_safi, return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json); } +static void +bgp_show_ipv6_bgp_deprecate_warning (struct vty *vty) +{ + vty_out (vty, "WARNING: The 'show ipv6 bgp' parse tree will be deprecated in our" + " next release%sPlese use 'show bgp ipv6' instead%s%s", + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); +} + /* old command */ DEFUN (show_ipv6_bgp, show_ipv6_bgp_cmd, @@ -8005,6 +7890,7 @@ DEFUN (show_ipv6_bgp, "JavaScript Object Notation\n") { u_char use_json = (argv[0] != NULL); + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json); } @@ -8113,6 +7999,7 @@ DEFUN (show_ipv6_bgp_route, "JavaScript Object Notation\n") { u_char use_json = (argv[1] != NULL); + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json); } @@ -8220,6 +8107,7 @@ DEFUN (show_ipv6_bgp_prefix, "JavaScript Object Notation\n") { u_char use_json = (argv[1] != NULL); + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json); } @@ -8316,6 +8204,7 @@ DEFUN (show_ipv6_mbgp, "JavaScript Object Notation\n") { u_char use_json = (argv[0] != NULL); + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal, NULL, use_json); } @@ -8331,6 +8220,7 @@ DEFUN (show_ipv6_mbgp_route, "JavaScript Object Notation\n") { u_char use_json = (argv[1] != NULL); + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json); } @@ -8345,6 +8235,7 @@ DEFUN (show_ipv6_mbgp_prefix, "JavaScript Object Notation\n") { u_char use_json = (argv[1] != NULL); + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json); } #endif @@ -8474,6 +8365,7 @@ DEFUN (show_ipv6_bgp_regexp, "Display routes matching the AS path regular expression\n" "A regular-expression to match the BGP AS paths\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_regexp (vty, argc, argv, AFI_IP6, SAFI_UNICAST, bgp_show_type_regexp); } @@ -8488,6 +8380,7 @@ DEFUN (show_ipv6_mbgp_regexp, "Display routes matching the AS path regular expression\n" "A regular-expression to match the MBGP AS paths\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_regexp (vty, argc, argv, AFI_IP6, SAFI_MULTICAST, bgp_show_type_regexp); } @@ -8589,6 +8482,7 @@ DEFUN (show_ipv6_bgp_prefix_list, "Display routes matching the prefix-list\n" "IPv6 prefix-list name\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_prefix_list (vty, argv[0], AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -8603,6 +8497,7 @@ DEFUN (show_ipv6_mbgp_prefix_list, "Display routes matching the prefix-list\n" "IPv6 prefix-list name\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_prefix_list (vty, argv[0], AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_list); } @@ -8703,6 +8598,7 @@ DEFUN (show_ipv6_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_filter_list (vty, argv[0], AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -8717,6 +8613,7 @@ DEFUN (show_ipv6_mbgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_filter_list (vty, argv[0], AFI_IP6, SAFI_MULTICAST, bgp_show_type_filter_list); } @@ -8911,6 +8808,7 @@ DEFUN (show_ipv6_bgp_community_all, BGP_STR "Display routes matching the communities\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_community_all, NULL, 0); } @@ -8924,6 +8822,7 @@ DEFUN (show_ipv6_mbgp_community_all, MBGP_STR "Display routes matching the communities\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_community_all, NULL, 0); } @@ -9658,6 +9557,7 @@ DEFUN (show_ipv6_bgp_community, "Do not advertise to any peer (well-known community)\n" "Do not export to next AS (well-known community)\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP6, SAFI_UNICAST); } @@ -9889,6 +9789,7 @@ DEFUN (show_ipv6_bgp_community_exact, "Do not export to next AS (well-known community)\n" "Exact match of the communities") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP6, SAFI_UNICAST); } @@ -9971,6 +9872,7 @@ DEFUN (show_ipv6_mbgp_community, "Do not advertise to any peer (well-known community)\n" "Do not export to next AS (well-known community)\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP6, SAFI_MULTICAST); } @@ -10051,6 +9953,7 @@ DEFUN (show_ipv6_mbgp_community_exact, "Do not export to next AS (well-known community)\n" "Exact match of the communities") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP6, SAFI_MULTICAST); } @@ -10239,6 +10142,7 @@ DEFUN (show_ipv6_bgp_community_list, "Display routes matching the community-list\n" "community-list name\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community_list (vty, argv[0], 0, AFI_IP6, SAFI_UNICAST); } @@ -10252,6 +10156,7 @@ DEFUN (show_ipv6_mbgp_community_list, "Display routes matching the community-list\n" "community-list name\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community_list (vty, argv[0], 0, AFI_IP6, SAFI_MULTICAST); } @@ -10290,6 +10195,7 @@ DEFUN (show_ipv6_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community_list (vty, argv[0], 1, AFI_IP6, SAFI_UNICAST); } @@ -10304,6 +10210,7 @@ DEFUN (show_ipv6_mbgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_community_list (vty, argv[0], 1, AFI_IP6, SAFI_MULTICAST); } #endif /* HAVE_IPV6 */ @@ -10433,6 +10340,7 @@ DEFUN (show_ipv6_bgp_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Display route and more specific routes\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_prefix_longer (vty, argv[0], AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -10447,6 +10355,7 @@ DEFUN (show_ipv6_mbgp_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Display route and more specific routes\n") { + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_prefix_longer (vty, argv[0], AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_longer); } @@ -11719,6 +11628,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, if (! peer) return CMD_WARNING; + bgp_show_ipv6_bgp_deprecate_warning(vty); return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 0, NULL, use_json); } #endif /* HAVE_IPV6 */ @@ -12358,6 +12268,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, if (! peer) return CMD_WARNING; + bgp_show_ipv6_bgp_deprecate_warning(vty); return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1, NULL,use_json); } @@ -12838,6 +12749,7 @@ DEFUN (ipv6_mbgp_neighbor_routes, if (! peer) return CMD_WARNING; + bgp_show_ipv6_bgp_deprecate_warning(vty); return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_MULTICAST, bgp_show_type_neighbor, use_json); } @@ -14284,54 +14196,6 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &bgp_damp_set3_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); - - /* Deprecated AS-Pathlimit commands */ - install_element (BGP_NODE, &bgp_network_ttl_cmd); - install_element (BGP_NODE, &bgp_network_mask_ttl_cmd); - install_element (BGP_NODE, &bgp_network_mask_natural_ttl_cmd); - install_element (BGP_NODE, &bgp_network_backdoor_ttl_cmd); - install_element (BGP_NODE, &bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_NODE, &bgp_network_mask_natural_backdoor_ttl_cmd); - - install_element (BGP_NODE, &no_bgp_network_ttl_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_ttl_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_natural_ttl_cmd); - install_element (BGP_NODE, &no_bgp_network_backdoor_ttl_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); - - install_element (BGP_IPV4_NODE, &bgp_network_ttl_cmd); - install_element (BGP_IPV4_NODE, &bgp_network_mask_ttl_cmd); - install_element (BGP_IPV4_NODE, &bgp_network_mask_natural_ttl_cmd); - install_element (BGP_IPV4_NODE, &bgp_network_backdoor_ttl_cmd); - install_element (BGP_IPV4_NODE, &bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_IPV4_NODE, &bgp_network_mask_natural_backdoor_ttl_cmd); - - install_element (BGP_IPV4_NODE, &no_bgp_network_ttl_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_mask_ttl_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_mask_natural_ttl_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_backdoor_ttl_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); - - install_element (BGP_IPV4M_NODE, &bgp_network_ttl_cmd); - install_element (BGP_IPV4M_NODE, &bgp_network_mask_ttl_cmd); - install_element (BGP_IPV4M_NODE, &bgp_network_mask_natural_ttl_cmd); - install_element (BGP_IPV4M_NODE, &bgp_network_backdoor_ttl_cmd); - install_element (BGP_IPV4M_NODE, &bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_IPV4M_NODE, &bgp_network_mask_natural_backdoor_ttl_cmd); - - install_element (BGP_IPV4M_NODE, &no_bgp_network_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_backdoor_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); - -#ifdef HAVE_IPV6 - install_element (BGP_IPV6_NODE, &ipv6_bgp_network_ttl_cmd); - install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_ttl_cmd); -#endif } void diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d402e60ab6..38e5bd7296 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3679,19 +3679,6 @@ DEFUN (set_ip_nexthop_unchanged, return bgp_route_set_add (vty, vty->index, "ip next-hop", "unchanged"); } -DEFUN_DEPRECATED (no_set_ip_nexthop_peer, - no_set_ip_nexthop_peer_cmd, - "no set ip next-hop peer-address", - NO_STR - SET_STR - IP_STR - "Next hop address\n" - "Use peer address (for BGP only)\n") -{ - return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL); -} - - DEFUN (no_set_ip_nexthop, no_set_ip_nexthop_cmd, "no set ip next-hop", @@ -3714,6 +3701,15 @@ ALIAS (no_set_ip_nexthop, "Next hop address\n" "IP address of next hop\n") +ALIAS (no_set_ip_nexthop, + no_set_ip_nexthop_peer_cmd, + "no set ip next-hop peer-address", + NO_STR + SET_STR + IP_STR + "Next hop address\n" + "Use peer address (for BGP only)\n") + DEFUN (set_metric, set_metric_cmd, "set metric <0-4294967295>", @@ -4594,65 +4590,6 @@ ALIAS (no_set_originator_id, "BGP originator ID attribute\n" "IP address of originator\n") -DEFUN_DEPRECATED (set_pathlimit_ttl, - set_pathlimit_ttl_cmd, - "set pathlimit ttl <1-255>", - SET_STR - "BGP AS-Pathlimit attribute\n" - "Set AS-Path Hop-count TTL\n") -{ - return CMD_SUCCESS; -} - -DEFUN_DEPRECATED (no_set_pathlimit_ttl, - no_set_pathlimit_ttl_cmd, - "no set pathlimit ttl", - NO_STR - SET_STR - "BGP AS-Pathlimit attribute\n" - "Set AS-Path Hop-count TTL\n") -{ - return CMD_SUCCESS; -} - -ALIAS (no_set_pathlimit_ttl, - no_set_pathlimit_ttl_val_cmd, - "no set pathlimit ttl <1-255>", - NO_STR - MATCH_STR - "BGP AS-Pathlimit attribute\n" - "Set AS-Path Hop-count TTL\n") - -DEFUN_DEPRECATED (match_pathlimit_as, - match_pathlimit_as_cmd, - "match pathlimit as <1-65535>", - MATCH_STR - "BGP AS-Pathlimit attribute\n" - "Match Pathlimit AS number\n") -{ - return CMD_SUCCESS; -} - -DEFUN_DEPRECATED (no_match_pathlimit_as, - no_match_pathlimit_as_cmd, - "no match pathlimit as", - NO_STR - MATCH_STR - "BGP AS-Pathlimit attribute\n" - "Match Pathlimit AS number\n") -{ - return CMD_SUCCESS; -} - -ALIAS (no_match_pathlimit_as, - no_match_pathlimit_as_val_cmd, - "no match pathlimit as <1-65535>", - NO_STR - MATCH_STR - "BGP AS-Pathlimit attribute\n" - "Match Pathlimit ASN\n") - - /* Initialization of route map. */ void bgp_route_map_init (void) @@ -4757,6 +4694,7 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &set_ip_nexthop_unchanged_cmd); install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd); + install_element (RMAP_NODE, &no_set_ip_nexthop_peer_cmd); install_element (RMAP_NODE, &set_local_pref_cmd); install_element (RMAP_NODE, &no_set_local_pref_cmd); install_element (RMAP_NODE, &no_set_local_pref_val_cmd); @@ -4828,16 +4766,6 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &set_ipv6_nexthop_peer_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd); #endif /* HAVE_IPV6 */ - - /* AS-Pathlimit: functionality removed, commands kept for - * compatibility. - */ - install_element (RMAP_NODE, &set_pathlimit_ttl_cmd); - install_element (RMAP_NODE, &no_set_pathlimit_ttl_cmd); - install_element (RMAP_NODE, &no_set_pathlimit_ttl_val_cmd); - install_element (RMAP_NODE, &match_pathlimit_as_cmd); - install_element (RMAP_NODE, &no_match_pathlimit_as_cmd); - install_element (RMAP_NODE, &no_match_pathlimit_as_val_cmd); } void diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 911cc5953b..fd096eff22 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -597,17 +597,6 @@ DEFUN (no_auto_summary, return CMD_SUCCESS; } -DEFUN_DEPRECATED (neighbor_version, - neighbor_version_cmd, - NEIGHBOR_CMD "version (4|4-)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Set the BGP version to match a neighbor\n" - "Neighbor's BGP version\n") -{ - return CMD_SUCCESS; -} - /* "router bgp" commands. */ DEFUN (router_bgp, router_bgp_cmd, @@ -3255,30 +3244,6 @@ DEFUN (no_neighbor_shutdown, return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); } -/* Deprecated neighbor capability route-refresh. */ -DEFUN_DEPRECATED (neighbor_capability_route_refresh, - neighbor_capability_route_refresh_cmd, - NEIGHBOR_CMD2 "capability route-refresh", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise route-refresh capability to this neighbor\n") -{ - return CMD_SUCCESS; -} - -DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, - no_neighbor_capability_route_refresh_cmd, - NO_NEIGHBOR_CMD2 "capability route-refresh", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise route-refresh capability to this neighbor\n") -{ - return CMD_SUCCESS; -} - /* neighbor capability dynamic. */ DEFUN (neighbor_capability_dynamic, neighbor_capability_dynamic_cmd, @@ -4155,31 +4120,6 @@ ALIAS (no_neighbor_attr_unchanged, "As-path attribute\n" "Nexthop attribute\n") -/* For old version Zebra compatibility. */ -DEFUN_DEPRECATED (neighbor_transparent_as, - neighbor_transparent_as_cmd, - NEIGHBOR_CMD "transparent-as", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Do not append my AS number even peer is EBGP peer\n") -{ - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), - PEER_FLAG_AS_PATH_UNCHANGED); -} - -DEFUN_DEPRECATED (neighbor_transparent_nexthop, - neighbor_transparent_nexthop_cmd, - NEIGHBOR_CMD "transparent-nexthop", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Do not change nexthop even peer is EBGP peer\n") -{ - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), - PEER_FLAG_NEXTHOP_UNCHANGED); -} - /* EBGP multihop configuration. */ static int peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, @@ -12394,11 +12334,6 @@ bgp_vty_init (void) install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); - /* "transparent-as" and "transparent-nexthop" for old version - compatibility. */ - install_element (BGP_NODE, &neighbor_transparent_as_cmd); - install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); - /* "neighbor next-hop-self" commands. */ install_element (BGP_NODE, &neighbor_nexthop_self_cmd); install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); @@ -12582,10 +12517,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_shutdown_cmd); install_element (BGP_NODE, &no_neighbor_shutdown_cmd); - /* Deprecated "neighbor capability route-refresh" commands.*/ - install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); - install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); - /* "neighbor capability extended-nexthop" commands.*/ install_element (BGP_NODE, &neighbor_capability_enhe_cmd); install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); @@ -12685,9 +12616,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); - /* "neighbor version" commands. */ - install_element (BGP_NODE, &neighbor_version_cmd); - /* "neighbor interface" commands. */ install_element (BGP_NODE, &neighbor_interface_cmd); install_element (BGP_NODE, &no_neighbor_interface_cmd); From 0e10f22cd1765b2e062704c707b618489aa97aed Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 13 Nov 2015 21:52:13 +0000 Subject: [PATCH 05/12] Quagga default: BGP enable "maximum-paths 64" Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-8099 --- bgpd/bgp_mpath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 729b2c8cab..1e112f0ec7 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -28,7 +28,7 @@ #define BGP_MAXIMUM_MAXPATHS 255 /* BGP default maximum-paths */ -#define BGP_DEFAULT_MAXPATHS 1 +#define BGP_DEFAULT_MAXPATHS MULTIPATH_NUM /* Supplemental information linked to bgp_info for keeping track of * multipath selections, lazily allocated to save memory From 003c1ba05ab9f3e7e87bd20aa7ced12cadb7298a Mon Sep 17 00:00:00 2001 From: vivek Date: Sun, 15 Nov 2015 07:17:47 -0800 Subject: [PATCH 06/12] BGP: Fix the setting of link-local nexthops in some situations This patch addresses three main issues: a. Passing along the global IPv6 nexthop received from the EBGP peer to IBGP peers but setting the link-local IPv6 nexthop to ourselves when advertising EBGP-learnt routes to IBGP peers (in the absence of outbound route-map or other overrides). The fix is to not send a link-local IPv6 nexthop in this case. b. Passing along the link-local IPv6 nexthop received from one peer to another peer which is (or may be) on a different subnet. This violates the semantics of link-local IPv6 address. The fix is to set the nexthop to ourselves in the situation where the nexthop normally has to be passed but is a link-local IPv6 address. c. Different behavior wrt nexthop advertisement for BGP unnumbered peering if it is setup using link-local IPv6 address versus IPv4 /30 or /31. The fix is to make the behavior consistent as long as the interface config is the same in both cases. Signed-off-by: Vivek Venkatraman Reviewed-by: Daniel Walton Ticket: CM-7846, CM-8043 Reviewed By: CCR-3749 Testing Done: Manual testing, bgpsmoke (on 2.5-br) Note: Imported from 2.5-br patch bgpd-fix-link-local-nexthop-setting.patch --- bgpd/bgp_route.c | 16 ++++++++++++++-- bgpd/bgp_zebra.c | 29 +++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index cf88b3ee8a..02b629e2e5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1336,7 +1336,7 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, if (peer->sort == BGP_PEER_EBGP && attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)) { - if (ri->peer != bgp->peer_self && ! transparent + if (from != bgp->peer_self && ! transparent && ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) attr->flag &= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)); } @@ -1360,6 +1360,7 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, * the peer (group) is configured to receive link-local nexthop unchanged * and it is available in the prefix OR we're not reflecting the route and * the peer (group) to whom we're going to announce is on a shared network + * and this is either a self-originated route or the peer is EBGP. */ if (p->family == AF_INET6 || peer_cap_enhe(peer)) { @@ -1367,7 +1368,8 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, if ((CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) && IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_local)) || - (!reflect && peer->shared_network)) + (!reflect && peer->shared_network && + (from == bgp->peer_self || peer->sort == BGP_PEER_EBGP))) { attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; } @@ -1470,6 +1472,16 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, if (!paf) subgroup_announce_reset_nhop ((peer_cap_enhe(peer) ? AF_INET6 : p->family), attr); } + /* If IPv6/MP and nexthop does not have any override and happens to + * be a link-local address, reset it so that we don't pass along the + * source's link-local IPv6 address to recipients who may not be on + * the same interface. + */ + if (p->family == AF_INET6 || peer_cap_enhe(peer)) + { + if (IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_global)) + subgroup_announce_reset_nhop (AF_INET6, attr); + } } return 1; diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 410bc8564b..70d59a3e23 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -885,11 +885,24 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, /* IPv6 nexthop*/ ret = if_get_ipv6_global (ifp, &nexthop->v6_global); - /* There is no global nexthop. */ if (!ret) - if_get_ipv6_local (ifp, &nexthop->v6_global); + { + /* There is no global nexthop. Use link-local address as both the + * global and link-local nexthop. In this scenario, the expectation + * for interop is that the network admin would use a route-map to + * specify the global IPv6 nexthop. + */ + if_get_ipv6_local (ifp, &nexthop->v6_global); + memcpy (&nexthop->v6_local, &nexthop->v6_global, + IPV6_MAX_BYTELEN); + } else if_get_ipv6_local (ifp, &nexthop->v6_local); + + if (if_lookup_by_ipv4 (&remote->sin.sin_addr)) + peer->shared_network = 1; + else + peer->shared_network = 0; #endif /* HAVE_IPV6 */ } @@ -934,13 +947,13 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, memcpy (&nexthop->v6_local, &local->sin6.sin6_addr, IPV6_MAX_BYTELEN); } - } - if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr) || - if_lookup_by_ipv6 (&remote->sin6.sin6_addr, remote->sin6.sin6_scope_id)) - peer->shared_network = 1; - else - peer->shared_network = 0; + if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr) || + if_lookup_by_ipv6 (&remote->sin6.sin6_addr, remote->sin6.sin6_scope_id)) + peer->shared_network = 1; + else + peer->shared_network = 0; + } /* KAME stack specific treatment. */ #ifdef KAME From a219b2952ae2f3b47d674d47f48e53c6c1e4bc70 Mon Sep 17 00:00:00 2001 From: vivek Date: Sun, 15 Nov 2015 07:36:50 -0800 Subject: [PATCH 07/12] Zebra: Ensure correct route is used for redistribute delete. After the optimization introduced by patch zebra-redist-update-fix.patch which implements "replace" semantics for redistributed routes instead of a delete followed by add, the code was passing an incorrect route for redistribute deletion in one case. This is mainly inconsequential as of now as the deletion process primarily cares about only the destination, but the code needs to be corrected and that is done here. Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Fixes: zebra-redist-update-fix.patch Ticket: CM-8112 Reviewed By: CCR-3760 Testing Done: Trivial Note: 1. Needs changes after IPv6 route replace patches are included. 2. Imported from 2.5-br patch zebra-redist-delete-fix.patch --- zebra/zebra_rib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 78c6c831b5..481c9e0d33 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1702,8 +1702,9 @@ rib_process (struct route_node *rn) assert (fib); rib_uninstall_kernel (rn, fib); } - /* if "select", the earlier redist delete wouldn't have happened */ - redistribute_delete(&rn->p, select); + /* if "select", the earlier redist delete wouldn't have happened */ + if (fib) + redistribute_delete(&rn->p, fib); } UNSET_FLAG(select->flags, ZEBRA_FLAG_CHANGED); } From c52d605046bb0e84775c4c18f992598e1e37f2ba Mon Sep 17 00:00:00 2001 From: vivek Date: Sun, 15 Nov 2015 09:57:34 -0800 Subject: [PATCH 08/12] BGP: Handle change to nexthop correctly When a nexthop change is received and processed, the change flags are not examined correctly and route change flags not updated correctly. Fix to ensure correct handling. Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Ticket: CM-8141 Reviewed By: CCR-3773 Testing Done: Manual verification Note: Imported from 2.5-br patch bgpd-nht-fix-change-handling.patch --- bgpd/bgp_nht.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 1824771e3a..197dd87585 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -668,9 +668,11 @@ evaluate_paths (struct bgp_nexthop_cache *bnc) else if (path->extra) path->extra->igpmetric = 0; - if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_METRIC_CHANGED) || - CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CHANGED)) + if (CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_METRIC_CHANGED) || + CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED)) SET_FLAG(path->flags, BGP_INFO_IGP_CHANGED); + else + UNSET_FLAG (path->flags, BGP_INFO_IGP_CHANGED); bgp_process(bgp, rn, afi, SAFI_UNICAST); } From 25c38b240e56e41c0742c5260e72c1dd30dffbc7 Mon Sep 17 00:00:00 2001 From: vivek Date: Sun, 15 Nov 2015 10:21:12 -0800 Subject: [PATCH 09/12] BGP: Fix nexthop registration churn When a BGP nexthop is registered for resolution, if it is learnt from an EBGP peer and other conditions warrant (non-multihop peer and connected check is not disabled), the registration includes a flag that indicates that the nexthop must be resolved only if it is directly connected. In peculiar situations - e.g., third-party nexthop or policy configuration - the same nexthop could be learnt from an IBGP peer, and in general, nexthops learnt from IBGP peers can be resolved over any route. This scenario was causing a churn in the nexthop registration with the 'must-be-connected' flag being repeatedly toggled as routes are received from both peers. The registrations would in turn trigger significant processing. The fix is to treat 'must-be-connected' as an overriding condition. The repeated registration and related processing was also causing heavy memory usage by BGP - for memory buffers used to hold registration information. This fix will ensure that is no longer the case. Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Ticket: CM-8005, CM-8013 Reviewed By: CCR-3772 Testing Done: Manual, bgpsmoke (on 2.5-br) --- bgpd/bgp_nht.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 197dd87585..25969da3d2 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -191,13 +191,23 @@ bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri, UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID); } } + /* When nexthop is already known, but now requires 'connected' resolution, + * re-register it. The reverse scenario where the nexthop currently requires + * 'connected' resolution does not need a re-register (i.e., we treat + * 'connected-required' as an override) except in the scenario where this + * is actually a case of tracking a peer for connectivity (e.g., after + * disable connected-check). + * NOTE: We don't track the number of paths separately for 'connected- + * required' vs 'connected-not-required' as this change is not a common + * scenario. + */ else if (connected && ! CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)) { SET_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED); UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED); UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID); } - else if (!connected && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)) + else if (peer && !connected && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)) { UNSET_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED); UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED); From d44ca835fc8000889a92b98af5a22b8139b2a3b7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 16 Nov 2015 12:48:07 -0800 Subject: [PATCH 10/12] Zebra: Remove reliance on NEXTHOP_TYPE_IPV4_ONLINK Zebra already knows if an interface is unnumbered or not. This is communicated to OSPF. OSPF would only send a NEXTHOP_TYPE_IPV4_ONLINK *if* the path was unnumbered, which it learns from Zebra. As such, Have OSPF use the normal NEXTHOP_TYPE_IPV4_IFINDEX type for unnumbered paths. In Zebra, if the ifindex recieved is unnumbered then assume that the link is NEXTHOP_FLAG_ONLINK. Ticket: CM-8145 Reviewed-by: CCR-3771 Testing: See bug Signed-off-by: Donald Sharp --- lib/zclient.c | 18 +--------------- lib/zclient.h | 1 - ospfd/ospf_zebra.c | 53 ++++++++++++++++++---------------------------- zebra/connected.c | 15 +++++++++++++ zebra/connected.h | 2 ++ zebra/rib.h | 2 -- zebra/zebra_rib.c | 38 +++++++++++++++------------------ zebra/zserv.c | 7 +----- 8 files changed, 57 insertions(+), 79 deletions(-) diff --git a/lib/zclient.c b/lib/zclient.c index f1486f4ade..512abc24d7 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -611,23 +611,7 @@ zapi_ipv4_route (u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p, stream_write (s, (u_char *) & p->prefix, psize); /* Nexthop, ifindex, distance and metric information. */ - /* ZAPI_MESSAGE_ONLINK implies interleaving */ - if (CHECK_FLAG (api->message, ZAPI_MESSAGE_ONLINK)) - { - /* ZAPI_MESSAGE_NEXTHOP is required for proper receiving */ - assert (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP)); - /* 64-bit data units, interleaved between nexthop[] and ifindex[] */ - assert (api->nexthop_num == api->ifindex_num); - stream_putc (s, api->nexthop_num * 2); - for (i = 0; i < api->nexthop_num; i++) - { - stream_putc (s, ZEBRA_NEXTHOP_IPV4_ONLINK); - stream_put_in_addr (s, api->nexthop[i]); - stream_putc (s, ZEBRA_NEXTHOP_IFINDEX); - stream_putl (s, api->ifindex[i]); - } - } - else if (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP)) + if (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP)) { /* traditional 32-bit data units */ if (CHECK_FLAG (api->flags, ZEBRA_FLAG_BLACKHOLE)) diff --git a/lib/zclient.h b/lib/zclient.h index 4d855a426a..949d42365d 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -115,7 +115,6 @@ struct zclient #define ZAPI_MESSAGE_DISTANCE 0x04 #define ZAPI_MESSAGE_METRIC 0x08 #define ZAPI_MESSAGE_TAG 0x10 -#define ZAPI_MESSAGE_ONLINK 0x20 /* Zserv protocol message header */ struct zserv_header diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 4408627fd9..0d77e8d3a7 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -387,38 +387,27 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct ospf_route *or) for (ALL_LIST_ELEMENTS_RO (or->paths, node, path)) { #ifdef HAVE_NETLINK - if (path->unnumbered) - { - stream_putc (s, ZEBRA_NEXTHOP_IPV4_ONLINK); - stream_put_in_addr (s, &path->nexthop); - if (path->ifindex) - stream_putl (s, path->ifindex); - else - stream_putl (s, 0); - } - else - { - if (path->nexthop.s_addr != INADDR_ANY && - path->ifindex != 0) - { - stream_putc (s, ZEBRA_NEXTHOP_IPV4_IFINDEX); - stream_put_in_addr (s, &path->nexthop); - stream_putl (s, path->ifindex); - } - else if (path->nexthop.s_addr != INADDR_ANY) - { - stream_putc (s, ZEBRA_NEXTHOP_IPV4); - stream_put_in_addr (s, &path->nexthop); - } - else - { - stream_putc (s, ZEBRA_NEXTHOP_IFINDEX); - if (path->ifindex) - stream_putl (s, path->ifindex); - else - stream_putl (s, 0); - } - } + if (path->unnumbered || + (path->nexthop.s_addr != INADDR_ANY && + path->ifindex != 0)) + { + stream_putc (s, ZEBRA_NEXTHOP_IPV4_IFINDEX); + stream_put_in_addr (s, &path->nexthop); + stream_putl (s, path->ifindex); + } + else if (path->nexthop.s_addr != INADDR_ANY) + { + stream_putc (s, ZEBRA_NEXTHOP_IPV4); + stream_put_in_addr (s, &path->nexthop); + } + else + { + stream_putc (s, ZEBRA_NEXTHOP_IFINDEX); + if (path->ifindex) + stream_putl (s, path->ifindex); + else + stream_putl (s, 0); + } #else /* HAVE_NETLINK */ if (path->nexthop.s_addr != INADDR_ANY && path->ifindex != 0) diff --git a/zebra/connected.c b/zebra/connected.c index 0d2407a3e0..b6dbad39bd 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -544,3 +544,18 @@ connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address, rib_update_static(ifp->vrf_id); } #endif /* HAVE_IPV6 */ + +int +connected_is_unnumbered (struct interface *ifp) +{ + struct connected *connected; + struct listnode *node; + + for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, connected)) + { + if (CHECK_FLAG (connected->conf, ZEBRA_IFC_REAL) && + connected->address->family == AF_INET) + return CHECK_FLAG(connected->flags, ZEBRA_IFA_UNNUMBERED); + } + return 0; +} diff --git a/zebra/connected.h b/zebra/connected.h index 55709440c6..f35f47fb6a 100644 --- a/zebra/connected.h +++ b/zebra/connected.h @@ -55,4 +55,6 @@ extern void connected_down_ipv6 (struct interface *ifp, struct connected *); #endif /* HAVE_IPV6 */ +extern int connected_is_unnumbered (struct interface *); + #endif /*_ZEBRA_CONNECTED_H */ diff --git a/zebra/rib.h b/zebra/rib.h index ca1e97a378..3656646c9b 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -385,8 +385,6 @@ extern struct nexthop *nexthop_ifname_add (struct rib *, char *); extern struct nexthop *nexthop_blackhole_add (struct rib *); extern struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *, struct in_addr *); -extern struct nexthop * nexthop_ipv4_ifindex_ol_add (struct rib *, const struct in_addr *, - const struct in_addr *, const unsigned); extern struct nexthop *nexthop_ipv4_ifindex_add (struct rib *, struct in_addr *, struct in_addr *, diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 481c9e0d33..0fa9a79c31 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -45,6 +45,7 @@ #include "zebra/zebra_fpm.h" #include "zebra/zebra_rnh.h" #include "zebra/interface.h" +#include "zebra/connected.h" /* Default rtm_table for all clients */ extern struct zebra_t zebrad; @@ -317,6 +318,7 @@ nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4, struct in_addr *src, unsigned int ifindex) { struct nexthop *nexthop; + struct interface *ifp; nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop)); nexthop->type = NEXTHOP_TYPE_IPV4_IFINDEX; @@ -324,28 +326,16 @@ nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4, if (src) nexthop->src.ipv4 = *src; nexthop->ifindex = ifindex; + ifp = if_lookup_by_index (nexthop->ifindex); + if (connected_is_unnumbered(ifp)) { + SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); + } nexthop_add (rib, nexthop); return nexthop; } -struct nexthop * -nexthop_ipv4_ifindex_ol_add (struct rib *rib, const struct in_addr *ipv4, - const struct in_addr *src, const unsigned int ifindex) -{ - struct nexthop *nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop)); - - nexthop->type = NEXTHOP_TYPE_IPV4_IFINDEX; - IPV4_ADDR_COPY (&nexthop->gate.ipv4, ipv4); - if (src) - IPV4_ADDR_COPY (&nexthop->src.ipv4, src); - nexthop->ifindex = ifindex; - SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); - nexthop_add (rib, nexthop); - return nexthop; -} - struct nexthop * nexthop_ipv6_add (struct rib *rib, struct in6_addr *ipv6) { @@ -456,15 +446,21 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set, if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FILTERED)) return 0; - /* onlink flag is an indication that we need to only check that - * the link is up, we won't find the GW address in the routing - * table. + /* + * Check to see if we should trust the passed in information + * for UNNUMBERED interfaces as that we won't find the GW + * address in the routing table. */ if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK)) { ifp = if_lookup_by_index (nexthop->ifindex); - if (ifp && if_is_operative(ifp)) - return 1; + if (ifp && connected_is_unnumbered(ifp)) + { + if (if_is_operative(ifp)) + return 1; + else + return 0; + } else return 0; } diff --git a/zebra/zserv.c b/zebra/zserv.c index cb823a0c19..3f7d73285f 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1069,7 +1069,7 @@ zread_ipv4_add (struct zserv *client, u_short length, vrf_id_t vrf_id) struct stream *s; unsigned int ifindex; u_char ifname_len; - safi_t safi; + safi_t safi; int ret; /* Get input stream. */ @@ -1130,11 +1130,6 @@ zread_ipv4_add (struct zserv *client, u_short length, vrf_id_t vrf_id) case ZEBRA_NEXTHOP_BLACKHOLE: nexthop_blackhole_add (rib); break; - case ZEBRA_NEXTHOP_IPV4_ONLINK: - nexthop.s_addr = stream_get_ipv4 (s); - ifindex = stream_getl (s); - nexthop_ipv4_ifindex_ol_add (rib, &nexthop, NULL, ifindex); - break; } } } From 7717b1837cf844f62f36c1ca4ee74b61735232a8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 17 Nov 2015 02:09:57 +0000 Subject: [PATCH 11/12] BGP: crash in update_subgroup_merge() Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Reviewed-by: Vivek Venkatraman Ticket: CM-8191 On my hard node I have a route to 10.0.0.0/22 via eth0, I then learn 10.0.0.8/32 from peer 10.0.0.8 with a nexthop of 10.0.0.8: superm-redxp-05# show ip bgp 10.0.0.8/32 BGP routing table entry for 10.0.0.8/32 Paths: (1 available, no best path) Not advertised to any peer 80 10.0.0.8 from r8(swp6) (10.0.0.8) Origin IGP, metric 0, localpref 100, valid, external AddPath ID: RX 0, TX 9 Last update: Thu Nov 12 14:00:00 2015 superm-redxp-05# I do a lookup for the nexthop and see that 10.0.0.8 is reachable via my eth0 10.0.0.22 so I select a bestpath and install the route. At this point my route to 10.0.0.8 is a /32 that resolves via itself, NHT sees that this is illegal and flags the nexthop as inaccessible. superm-redxp-05# show ip bgp 10.0.0.8/32 BGP routing table entry for 10.0.0.8/32 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to non peer-group peers: r6(swp4) r7(swp5) r8(swp6) r2(10.1.2.2) r3(10.1.3.2) r4(10.1.4.2) 80 10.0.0.8 (inaccessible) from r8(swp6) (10.0.0.8) Origin IGP, metric 0, localpref 100, invalid, external, bestpath-from-AS 80, best AddPath ID: RX 0, TX 9 Last update: Thu Nov 12 14:00:00 2015 superm-redxp-05# at which point we withdraw the route, things churn, we relearn it and go through the whole process over and over again. We end up advertising and withdrawing this route about 9 times a second!! This exposed a crash in the update-group code where we try to merge two sub-groups but the assert on adj_count fails because the timing worked out where one had advertised 10.0.0.8/32 but the other had not. NOTE: the race condition described above will be resolved via a separate patch. --- bgpd/bgp_updgrp.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index a250a7d4bd..3ba476d086 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -998,7 +998,7 @@ update_subgroup_find (struct update_group *updgrp, struct peer_af *paf) * Returns TRUE if this subgroup is in a state that allows it to be * merged into another subgroup. */ -static inline int +static int update_subgroup_ready_for_merge (struct update_subgroup *subgrp) { @@ -1032,7 +1032,7 @@ update_subgroup_ready_for_merge (struct update_subgroup *subgrp) * Returns TRUE if the first subgroup can merge into the second * subgroup. */ -static inline int +static int update_subgroup_can_merge_into (struct update_subgroup *subgrp, struct update_subgroup *target) { @@ -1051,22 +1051,10 @@ update_subgroup_can_merge_into (struct update_subgroup *subgrp, CHECK_FLAG(target->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) return 0; - /* - * If there are any adv entries on the target, then its adj-out (the - * set of advertised routes) does not match that of the other - * subgrp, and we cannot merge the two. - * - * The adj-out is used when generating a route refresh to a peer in - * a subgroup. If it is not accurate, say it is missing an entry, we - * may miss sending a withdraw for an entry as part of a refresh. - */ - if (!advertise_list_is_empty (target)) + if (subgrp->adj_count != target->adj_count) return 0; - if (update_subgroup_needs_refresh (target)) - return 0; - - return 1; + return update_subgroup_ready_for_merge (target); } /* From 7c5d2b76c685eaa31e81013017edc62ffaeb2381 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 17 Nov 2015 08:13:23 -0800 Subject: [PATCH 12/12] Quagga: Set MULTIPATH_NUM to 64 when user specifies 0 from cli The code has tests to see if the MULTIPATH_NUM == 0 and to treat it like the user has entered 'Maximum PATHS'. This 0 is treated as 64 internally. Remove this dependency and setup MULTIPATH_NUM to 64 when --enable-multipath=0 from the configure cli. Signed-off-by: Donald Sharp Reviewed-by: Daniel Walton --- bgpd/bgp_vty.c | 2 +- configure.ac | 5 ++++- zebra/rt_netlink.c | 2 +- zebra/zebra_fpm_netlink.c | 7 +++---- zebra/zserv.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fd096eff22..de6f4d8b56 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1000,7 +1000,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, bgp_recalculate_all_bestpaths (bgp); - if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM)) + if (maxpaths > MULTIPATH_NUM) vty_out (vty, "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s", maxpaths, MULTIPATH_NUM, VTY_NEWLINE); diff --git a/configure.ac b/configure.ac index e44823262c..40c11e7fb7 100755 --- a/configure.ac +++ b/configure.ac @@ -415,7 +415,10 @@ AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files) MULTIPATH_NUM=1 case "${enable_multipath}" in - [[0-9]|[1-9][0-9]]) + 0) + MULTIPATH_NUM=64 + ;; + [[1-9]|[1-9][0-9]]) MULTIPATH_NUM="${enable_multipath}" ;; "") diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index cad367808d..a4da7f079d 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1987,7 +1987,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, nexthop_num = 0; for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) { - if (MULTIPATH_NUM != 0 && nexthop_num >= MULTIPATH_NUM) + if (nexthop_num >= MULTIPATH_NUM) break; if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 1eec867041..c53d282b63 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -137,10 +137,9 @@ typedef struct netlink_route_info_t_ int num_nhs; /* - * Nexthop structures. We keep things simple for now by enforcing a - * maximum of 64 in case MULTIPATH_NUM is 0; + * Nexthop structures */ - netlink_nh_info_t nhs[MAX (MULTIPATH_NUM, 64)]; + netlink_nh_info_t nhs[MULTIPATH_NUM]; union g_addr *pref_src; } netlink_route_info_t; @@ -288,7 +287,7 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd, for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) { - if (MULTIPATH_NUM != 0 && ri->num_nhs >= MULTIPATH_NUM) + if (ri->num_nhs >= MULTIPATH_NUM) break; if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) diff --git a/zebra/zserv.c b/zebra/zserv.c index 3f7d73285f..87fa5ce49c 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1042,7 +1042,7 @@ zread_interface_delete (struct zserv *client, u_short length, vrf_id_t vrf_id) void zserv_nexthop_num_warn (const char *caller, const struct prefix *p, const u_char nexthop_num) { - if ((MULTIPATH_NUM != 0) && (nexthop_num > MULTIPATH_NUM)) + if (nexthop_num > MULTIPATH_NUM) { char buff[80]; prefix2str(p, buff, 80);