diff options
| -rw-r--r-- | bfdd/bfd.c | 14 | ||||
| -rw-r--r-- | bgpd/bgp_conditional_adv.c | 78 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 20 | ||||
| -rw-r--r-- | bgpd/bgp_route.h | 2 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp_adv.c | 4 | ||||
| -rw-r--r-- | doc/user/isisd.rst | 7 | ||||
| -rw-r--r-- | eigrpd/eigrp_metric.c | 21 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 44 | ||||
| -rw-r--r-- | lib/if.c | 3 | ||||
| -rw-r--r-- | pceplib/test/pcep_msg_messages_test.c | 2 | ||||
| -rw-r--r-- | pimd/pim_nb_config.c | 9 | ||||
| -rw-r--r-- | tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf | 1 | ||||
| -rw-r--r-- | tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py | 2 |
13 files changed, 89 insertions, 118 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index fbe0436b50..588c9fc00f 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1424,7 +1424,7 @@ int strtosa(const char *addr, struct sockaddr_any *sa) void integer2timestr(uint64_t time, char *buf, size_t buflen) { - unsigned int year, month, day, hour, minute, second; + uint64_t year, month, day, hour, minute, second; int rv; #define MINUTES (60) @@ -1436,7 +1436,7 @@ void integer2timestr(uint64_t time, char *buf, size_t buflen) year = time / YEARS; time -= year * YEARS; - rv = snprintf(buf, buflen, "%u year(s), ", year); + rv = snprintfrr(buf, buflen, "%" PRIu64 " year(s), ", year); buf += rv; buflen -= rv; } @@ -1444,7 +1444,7 @@ void integer2timestr(uint64_t time, char *buf, size_t buflen) month = time / MONTHS; time -= month * MONTHS; - rv = snprintf(buf, buflen, "%u month(s), ", month); + rv = snprintfrr(buf, buflen, "%" PRIu64 " month(s), ", month); buf += rv; buflen -= rv; } @@ -1452,7 +1452,7 @@ void integer2timestr(uint64_t time, char *buf, size_t buflen) day = time / DAYS; time -= day * DAYS; - rv = snprintf(buf, buflen, "%u day(s), ", day); + rv = snprintfrr(buf, buflen, "%" PRIu64 " day(s), ", day); buf += rv; buflen -= rv; } @@ -1460,7 +1460,7 @@ void integer2timestr(uint64_t time, char *buf, size_t buflen) hour = time / HOURS; time -= hour * HOURS; - rv = snprintf(buf, buflen, "%u hour(s), ", hour); + rv = snprintfrr(buf, buflen, "%" PRIu64 " hour(s), ", hour); buf += rv; buflen -= rv; } @@ -1468,12 +1468,12 @@ void integer2timestr(uint64_t time, char *buf, size_t buflen) minute = time / MINUTES; time -= minute * MINUTES; - rv = snprintf(buf, buflen, "%u minute(s), ", minute); + rv = snprintfrr(buf, buflen, "%" PRIu64 " minute(s), ", minute); buf += rv; buflen -= rv; } second = time % MINUTES; - snprintf(buf, buflen, "%u second(s)", second); + snprintfrr(buf, buflen, "%" PRIu64 " second(s)", second); } const char *bs_to_string(const struct bfd_session *bs) diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index c0dd3d6f81..e5a4b0e9f7 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -82,7 +82,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi, struct peer_af *paf; const struct prefix *dest_p; struct update_subgroup *subgrp; - struct attr dummy_attr = {0}, attr = {0}; + struct attr advmap_attr = {0}, attr = {0}; struct bgp_path_info_extra path_extra = {0}; route_map_result_t ret; @@ -110,55 +110,53 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi, assert(dest_p); for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) { - dummy_attr = *pi->attr; + advmap_attr = *pi->attr; /* Fill temp path_info */ prep_for_rmap_apply(&path, &path_extra, dest, pi, - pi->peer, &dummy_attr); + pi->peer, &advmap_attr); - RESET_FLAG(dummy_attr.rmap_change_flags); + RESET_FLAG(advmap_attr.rmap_change_flags); ret = route_map_apply(rmap, dest_p, &path); - bgp_attr_flush(&dummy_attr); - - if (ret != RMAP_PERMITMATCH) + if (ret != RMAP_PERMITMATCH || + !bgp_check_selected(pi, peer, addpath_capable, afi, + safi)) { + bgp_attr_flush(&advmap_attr); continue; + } - if (bgp_check_selected(pi, peer, addpath_capable, afi, - safi)) { - /* Skip route-map checks in - * subgroup_announce_check while executing from - * the conditional advertise scanner process. - * otherwise when route-map is also configured - * on same peer, routes in advertise-map may not - * be advertised as expected. + /* Skip route-map checks in + * subgroup_announce_check while executing from + * the conditional advertise scanner process. + * otherwise when route-map is also configured + * on same peer, routes in advertise-map may not + * be advertised as expected. + */ + if (update_type == ADVERTISE && + subgroup_announce_check(dest, pi, subgrp, dest_p, + &attr, &advmap_attr)) { + bgp_adj_out_set_subgroup(dest, subgrp, &attr, + pi); + } else { + /* If default originate is enabled for + * the peer, do not send explicit + * withdraw. This will prevent deletion + * of default route advertised through + * default originate. */ - if ((update_type == ADVERTISE) - && subgroup_announce_check(dest, pi, subgrp, - dest_p, &attr, - true)) - bgp_adj_out_set_subgroup(dest, subgrp, - &attr, pi); - else { - /* If default originate is enabled for - * the peer, do not send explicit - * withdraw. This will prevent deletion - * of default route advertised through - * default originate. - */ - if (CHECK_FLAG( - peer->af_flags[afi][safi], - PEER_FLAG_DEFAULT_ORIGINATE) - && is_default_prefix(dest_p)) - break; - - bgp_adj_out_unset_subgroup( - dest, subgrp, 1, - bgp_addpath_id_for_peer( - peer, afi, safi, - &pi->tx_addpath)); - } + if (CHECK_FLAG(peer->af_flags[afi][safi], + PEER_FLAG_DEFAULT_ORIGINATE) && + is_default_prefix(dest_p)) + break; + + bgp_adj_out_unset_subgroup( + dest, subgrp, 1, + bgp_addpath_id_for_peer( + peer, afi, safi, + &pi->tx_addpath)); } + bgp_attr_flush(&advmap_attr); } } UNSET_FLAG(subgrp->sflags, SUBGRP_STATUS_TABLE_REPARSING); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 8311cb207c..0238e36cdf 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1836,7 +1836,7 @@ void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr) bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, struct update_subgroup *subgrp, const struct prefix *p, struct attr *attr, - bool skip_rmap_check) + struct attr *post_attr) { struct bgp_filter *filter; struct peer *from; @@ -2067,8 +2067,16 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, } } - /* For modify attribute, copy it to temporary structure. */ - *attr = *piattr; + /* For modify attribute, copy it to temporary structure. + * post_attr comes from BGP conditional advertisements, where + * attributes are already processed by advertise-map route-map, + * and this needs to be saved instead of overwriting from the + * path attributes. + */ + if (post_attr) + *attr = *post_attr; + else + *attr = *piattr; /* If local-preference is not set. */ if ((peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED) @@ -2162,8 +2170,8 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, bgp_peer_as_override(bgp, afi, safi, peer, attr); /* Route map & unsuppress-map apply. */ - if (!skip_rmap_check - && (ROUTE_MAP_OUT_NAME(filter) || bgp_path_suppressed(pi))) { + if (!post_attr && + (ROUTE_MAP_OUT_NAME(filter) || bgp_path_suppressed(pi))) { struct bgp_path_info rmap_path = {0}; struct bgp_path_info_extra dummy_rmap_path_extra = {0}; struct attr dummy_attr = {0}; @@ -2699,7 +2707,7 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp, if (selected) { if (subgroup_announce_check(dest, selected, subgrp, p, &attr, - false)) { + NULL)) { /* Route is selected, if the route is already installed * in FIB, then it is advertised */ diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 317995594a..a8ec2dc907 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -785,7 +785,7 @@ extern bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, struct update_subgroup *subgrp, const struct prefix *p, struct attr *attr, - bool skip_rmap_check); + struct attr *post_attr); extern void bgp_peer_clear_node_queue_drain_immediate(struct peer *peer); extern void bgp_process_queues_drain_immediate(void); diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index dd140e48af..97b32643b0 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -691,7 +691,7 @@ void subgroup_announce_table(struct update_subgroup *subgrp, safi)) { if (subgroup_announce_check(dest, ri, subgrp, dest_p, &attr, - false)) { + NULL)) { /* Check if route can be advertised */ if (advertise) { if (!bgp_check_withdrawal(bgp, @@ -910,7 +910,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) if (subgroup_announce_check( dest, pi, subgrp, bgp_dest_get_prefix(dest), - &attr, false)) + &attr, NULL)) bgp_adj_out_set_subgroup( dest, subgrp, &attr, pi); diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst index 5d53f60f93..f7d42d8200 100644 --- a/doc/user/isisd.rst +++ b/doc/user/isisd.rst @@ -396,13 +396,6 @@ Known limitations: may not exceed 65535. Optionally sets also the Segment Routing Local Block. The negative command always unsets both. -.. clicmd:: segment-routing local-block (16-1048575) (16-1048575) - - Set the Segment Routing Local Block i.e. the label range used by MPLS - to store label in the MPLS FIB for Adjacency SID. Note that the block size - may not exceed 65535. This command is deprecated in favor of the combined - 'segment-routing global-block A B local-block C D' command. - .. clicmd:: segment-routing node-msd (1-16) Set the Maximum Stack Depth supported by the router. The value depend of the diff --git a/eigrpd/eigrp_metric.c b/eigrpd/eigrp_metric.c index ea62f9d1be..7ccafd4fa8 100644 --- a/eigrpd/eigrp_metric.c +++ b/eigrpd/eigrp_metric.c @@ -86,19 +86,24 @@ eigrp_metric_t eigrp_calculate_metrics(struct eigrp *eigrp, */ if (eigrp->k_values[0]) - composite += (eigrp->k_values[0] * metric.bandwidth); + composite += ((eigrp_metric_t)eigrp->k_values[0] * + (eigrp_metric_t)metric.bandwidth); if (eigrp->k_values[1]) - composite += ((eigrp->k_values[1] * metric.bandwidth) - / (256 - metric.load)); + composite += (((eigrp_metric_t)eigrp->k_values[1] * + (eigrp_metric_t)metric.bandwidth) / + (256 - metric.load)); if (eigrp->k_values[2]) - composite += (eigrp->k_values[2] * metric.delay); + composite += ((eigrp_metric_t)eigrp->k_values[2] * + (eigrp_metric_t)metric.delay); if (eigrp->k_values[3] && !eigrp->k_values[4]) - composite *= eigrp->k_values[3]; + composite *= (eigrp_metric_t)eigrp->k_values[3]; if (!eigrp->k_values[3] && eigrp->k_values[4]) - composite *= (eigrp->k_values[4] / metric.reliability); + composite *= ((eigrp_metric_t)eigrp->k_values[4] / + (eigrp_metric_t)metric.reliability); if (eigrp->k_values[3] && eigrp->k_values[4]) - composite *= ((eigrp->k_values[4] / metric.reliability) - + eigrp->k_values[3]); + composite *= (((eigrp_metric_t)eigrp->k_values[4] / + (eigrp_metric_t)metric.reliability) + + (eigrp_metric_t)eigrp->k_values[3]); composite = (composite <= EIGRP_METRIC_MAX) ? composite : EIGRP_METRIC_MAX; diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 089ad5747c..c23b0f0dc1 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1560,48 +1560,6 @@ void cli_show_isis_label_blocks(struct vty *vty, const struct lyd_node *dnode, } /* - * XPath: /frr-isisd:isis/instance/segment-routing/srlb - */ -DEFPY_HIDDEN( - isis_sr_local_block_label_range, isis_sr_local_block_label_range_cmd, - "segment-routing local-block (16-1048575)$lower_bound (16-1048575)$upper_bound", - SR_STR - "Segment Routing Local Block label range\n" - "The lower bound of the block\n" - "The upper bound of the block (block size may not exceed 65535)\n") -{ -#if CONFDATE > 20220217 -CPP_NOTICE("Use of the local-block command is deprecated") -#endif - nb_cli_enqueue_change(vty, - "./segment-routing/label-blocks/srlb/lower-bound", - NB_OP_MODIFY, lower_bound_str); - nb_cli_enqueue_change(vty, - "./segment-routing/label-blocks/srlb/upper-bound", - NB_OP_MODIFY, upper_bound_str); - - return nb_cli_apply_changes(vty, NULL); -} - -DEFPY_HIDDEN(no_isis_sr_local_block_label_range, - no_isis_sr_local_block_label_range_cmd, - "no segment-routing local-block [(16-1048575) (16-1048575)]", - NO_STR SR_STR - "Segment Routing Local Block label range\n" - "The lower bound of the block\n" - "The upper bound of the block (block size may not exceed 65535)\n") -{ - nb_cli_enqueue_change(vty, - "./segment-routing/label-blocks/srlb/lower-bound", - NB_OP_MODIFY, NULL); - nb_cli_enqueue_change(vty, - "./segment-routing/label-blocks/srlb/upper-bound", - NB_OP_MODIFY, NULL); - - return nb_cli_apply_changes(vty, NULL); -} - -/* * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd */ DEFPY_YANG (isis_sr_node_msd, @@ -3189,8 +3147,6 @@ void isis_cli_init(void) install_element(ISIS_NODE, &no_isis_sr_enable_cmd); install_element(ISIS_NODE, &isis_sr_global_block_label_range_cmd); install_element(ISIS_NODE, &no_isis_sr_global_block_label_range_cmd); - install_element(ISIS_NODE, &isis_sr_local_block_label_range_cmd); - install_element(ISIS_NODE, &no_isis_sr_local_block_label_range_cmd); install_element(ISIS_NODE, &isis_sr_node_msd_cmd); install_element(ISIS_NODE, &no_isis_sr_node_msd_cmd); install_element(ISIS_NODE, &isis_sr_prefix_sid_cmd); @@ -490,7 +490,8 @@ struct connected *if_lookup_address(const void *matchaddr, int family, addr.family = AF_INET6; addr.u.prefix6 = *((struct in6_addr *)matchaddr); addr.prefixlen = IPV6_MAX_BITLEN; - } + } else + assert(!"Attempted lookup of family not supported"); match = NULL; diff --git a/pceplib/test/pcep_msg_messages_test.c b/pceplib/test/pcep_msg_messages_test.c index 3fec24a225..e3a74f92d1 100644 --- a/pceplib/test/pcep_msg_messages_test.c +++ b/pceplib/test/pcep_msg_messages_test.c @@ -143,7 +143,7 @@ void test_pcep_msg_create_request() /* Test IPv6 */ rp_obj = pcep_obj_create_rp(0, false, false, false, false, 10, NULL); - struct in6_addr src_addr_ipv6, dst_addr_ipv6; + struct in6_addr src_addr_ipv6 = {}, dst_addr_ipv6 = {}; struct pcep_object_endpoints_ipv6 *ipv6_obj = pcep_obj_create_endpoint_ipv6(&src_addr_ipv6, &dst_addr_ipv6); message = pcep_msg_create_request_ipv6(rp_obj, ipv6_obj, NULL); diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 3766157295..8a78489ae0 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -31,6 +31,7 @@ #include "pim_ssm.h" #include "pim_ssmpingd.h" #include "pim_vxlan.h" +#include "pim_util.h" #include "log.h" #include "lib_errors.h" @@ -2833,6 +2834,14 @@ int lib_interface_gmp_address_family_static_group_create( ifp_name); return NB_ERR_VALIDATION; } + + yang_dnode_get_ip(&group_addr, args->dnode, "./group-addr"); + if (pim_is_group_224_0_0_0_24(group_addr.ip._v4_addr)) { + snprintf( + args->errmsg, args->errmsg_len, + "Groups within 224.0.0.0/24 are reserved and cannot be joined"); + return NB_ERR_VALIDATION; + } break; case NB_EV_PREPARE: case NB_EV_ABORT: diff --git a/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf b/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf index 82525fac64..73f837c69b 100644 --- a/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf +++ b/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf @@ -19,6 +19,7 @@ route-map ADV-MAP-1 permit 20 ! route-map ADV-MAP-2 permit 10 match ip address prefix-list IP2 + set metric 911 ! route-map EXIST-MAP permit 10 match community DEFAULT-ROUTE diff --git a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py index e9b393ba7f..6153aee418 100644 --- a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py +++ b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py @@ -334,7 +334,7 @@ def test_bgp_conditional_advertisement(): "192.0.2.1/32": None, "192.0.2.5/32": None, "10.139.224.0/20": None, - "203.0.113.1/32": [{"protocol": "bgp"}], + "203.0.113.1/32": [{"protocol": "bgp", "metric": 911}], } return topotest.json_cmp(output, expected) |
