FD.io VPP
v18.07-34-g55fbdb9
Vector Packet Processing
|
SR policy creation and application. More...
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) |
static clib_error_t * | set_sr_src_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd) |
static u8 * | compute_rewrite_encaps (ip6_address_t *sl) |
SR rewrite string computation for IPv6 encapsulation (inline) More... | |
static u8 * | compute_rewrite_insert (ip6_address_t *sl) |
SR rewrite string computation for SRH insertion (inline) More... | |
static u8 * | compute_rewrite_bsid (ip6_address_t *sl) |
SR rewrite string computation for SRH insertion with BSID (inline) More... | |
static ip6_sr_sl_t * | create_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) |
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_t * | sr_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_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. More... | |
static u8 * | format_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... | |
static u8 * | format_sr_segment_list_dpo (u8 *s, va_list *args) |
clib_error_t * | sr_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 vlib_cli_command_t | set_sr_src_command |
(constructor) VLIB_CLI_COMMAND (set_sr_src_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... | |
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 const dpo_vft_t | sr_policy_rewrite_vft |
static const char *const | sr_pr_encaps_ip6_nodes [] |
static const char *const | sr_pr_encaps_ip4_nodes [] |
static const char *const *const | sr_pr_encaps_nodes [DPO_PROTO_NUM] |
static const char *const | sr_pr_insert_ip6_nodes [] |
static const char *const *const | sr_pr_insert_nodes [DPO_PROTO_NUM] |
static const char *const | sr_pr_bsid_insert_ip6_nodes [] |
static const char *const *const | sr_pr_bsid_insert_nodes [DPO_PROTO_NUM] |
static const char *const | sr_pr_bsid_encaps_ip6_nodes [] |
static const char *const *const | sr_pr_bsid_encaps_nodes [DPO_PROTO_NUM] |
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.
#define foreach_sr_policy_rewrite_error |
Definition at line 76 of file sr_policy_rewrite.c.
#define foreach_sr_policy_rewrite_next |
Definition at line 63 of file sr_policy_rewrite.c.
Enumerator | |
---|---|
SR_POLICY_REWRITE_N_ERROR |
Definition at line 84 of file sr_policy_rewrite.c.
Enumerator | |
---|---|
SR_POLICY_REWRITE_N_NEXT |
Definition at line 67 of file sr_policy_rewrite.c.
|
inlinestatic |
SR rewrite string computation for SRH insertion with BSID (inline)
sl | is a vector of IPv6 addresses composing the Segment List |
Definition at line 251 of file sr_policy_rewrite.c.
|
inlinestatic |
SR rewrite string computation for IPv6 encapsulation (inline)
sl | is a vector of IPv6 addresses composing the Segment List |
Definition at line 153 of file sr_policy_rewrite.c.
|
inlinestatic |
SR rewrite string computation for SRH insertion (inline)
sl | is a vector of IPv6 addresses composing the Segment List |
Definition at line 213 of file sr_policy_rewrite.c.
|
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.
sr_policy | is the SR policy where the SL will be added |
sl | is a vector of IPv6 addresses composing the Segment List |
weight | is the weight of the SegmentList (for load-balancing purposes) |
is_encap | represents the mode (SRH insertion vs Encapsulation) |
Definition at line 297 of file sr_policy_rewrite.c.
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 1318 of file sr_policy_rewrite.c.
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 1049 of file sr_policy_rewrite.c.
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 2859 of file sr_policy_rewrite.c.
Trace for the SR Policy Rewrite graph node.
Definition at line 1031 of file sr_policy_rewrite.c.
|
inlinestatic |
Definition at line 1599 of file sr_policy_rewrite.c.
|
inlinestatic |
Definition at line 1616 of file sr_policy_rewrite.c.
|
static |
|
static |
CLI to display onscreen all the SR policies.
Definition at line 964 of file sr_policy_rewrite.c.
int sr_policy_add | ( | ip6_address_t * | bsid, |
ip6_address_t * | segments, | ||
u32 | weight, | ||
u8 | behavior, | ||
u32 | fib_table, | ||
u8 | is_encap | ||
) |
Create a new SR policy.
bsid | is the bindingSID of the SR Policy |
segments | is a vector of IPv6 address composing the segment list |
weight | is the weight of the sid list. optional. |
behavior | is the behavior of the SR policy. (default//spray) |
fib_table | is the VRF where to install the FIB entry for the BSID |
is_encap | (bool) whether SR policy should behave as Encap/SRH Insertion |
Definition at line 551 of file sr_policy_rewrite.c.
|
static |
CLI for 'sr policies' command family.
Definition at line 822 of file sr_policy_rewrite.c.
int sr_policy_del | ( | ip6_address_t * | bsid, |
u32 | index | ||
) |
Delete a SR policy.
bsid | is the bindingSID of the SR Policy |
index | is the index of the SR policy |
Definition at line 632 of file sr_policy_rewrite.c.
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.
bsid | is the bindingSID of the SR Policy |
index | is the index of the SR policy |
fib_table | is the VRF where to install the FIB entry for the BSID |
operation | is the operation to perform (among the top ones) |
segments | is a vector of IPv6 address composing the segment list |
sl_index | is the index of the Segment List to modify/delete |
weight | is the weight of the sid list. optional. |
is_encap | Mode. Encapsulation or SRH insertion. |
Definition at line 727 of file sr_policy_rewrite.c.
|
static |
Graph node for applying a SR policy BSID - Encapsulation.
Definition at line 2891 of file sr_policy_rewrite.c.
|
static |
Graph node for applying a SR policy into a packet.
BSID - SRH insertion.
Definition at line 2448 of file sr_policy_rewrite.c.
|
static |
Graph node for applying a SR policy into an IPv6 packet.
Encapsulation
Definition at line 1068 of file sr_policy_rewrite.c.
|
static |
Graph node for applying a SR policy into a L2 frame.
Definition at line 1646 of file sr_policy_rewrite.c.
|
static |
Graph node for applying a SR policy into an IPv4 packet.
Encapsulation
Definition at line 1352 of file sr_policy_rewrite.c.
clib_error_t* sr_policy_rewrite_init | ( | vlib_main_t * | vm | ) |
SR Policy Rewrite initialization.
Definition at line 3236 of file sr_policy_rewrite.c.
|
static |
Graph node for applying a SR policy into a packet.
SRH insertion.
Definition at line 2026 of file sr_policy_rewrite.c.
void sr_set_source | ( | ip6_address_t * | address | ) |
|
inlinestatic |
Updates the Load Balancer after an SR Policy change.
sr_policy | is the modified SR Policy |
Definition at line 355 of file sr_policy_rewrite.c.
|
inlinestatic |
Updates the Replicate DPO after an SR Policy change.
sr_policy | is the modified SR Policy (type spray) |
Definition at line 454 of file sr_policy_rewrite.c.
|
static |
(constructor) VLIB_CLI_COMMAND (set_sr_src_command)
Definition at line 137 of file sr_policy_rewrite.c.
|
static |
(constructor) VLIB_CLI_COMMAND (show_sr_policies_command)
Definition at line 1019 of file sr_policy_rewrite.c.
|
static |
(constructor) VLIB_CLI_COMMAND (sr_policy_command)
Definition at line 939 of file sr_policy_rewrite.c.
vlib_node_registration_t sr_policy_rewrite_b_encaps_node |
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_b_encaps_node)
Definition at line 3140 of file sr_policy_rewrite.c.
vlib_node_registration_t sr_policy_rewrite_b_insert_node |
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_b_insert_node)
Definition at line 2838 of file sr_policy_rewrite.c.
vlib_node_registration_t sr_policy_rewrite_encaps_l2_node |
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_l2_node)
Definition at line 2005 of file sr_policy_rewrite.c.
vlib_node_registration_t sr_policy_rewrite_encaps_node |
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node)
Definition at line 1297 of file sr_policy_rewrite.c.
vlib_node_registration_t sr_policy_rewrite_encaps_v4_node |
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_v4_node)
Definition at line 1581 of file sr_policy_rewrite.c.
|
static |
Definition at line 92 of file sr_policy_rewrite.c.
vlib_node_registration_t sr_policy_rewrite_insert_node |
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node)
Definition at line 2427 of file sr_policy_rewrite.c.
|
static |
Definition at line 3183 of file sr_policy_rewrite.c.
|
static |
Definition at line 103 of file sr_policy_rewrite.c.
|
static |
Definition at line 3222 of file sr_policy_rewrite.c.
|
static |
Definition at line 3227 of file sr_policy_rewrite.c.
|
static |
Definition at line 104 of file sr_policy_rewrite.c.
|
static |
Definition at line 3213 of file sr_policy_rewrite.c.
|
static |
Definition at line 3218 of file sr_policy_rewrite.c.
|
static |
Dynamically added SR SL DPO type.
Definition at line 101 of file sr_policy_rewrite.c.
|
static |
Definition at line 3194 of file sr_policy_rewrite.c.
|
static |
Definition at line 3189 of file sr_policy_rewrite.c.
|
static |
Definition at line 3199 of file sr_policy_rewrite.c.
|
static |
IPv6 SA for encapsulated packets.
Definition at line 109 of file sr_policy_rewrite.c.
|
static |
Definition at line 102 of file sr_policy_rewrite.c.
|
static |
Definition at line 3204 of file sr_policy_rewrite.c.
|
static |
Definition at line 3209 of file sr_policy_rewrite.c.