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_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..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 @@ -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_nht.c b/bgpd/bgp_nht.c index 1824771e3a..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); @@ -668,9 +678,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); } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index eae8f61645..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; @@ -1637,12 +1649,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); } @@ -4262,129 +4282,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 @@ -7987,6 +7884,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, @@ -7997,6 +7902,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); } @@ -8105,6 +8011,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); } @@ -8212,6 +8119,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); } @@ -8308,6 +8216,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); } @@ -8323,6 +8232,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); } @@ -8337,6 +8247,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 @@ -8466,6 +8377,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); } @@ -8480,6 +8392,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); } @@ -8581,6 +8494,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); } @@ -8595,6 +8509,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); } @@ -8695,6 +8610,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); } @@ -8709,6 +8625,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); } @@ -8903,6 +8820,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); } @@ -8916,6 +8834,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); } @@ -9650,6 +9569,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); } @@ -9881,6 +9801,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); } @@ -9963,6 +9884,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); } @@ -10043,6 +9965,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); } @@ -10231,6 +10154,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); } @@ -10244,6 +10168,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); } @@ -10282,6 +10207,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); } @@ -10296,6 +10222,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 */ @@ -10425,6 +10352,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); } @@ -10439,6 +10367,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); } @@ -11711,6 +11640,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 */ @@ -12350,6 +12280,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); } @@ -12830,6 +12761,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); } @@ -14276,54 +14208,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_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); } /* diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 6bbb5d8dd3..de6f4d8b56 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, @@ -1011,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); @@ -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); @@ -13249,6 +13177,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); 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 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)) { 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/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_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); 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/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/zebra_rib.c b/zebra/zebra_rib.c index 78c6c831b5..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; } @@ -1702,8 +1698,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); } diff --git a/zebra/zserv.c b/zebra/zserv.c index cb823a0c19..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); @@ -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; } } }