FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
sr_policy_rewrite.c File Reference

SR policy creation and application. More...

+ Include dependency graph for sr_policy_rewrite.c:

Go to the source code of this file.

Data Structures

struct  sr_policy_rewrite_trace_t
 SR policy rewrite trace. More...
 

Macros

#define foreach_sr_policy_rewrite_next
 
#define foreach_sr_policy_rewrite_error
 

Enumerations

enum  sr_policy_rewrite_next_t { SR_POLICY_REWRITE_N_NEXT }
 
enum  sr_policy_rewrite_error_t { SR_POLICY_REWRITE_N_ERROR }
 

Functions

void sr_set_source (ip6_address_t *address)
 
ip6_address_t * sr_get_encaps_source ()
 
static clib_error_tset_sr_src_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
void sr_set_hop_limit (u8 hop_limit)
 
u8 sr_get_hop_limit (void)
 
static clib_error_tset_sr_hop_limit_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u8compute_rewrite_encaps (ip6_address_t *sl)
 SR rewrite string computation for IPv6 encapsulation (inline) More...
 
static u8compute_rewrite_insert (ip6_address_t *sl)
 SR rewrite string computation for SRH insertion (inline) More...
 
static u8compute_rewrite_bsid (ip6_address_t *sl)
 SR rewrite string computation for SRH insertion with BSID (inline) More...
 
static ip6_sr_sl_tcreate_sl (ip6_sr_policy_t *sr_policy, ip6_address_t *sl, u32 weight, u8 is_encap)
 Creates a Segment List and adds it to an SR policy. More...
 
static void update_lb (ip6_sr_policy_t *sr_policy)
 Updates the Load Balancer after an SR Policy change. More...
 
static void update_replicate (ip6_sr_policy_t *sr_policy)
 Updates the Replicate DPO after an SR Policy change. More...
 
int sr_policy_add (ip6_address_t *bsid, ip6_address_t *segments, u32 weight, u8 behavior, u32 fib_table, u8 is_encap, u16 plugin, void *ls_plugin_mem)
 Create a new SR policy. More...
 
int sr_policy_del (ip6_address_t *bsid, u32 index)
 Delete a SR policy. More...
 
int sr_policy_mod (ip6_address_t *bsid, u32 index, u32 fib_table, u8 operation, ip6_address_t *segments, u32 sl_index, u32 weight)
 Modify an existing SR policy. More...
 
static clib_error_tsr_policy_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI for 'sr policies' command family. More...
 
static clib_error_tshow_sr_policies_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI to display onscreen all the SR policies. More...
 
static clib_error_tshow_sr_encaps_source_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI to display onscreen the SR encaps source addr. More...
 
static clib_error_tshow_sr_encaps_hop_limit_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI to display onscreen the hop-limit value used for SRv6 encapsulation. More...
 
static u8format_sr_policy_rewrite_trace (u8 *s, va_list *args)
 Trace for the SR Policy Rewrite graph node. More...
 
static_always_inline void encaps_processing_v6 (vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_header_t *ip0_encap)
 IPv6 encapsulation processing as per RFC2473. More...
 
static uword sr_policy_rewrite_encaps (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 Graph node for applying a SR policy into an IPv6 packet. More...
 
static_always_inline void encaps_processing_v4 (vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip4_header_t *ip0_encap)
 IPv4 encapsulation processing as per RFC2473. More...
 
static uword sr_policy_rewrite_encaps_v4 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 Graph node for applying a SR policy into an IPv4 packet. More...
 
static u32 ip_flow_hash (void *data)
 
static u64 mac_to_u64 (u8 *m)
 
static u32 l2_flow_hash (vlib_buffer_t *b0)
 
static uword sr_policy_rewrite_encaps_l2 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 Graph node for applying a SR policy into a L2 frame. More...
 
static uword sr_policy_rewrite_insert (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 Graph node for applying a SR policy into a packet. More...
 
static uword sr_policy_rewrite_b_insert (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 Graph node for applying a SR policy into a packet. More...
 
static_always_inline void end_bsid_encaps_srh_processing (vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, u32 *next0)
 Function BSID encapsulation. More...
 
static uword sr_policy_rewrite_b_encaps (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 Graph node for applying a SR policy BSID - Encapsulation. More...
 
int sr_policy_register_function (vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, u8 prefix_length, dpo_type_t *dpo, format_function_t *ls_format, unformat_function_t *ls_unformat, sr_p_plugin_callback_t *creation_fn, sr_p_plugin_callback_t *removal_fn)
 SR Policy plugin registry. More...
 
static clib_error_tshow_sr_policy_behaviors_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI function to 'show' all available SR LocalSID behaviors. More...
 
static u8format_sr_segment_list_dpo (u8 *s, va_list *args)
 
clib_error_tsr_policy_rewrite_init (vlib_main_t *vm)
 SR Policy Rewrite initialization. More...
 

Variables

static char * sr_policy_rewrite_error_strings []
 
static dpo_type_t sr_pr_encaps_dpo_type
 Dynamically added SR SL DPO type. More...
 
static dpo_type_t sr_pr_insert_dpo_type
 
static dpo_type_t sr_pr_bsid_encaps_dpo_type
 
static dpo_type_t sr_pr_bsid_insert_dpo_type
 
static ip6_address_t sr_pr_encaps_src
 IPv6 SA for encapsulated packets. More...
 
static u8 sr_pr_encaps_hop_limit = IPv6_DEFAULT_HOP_LIMIT
 
static vlib_cli_command_t set_sr_src_command
 (constructor) VLIB_CLI_COMMAND (set_sr_src_command) More...
 
static vlib_cli_command_t set_sr_hop_limit_command
 (constructor) VLIB_CLI_COMMAND (set_sr_hop_limit_command) More...
 
static vlib_cli_command_t sr_policy_command
 (constructor) VLIB_CLI_COMMAND (sr_policy_command) More...
 
static vlib_cli_command_t show_sr_policies_command
 (constructor) VLIB_CLI_COMMAND (show_sr_policies_command) More...
 
static vlib_cli_command_t show_sr_encaps_source_command
 (constructor) VLIB_CLI_COMMAND (show_sr_encaps_source_command) More...
 
static vlib_cli_command_t show_sr_encaps_hop_limit_command
 (constructor) VLIB_CLI_COMMAND (show_sr_encaps_hop_limit_command) More...
 
vlib_node_registration_t sr_policy_rewrite_encaps_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node) More...
 
vlib_node_registration_t sr_policy_rewrite_encaps_v4_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_v4_node) More...
 
vlib_node_registration_t sr_policy_rewrite_encaps_l2_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_l2_node) More...
 
vlib_node_registration_t sr_policy_rewrite_insert_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node) More...
 
vlib_node_registration_t sr_policy_rewrite_b_insert_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_b_insert_node) More...
 
vlib_node_registration_t sr_policy_rewrite_b_encaps_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_b_encaps_node) More...
 
static vlib_cli_command_t show_sr_policy_behaviors_command
 (constructor) VLIB_CLI_COMMAND (show_sr_policy_behaviors_command) More...
 
const static dpo_vft_t sr_policy_rewrite_vft
 
const static char *const sr_pr_encaps_ip6_nodes []
 
const static char *const sr_pr_encaps_ip4_nodes []
 
const static char *const *const sr_pr_encaps_nodes [DPO_PROTO_NUM]
 
const static char *const sr_pr_insert_ip6_nodes []
 
const static char *const *const sr_pr_insert_nodes [DPO_PROTO_NUM]
 
const static char *const sr_pr_bsid_insert_ip6_nodes []
 
const static char *const *const sr_pr_bsid_insert_nodes [DPO_PROTO_NUM]
 
const static char *const sr_pr_bsid_encaps_ip6_nodes []
 
const static char *const *const sr_pr_bsid_encaps_nodes [DPO_PROTO_NUM]
 

Detailed Description

SR policy creation and application.

Create an SR policy. An SR policy can be either of 'default' type or 'spray' type An SR policy has attached a list of SID lists. In case the SR policy is a default one it will load balance among them. An SR policy has associated a BindingSID. In case any packet arrives with IPv6 DA == BindingSID then the SR policy associated to such bindingSID will be applied to such packet.

SR policies can be applied either by using IPv6 encapsulation or SRH insertion. Both methods can be found on this file.

Traffic input usually is IPv6 packets. However it is possible to have IPv4 packets or L2 frames. (that are encapsulated into IPv6 with SRH)

This file provides the appropiates VPP graph nodes to do any of these methods.

Definition in file sr_policy_rewrite.c.

Macro Definition Documentation

◆ foreach_sr_policy_rewrite_error

#define foreach_sr_policy_rewrite_error
Value:
_(INTERNAL_ERROR, "Segment Routing undefined error") \
_(BSID_ZERO, "BSID with SL = 0") \
_(COUNTER_TOTAL, "SR steered IPv6 packets") \
_(COUNTER_ENCAP, "SR: Encaps packets") \
_(COUNTER_INSERT, "SR: SRH inserted packets") \
_(COUNTER_BSID, "SR: BindingSID steered packets")

Definition at line 76 of file sr_policy_rewrite.c.

◆ foreach_sr_policy_rewrite_next

#define foreach_sr_policy_rewrite_next
Value:
_(IP6_LOOKUP, "ip6-lookup") \
_(ERROR, "error-drop")

Definition at line 63 of file sr_policy_rewrite.c.

Enumeration Type Documentation

◆ sr_policy_rewrite_error_t

Enumerator
SR_POLICY_REWRITE_N_ERROR 

Definition at line 84 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_next_t

Enumerator
SR_POLICY_REWRITE_N_NEXT 

Definition at line 67 of file sr_policy_rewrite.c.

Function Documentation

◆ compute_rewrite_bsid()

static u8* compute_rewrite_bsid ( ip6_address_t *  sl)
inlinestatic

SR rewrite string computation for SRH insertion with BSID (inline)

Parameters
slis a vector of IPv6 addresses composing the Segment List
Returns
precomputed rewrite string for SRH insertion with BSID

Definition at line 297 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compute_rewrite_encaps()

static u8* compute_rewrite_encaps ( ip6_address_t *  sl)
inlinestatic

SR rewrite string computation for IPv6 encapsulation (inline)

Parameters
slis a vector of IPv6 addresses composing the Segment List
Returns
precomputed rewrite string for encapsulation

Definition at line 198 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compute_rewrite_insert()

static u8* compute_rewrite_insert ( ip6_address_t *  sl)
inlinestatic

SR rewrite string computation for SRH insertion (inline)

Parameters
slis a vector of IPv6 addresses composing the Segment List
Returns
precomputed rewrite string for SRH insertion

Definition at line 258 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_sl()

static ip6_sr_sl_t* create_sl ( ip6_sr_policy_t sr_policy,
ip6_address_t *  sl,
u32  weight,
u8  is_encap 
)
inlinestatic

Creates a Segment List and adds it to an SR policy.

Creates a Segment List and adds it to the SR policy. Notice that the SL are not necessarily unique. Hence there might be two Segment List within the same SR Policy with exactly the same segments and same weight.

Parameters
sr_policyis the SR policy where the SL will be added
slis a vector of IPv6 addresses composing the Segment List
weightis the weight of the SegmentList (for load-balancing purposes)
is_encaprepresents the mode (SRH insertion vs Encapsulation)
Returns
pointer to the just created segment list

Definition at line 344 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encaps_processing_v4()

static_always_inline void encaps_processing_v4 ( vlib_node_runtime_t node,
vlib_buffer_t b0,
ip6_header_t ip0,
ip4_header_t ip0_encap 
)

IPv4 encapsulation processing as per RFC2473.

Definition at line 1522 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encaps_processing_v6()

static_always_inline void encaps_processing_v6 ( vlib_node_runtime_t node,
vlib_buffer_t b0,
ip6_header_t ip0,
ip6_header_t ip0_encap 
)

IPv6 encapsulation processing as per RFC2473.

Definition at line 1239 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_bsid_encaps_srh_processing()

static_always_inline void end_bsid_encaps_srh_processing ( vlib_node_runtime_t node,
vlib_buffer_t b0,
ip6_header_t ip0,
ip6_sr_header_t sr0,
u32 next0 
)

Function BSID encapsulation.

Definition at line 3090 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ format_sr_policy_rewrite_trace()

static u8* format_sr_policy_rewrite_trace ( u8 s,
va_list *  args 
)
static

Trace for the SR Policy Rewrite graph node.

Definition at line 1221 of file sr_policy_rewrite.c.

◆ format_sr_segment_list_dpo()

static u8* format_sr_segment_list_dpo ( u8 s,
va_list *  args 
)
static

Definition at line 3483 of file sr_policy_rewrite.c.

◆ ip_flow_hash()

static u32 ip_flow_hash ( void *  data)
inlinestatic

Definition at line 1812 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l2_flow_hash()

static u32 l2_flow_hash ( vlib_buffer_t b0)
inlinestatic

Definition at line 1829 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mac_to_u64()

static u64 mac_to_u64 ( u8 m)
inlinestatic

Definition at line 1823 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ set_sr_hop_limit_command_fn()

static clib_error_t* set_sr_hop_limit_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 166 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ set_sr_src_command_fn()

static clib_error_t* set_sr_src_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 129 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ show_sr_encaps_hop_limit_command_fn()

static clib_error_t* show_sr_encaps_hop_limit_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI to display onscreen the hop-limit value used for SRv6 encapsulation.

Definition at line 1199 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ show_sr_encaps_source_command_fn()

static clib_error_t* show_sr_encaps_source_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI to display onscreen the SR encaps source addr.

Definition at line 1178 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ show_sr_policies_command_fn()

static clib_error_t* show_sr_policies_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI to display onscreen all the SR policies.

Definition at line 1112 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ show_sr_policy_behaviors_command_fn()

static clib_error_t* show_sr_policy_behaviors_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI function to 'show' all available SR LocalSID behaviors.

Definition at line 3446 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_get_encaps_source()

ip6_address_t* sr_get_encaps_source ( )

Definition at line 123 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ sr_get_hop_limit()

u8 sr_get_hop_limit ( void  )

Definition at line 160 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ sr_policy_add()

int sr_policy_add ( ip6_address_t *  bsid,
ip6_address_t *  segments,
u32  weight,
u8  behavior,
u32  fib_table,
u8  is_encap,
u16  plugin,
void *  ls_plugin_mem 
)

Create a new SR policy.

Parameters
bsidis the bindingSID of the SR Policy
segmentsis a vector of IPv6 address composing the segment list
weightis the weight of the sid list. optional.
behavioris the behavior of the SR policy. (default//spray)
fib_tableis the VRF where to install the FIB entry for the BSID
is_encap(bool) whether SR policy should behave as Encap/SRH Insertion
Returns
0 if correct, else error

Definition at line 635 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_policy_command_fn()

static clib_error_t* sr_policy_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI for 'sr policies' command family.

Definition at line 926 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_del()

int sr_policy_del ( ip6_address_t *  bsid,
u32  index 
)

Delete a SR policy.

Parameters
bsidis the bindingSID of the SR Policy
indexis the index of the SR policy
Returns
0 if correct, else error

Definition at line 723 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_policy_mod()

int sr_policy_mod ( ip6_address_t *  bsid,
u32  index,
u32  fib_table,
u8  operation,
ip6_address_t *  segments,
u32  sl_index,
u32  weight 
)

Modify an existing SR policy.

The possible modifications are adding a new Segment List, modifying an existing Segment List (modify the weight only) and delete a given Segment List from the SR Policy.

Parameters
bsidis the bindingSID of the SR Policy
indexis the index of the SR policy
fib_tableis the VRF where to install the FIB entry for the BSID
operationis the operation to perform (among the top ones)
segmentsis a vector of IPv6 address composing the segment list
sl_indexis the index of the Segment List to modify/delete
weightis the weight of the sid list. optional.
is_encapMode. Encapsulation or SRH insertion.
Returns
0 if correct, else error

Definition at line 831 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_policy_register_function()

int sr_policy_register_function ( vlib_main_t vm,
u8 fn_name,
u8 keyword_str,
u8 def_str,
u8 params_str,
u8  prefix_length,
dpo_type_t dpo,
format_function_t ls_format,
unformat_function_t ls_unformat,
sr_p_plugin_callback_t creation_fn,
sr_p_plugin_callback_t removal_fn 
)

SR Policy plugin registry.

Definition at line 3396 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_policy_rewrite_b_encaps()

static uword sr_policy_rewrite_b_encaps ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Graph node for applying a SR policy BSID - Encapsulation.

Definition at line 3122 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_rewrite_b_insert()

static uword sr_policy_rewrite_b_insert ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Graph node for applying a SR policy into a packet.

BSID - SRH insertion.

Definition at line 2679 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_rewrite_encaps()

static uword sr_policy_rewrite_encaps ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Graph node for applying a SR policy into an IPv6 packet.

Encapsulation

Definition at line 1265 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_rewrite_encaps_l2()

static uword sr_policy_rewrite_encaps_l2 ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Graph node for applying a SR policy into a L2 frame.

Definition at line 1859 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_rewrite_encaps_v4()

static uword sr_policy_rewrite_encaps_v4 ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Graph node for applying a SR policy into an IPv4 packet.

Encapsulation

Definition at line 1558 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_rewrite_init()

clib_error_t* sr_policy_rewrite_init ( vlib_main_t vm)

SR Policy Rewrite initialization.

Definition at line 3560 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_policy_rewrite_insert()

static uword sr_policy_rewrite_insert ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Graph node for applying a SR policy into a packet.

SRH insertion.

Definition at line 2257 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

◆ sr_set_hop_limit()

void sr_set_hop_limit ( u8  hop_limit)

Definition at line 154 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ sr_set_source()

void sr_set_source ( ip6_address_t *  address)

Definition at line 117 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_lb()

static void update_lb ( ip6_sr_policy_t sr_policy)
inlinestatic

Updates the Load Balancer after an SR Policy change.

Parameters
sr_policyis the modified SR Policy

Definition at line 441 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_replicate()

static void update_replicate ( ip6_sr_policy_t sr_policy)
inlinestatic

Updates the Replicate DPO after an SR Policy change.

Parameters
sr_policyis the modified SR Policy (type spray)

Definition at line 538 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ set_sr_hop_limit_command

vlib_cli_command_t set_sr_hop_limit_command
static
Initial value:
= {
.path = "set sr encaps hop-limit",
.short_help = "set sr encaps hop-limit <value>",
}

(constructor) VLIB_CLI_COMMAND (set_sr_hop_limit_command)

Definition at line 182 of file sr_policy_rewrite.c.

◆ set_sr_src_command

vlib_cli_command_t set_sr_src_command
static
Initial value:
= {
.path = "set sr encaps source",
.short_help = "set sr encaps source addr <ip6_addr>",
.function = set_sr_src_command_fn,
}

(constructor) VLIB_CLI_COMMAND (set_sr_src_command)

Definition at line 144 of file sr_policy_rewrite.c.

◆ show_sr_encaps_hop_limit_command

vlib_cli_command_t show_sr_encaps_hop_limit_command
static
Initial value:
= {
.path = "show sr encaps hop-limit",
.short_help = "show sr encaps hop-limit",
}

(constructor) VLIB_CLI_COMMAND (show_sr_encaps_hop_limit_command)

Definition at line 1209 of file sr_policy_rewrite.c.

◆ show_sr_encaps_source_command

vlib_cli_command_t show_sr_encaps_source_command
static
Initial value:
= {
.path = "show sr encaps source addr",
.short_help = "show sr encaps source addr",
}

(constructor) VLIB_CLI_COMMAND (show_sr_encaps_source_command)

Definition at line 1188 of file sr_policy_rewrite.c.

◆ show_sr_policies_command

vlib_cli_command_t show_sr_policies_command
static
Initial value:
= {
.path = "show sr policies",
.short_help = "show sr policies",
}

(constructor) VLIB_CLI_COMMAND (show_sr_policies_command)

Definition at line 1167 of file sr_policy_rewrite.c.

◆ show_sr_policy_behaviors_command

vlib_cli_command_t show_sr_policy_behaviors_command
static
Initial value:
= {
.path = "show sr policy behaviors",
.short_help = "show sr policy behaviors",
}

(constructor) VLIB_CLI_COMMAND (show_sr_policy_behaviors_command)

Definition at line 3474 of file sr_policy_rewrite.c.

◆ sr_policy_command

vlib_cli_command_t sr_policy_command
static
Initial value:
= {
.path = "sr policy",
.short_help = "sr policy [add||del||mod] [bsid 2001::1||index 5] "
"next A:: next B:: next C:: (weight 1) (fib-table 2) (encap|insert)",
.long_help =
"Manipulation of SR policies.\n"
"A Segment Routing policy may contain several SID lists. Each SID list has\n"
"an associated weight (default 1), which will result in wECMP (uECMP).\n"
"Segment Routing policies might be of type encapsulation or srh insertion\n"
"Each SR policy will be associated with a unique BindingSID.\n"
"A BindingSID is a locally allocated SegmentID. For every packet that arrives\n"
"with IPv6_DA:BSID such traffic will be steered into the SR policy.\n"
"The add command will create a SR policy with its first segment list (sl)\n"
"The mod command allows you to add, remove, or modify the existing segment lists\n"
"within an SR policy.\n"
"The del command allows you to delete a SR policy along with all its associated\n"
"SID lists.\n",
.function = sr_policy_command_fn,
}

(constructor) VLIB_CLI_COMMAND (sr_policy_command)

Definition at line 1087 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_b_encaps_node

vlib_node_registration_t sr_policy_rewrite_b_encaps_node
Initial value:
= {
.name = "sr-pl-rewrite-b-encaps",
.vector_size = sizeof (u32),
.n_next_nodes = SR_POLICY_REWRITE_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_b_encaps_node)

Definition at line 3374 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_b_insert_node

vlib_node_registration_t sr_policy_rewrite_b_insert_node
Initial value:
= {
.name = "sr-pl-rewrite-b-insert",
.vector_size = sizeof (u32),
.n_next_nodes = SR_POLICY_REWRITE_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_b_insert_node)

Definition at line 3069 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_encaps_l2_node

vlib_node_registration_t sr_policy_rewrite_encaps_l2_node
Initial value:
= {
.name = "sr-pl-rewrite-encaps-l2",
.vector_size = sizeof (u32),
.n_next_nodes = SR_POLICY_REWRITE_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_l2_node)

Definition at line 2236 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_encaps_node

vlib_node_registration_t sr_policy_rewrite_encaps_node
Initial value:
= {
.name = "sr-pl-rewrite-encaps",
.vector_size = sizeof (u32),
.n_next_nodes = SR_POLICY_REWRITE_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node)

Definition at line 1501 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_encaps_v4_node

vlib_node_registration_t sr_policy_rewrite_encaps_v4_node
Initial value:
= {
.name = "sr-pl-rewrite-encaps-v4",
.vector_size = sizeof (u32),
.n_next_nodes = SR_POLICY_REWRITE_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_v4_node)

Definition at line 1794 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_error_strings

char* sr_policy_rewrite_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}

Definition at line 92 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_insert_node

vlib_node_registration_t sr_policy_rewrite_insert_node
Initial value:
= {
.name = "sr-pl-rewrite-insert",
.vector_size = sizeof (u32),
.n_next_nodes = SR_POLICY_REWRITE_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node)

Definition at line 2658 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_vft

const static dpo_vft_t sr_policy_rewrite_vft
static
Initial value:
= {
.dv_lock = sr_dpo_lock,
.dv_unlock = sr_dpo_unlock,
}

Definition at line 3507 of file sr_policy_rewrite.c.

◆ sr_pr_bsid_encaps_dpo_type

dpo_type_t sr_pr_bsid_encaps_dpo_type
static

Definition at line 103 of file sr_policy_rewrite.c.

◆ sr_pr_bsid_encaps_ip6_nodes

const static char* const sr_pr_bsid_encaps_ip6_nodes[]
static
Initial value:
= {
"sr-pl-rewrite-b-encaps",
NULL,
}

Definition at line 3546 of file sr_policy_rewrite.c.

◆ sr_pr_bsid_encaps_nodes

const static char* const * const sr_pr_bsid_encaps_nodes[DPO_PROTO_NUM]
static
Initial value:

Definition at line 3551 of file sr_policy_rewrite.c.

◆ sr_pr_bsid_insert_dpo_type

dpo_type_t sr_pr_bsid_insert_dpo_type
static

Definition at line 104 of file sr_policy_rewrite.c.

◆ sr_pr_bsid_insert_ip6_nodes

const static char* const sr_pr_bsid_insert_ip6_nodes[]
static
Initial value:
= {
"sr-pl-rewrite-b-insert",
NULL,
}

Definition at line 3537 of file sr_policy_rewrite.c.

◆ sr_pr_bsid_insert_nodes

const static char* const * const sr_pr_bsid_insert_nodes[DPO_PROTO_NUM]
static
Initial value:

Definition at line 3542 of file sr_policy_rewrite.c.

◆ sr_pr_encaps_dpo_type

dpo_type_t sr_pr_encaps_dpo_type
static

Dynamically added SR SL DPO type.

Definition at line 101 of file sr_policy_rewrite.c.

◆ sr_pr_encaps_hop_limit

u8 sr_pr_encaps_hop_limit = IPv6_DEFAULT_HOP_LIMIT
static

Definition at line 110 of file sr_policy_rewrite.c.

◆ sr_pr_encaps_ip4_nodes

const static char* const sr_pr_encaps_ip4_nodes[]
static
Initial value:
= {
"sr-pl-rewrite-encaps-v4",
NULL,
}

Definition at line 3518 of file sr_policy_rewrite.c.

◆ sr_pr_encaps_ip6_nodes

const static char* const sr_pr_encaps_ip6_nodes[]
static
Initial value:
= {
"sr-pl-rewrite-encaps",
NULL,
}

Definition at line 3513 of file sr_policy_rewrite.c.

◆ sr_pr_encaps_nodes

const static char* const * const sr_pr_encaps_nodes[DPO_PROTO_NUM]
static
Initial value:

Definition at line 3523 of file sr_policy_rewrite.c.

◆ sr_pr_encaps_src

ip6_address_t sr_pr_encaps_src
static

IPv6 SA for encapsulated packets.

Definition at line 109 of file sr_policy_rewrite.c.

◆ sr_pr_insert_dpo_type

dpo_type_t sr_pr_insert_dpo_type
static

Definition at line 102 of file sr_policy_rewrite.c.

◆ sr_pr_insert_ip6_nodes

const static char* const sr_pr_insert_ip6_nodes[]
static
Initial value:
= {
"sr-pl-rewrite-insert",
NULL,
}

Definition at line 3528 of file sr_policy_rewrite.c.

◆ sr_pr_insert_nodes

const static char* const * const sr_pr_insert_nodes[DPO_PROTO_NUM]
static
Initial value:

Definition at line 3533 of file sr_policy_rewrite.c.

show_sr_policy_behaviors_command_fn
static clib_error_t * show_sr_policy_behaviors_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to 'show' all available SR LocalSID behaviors.
Definition: sr_policy_rewrite.c:3446
show_sr_policies_command_fn
static clib_error_t * show_sr_policies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to display onscreen all the SR policies.
Definition: sr_policy_rewrite.c:1112
SR_POLICY_REWRITE_N_NEXT
@ SR_POLICY_REWRITE_N_NEXT
Definition: sr_policy_rewrite.c:72
sr_policy_rewrite_b_encaps
static uword sr_policy_rewrite_b_encaps(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for applying a SR policy BSID - Encapsulation.
Definition: sr_policy_rewrite.c:3122
sr_policy_rewrite_b_insert
static uword sr_policy_rewrite_b_insert(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for applying a SR policy into a packet.
Definition: sr_policy_rewrite.c:2679
SR_POLICY_REWRITE_N_ERROR
@ SR_POLICY_REWRITE_N_ERROR
Definition: sr_policy_rewrite.c:89
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
sr_policy_rewrite_encaps_l2
static uword sr_policy_rewrite_encaps_l2(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for applying a SR policy into a L2 frame.
Definition: sr_policy_rewrite.c:1859
sr_policy_rewrite_insert
static uword sr_policy_rewrite_insert(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for applying a SR policy into a packet.
Definition: sr_policy_rewrite.c:2257
set_sr_src_command_fn
static clib_error_t * set_sr_src_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: sr_policy_rewrite.c:129
format_sr_segment_list_dpo
static u8 * format_sr_segment_list_dpo(u8 *s, va_list *args)
Definition: sr_policy_rewrite.c:3483
sr_pr_encaps_ip4_nodes
const static char *const sr_pr_encaps_ip4_nodes[]
Definition: sr_policy_rewrite.c:3518
sr_policy_rewrite_encaps
static uword sr_policy_rewrite_encaps(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for applying a SR policy into an IPv6 packet.
Definition: sr_policy_rewrite.c:1265
sr_pr_bsid_insert_ip6_nodes
const static char *const sr_pr_bsid_insert_ip6_nodes[]
Definition: sr_policy_rewrite.c:3537
sr_dpo_unlock
void sr_dpo_unlock(dpo_id_t *dpo)
no-op unlock function.
Definition: sr.c:47
sr_policy_rewrite_encaps_v4
static uword sr_policy_rewrite_encaps_v4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for applying a SR policy into an IPv4 packet.
Definition: sr_policy_rewrite.c:1558
show_sr_encaps_source_command_fn
static clib_error_t * show_sr_encaps_source_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to display onscreen the SR encaps source addr.
Definition: sr_policy_rewrite.c:1178
format_sr_policy_rewrite_trace
static u8 * format_sr_policy_rewrite_trace(u8 *s, va_list *args)
Trace for the SR Policy Rewrite graph node.
Definition: sr_policy_rewrite.c:1221
sr_pr_insert_ip6_nodes
const static char *const sr_pr_insert_ip6_nodes[]
Definition: sr_policy_rewrite.c:3528
set_sr_hop_limit_command_fn
static clib_error_t * set_sr_hop_limit_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: sr_policy_rewrite.c:166
sr_dpo_lock
void sr_dpo_lock(dpo_id_t *dpo)
no-op lock function.
Definition: sr.c:38
sr_pr_encaps_ip6_nodes
const static char *const sr_pr_encaps_ip6_nodes[]
Definition: sr_policy_rewrite.c:3513
foreach_sr_policy_rewrite_next
#define foreach_sr_policy_rewrite_next
Definition: sr_policy_rewrite.c:63
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
u32
unsigned int u32
Definition: types.h:88
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
show_sr_encaps_hop_limit_command_fn
static clib_error_t * show_sr_encaps_hop_limit_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to display onscreen the hop-limit value used for SRv6 encapsulation.
Definition: sr_policy_rewrite.c:1199
sr_policy_rewrite_error_strings
static char * sr_policy_rewrite_error_strings[]
Definition: sr_policy_rewrite.c:92
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
sr_policy_command_fn
static clib_error_t * sr_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI for 'sr policies' command family.
Definition: sr_policy_rewrite.c:926
sr_pr_bsid_encaps_ip6_nodes
const static char *const sr_pr_bsid_encaps_ip6_nodes[]
Definition: sr_policy_rewrite.c:3546
foreach_sr_policy_rewrite_error
#define foreach_sr_policy_rewrite_error
Definition: sr_policy_rewrite.c:76