&& attr1->nh_lla_ifindex == attr2->nh_lla_ifindex
&& attr1->distance == attr2->distance
&& srv6_l3vpn_same(attr1->srv6_l3vpn, attr2->srv6_l3vpn)
- && srv6_vpn_same(attr1->srv6_vpn, attr2->srv6_vpn))
+ && srv6_vpn_same(attr1->srv6_vpn, attr2->srv6_vpn)
+ && attr1->srte_color == attr2->srte_color)
return true;
}
route_map_rule_tag_free,
};
+static enum route_map_cmd_result_t
+route_set_srte_color(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ uint32_t *srte_color = rule;
+ struct bgp_path_info *path;
+
+ if (type != RMAP_BGP)
+ return RMAP_OKAY;
+
+ path = object;
+
+ path->attr->srte_color = *srte_color;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_SRTE_COLOR);
+
+ return RMAP_OKAY;
+}
+
+/* Route map `sr-te color' compile function */
+static void *route_set_srte_color_compile(const char *arg)
+{
+ uint32_t *color;
+
+ color = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t));
+ *color = atoi(arg);
+
+ return color;
+}
+
+/* Free route map's compiled `sr-te color' value. */
+static void route_set_srte_color_free(void *rule)
+{
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+/* Route map commands for sr-te color set. */
+struct route_map_rule_cmd route_set_srte_color_cmd = {
+ "sr-te color", route_set_srte_color, route_set_srte_color_compile,
+ route_set_srte_color_free};
/* Set nexthop to object. ojbect must be pointer to struct attr. */
struct rmap_ip_nexthop_set {
route_map_match_tag_hook(generic_match_add);
route_map_no_match_tag_hook(generic_match_delete);
+ route_map_set_srte_color_hook(generic_set_add);
+ route_map_no_set_srte_color_hook(generic_set_delete);
+
route_map_set_ip_nexthop_hook(generic_set_add);
route_map_no_set_ip_nexthop_hook(generic_set_delete);
route_map_install_match(&route_match_vrl_source_vrf_cmd);
route_map_install_set(&route_set_table_id_cmd);
+ route_map_install_set(&route_set_srte_color_cmd);
route_map_install_set(&route_set_ip_nexthop_cmd);
route_map_install_set(&route_set_local_pref_cmd);
route_map_install_set(&route_set_weight_cmd);
api.tableid = info->attr->rmap_table_id;
}
+ if (CHECK_FLAG(info->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_SRTE_COLOR)))
+ SET_FLAG(api.message, ZAPI_MESSAGE_SRTE);
+
/* Metric is currently based on the best-path only */
metric = info->attr->med;
continue;
}
api_nh = &api.nexthops[valid_nh_count];
+
+ if (CHECK_FLAG(info->attr->flag,
+ ATTR_FLAG_BIT(BGP_ATTR_SRTE_COLOR)))
+ api_nh->srte_color = info->attr->srte_color;
+
if (nh_family == AF_INET) {
if (bgp_debug_zebra(&api.prefix)) {
if (mpinfo->extra) {
Set the BGP table to a given table identifier
+.. index:: set sr-te color (1-4294967295)
+.. clicmd:: set sr-te color (1-4294967295)
+
+ Set the color of a SR-TE Policy to be applied to a learned route. The SR-TE
+ Policy is uniquely determined by the color and the BGP nexthop.
+
.. _route-map-call-command:
Route Map Call Command