FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
sr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @file
18  * @brief Segment Routing data structures definitions
19  *
20  */
21 
22 #ifndef included_vnet_srv6_h
23 #define included_vnet_srv6_h
24 
25 #include <vnet/vnet.h>
26 #include <vnet/srv6/sr_packet.h>
27 #include <vnet/ip/ip6_packet.h>
28 #include <vnet/ethernet/ethernet.h>
29 
30 #include <stdlib.h>
31 #include <string.h>
32 
33 #define IPv6_DEFAULT_HEADER_LENGTH 40
34 #define IPv6_DEFAULT_HOP_LIMIT 64
35 #define IPv6_DEFAULT_MAX_MASK_WIDTH 128
36 
37 #define SR_BEHAVIOR_END 1
38 #define SR_BEHAVIOR_X 2
39 #define SR_BEHAVIOR_T 3
40 #define SR_BEHAVIOR_D_FIRST 4 /* Unused. Separator in between regular and D */
41 #define SR_BEHAVIOR_DX2 5
42 #define SR_BEHAVIOR_DX6 6
43 #define SR_BEHAVIOR_DX4 7
44 #define SR_BEHAVIOR_DT6 8
45 #define SR_BEHAVIOR_DT4 9
46 #define SR_BEHAVIOR_END_UN_PERF 10
47 #define SR_BEHAVIOR_END_UN 11
48 #define SR_BEHAVIOR_LAST 12 /* Must always be the last one */
49 
50 #define SR_STEER_L2 2
51 #define SR_STEER_IPV4 4
52 #define SR_STEER_IPV6 6
53 
54 #define SR_FUNCTION_SIZE 4
55 #define SR_ARGUMENT_SIZE 4
56 
57 #define SR_SEGMENT_LIST_WEIGHT_DEFAULT 1
58 
59 /* *INDENT-OFF* */
60 typedef struct
61 {
64 } __attribute__ ((packed)) ip6srv_combo_header_t;
65 /* *INDENT-ON* */
66 
67 /**
68  * @brief SR Segment List (SID list)
69  */
70 typedef struct
71 {
72  ip6_address_t *segments; /**< SIDs (key) */
73 
74  u32 weight; /**< SID list weight (wECMP / UCMP) */
75 
76  u8 *rewrite; /**< Precomputed rewrite header */
77  u8 *rewrite_bsid; /**< Precomputed rewrite header for bindingSID */
78 
79  u32 egress_fib_table; /**< Egress FIB table for encap packet */
80 
81  dpo_id_t bsid_dpo; /**< DPO for Encaps/Insert for BSID */
82  dpo_id_t ip6_dpo; /**< DPO for Encaps/Insert IPv6 */
83  dpo_id_t ip4_dpo; /**< DPO for Encaps IPv6 */
84 
86  void *plugin_mem;
87 } ip6_sr_sl_t;
88 
89 /* SR policy types */
90 #define SR_POLICY_TYPE_DEFAULT 0
91 #define SR_POLICY_TYPE_SPRAY 1
92 /**
93  * @brief SR Policy
94  */
95 typedef struct
96 {
97  u32 *segments_lists; /**< SID lists indexes (vector) */
98 
99  ip6_address_t bsid; /**< BindingSID (key) */
100 
101  u8 type; /**< Type (default is 0) */
102  /* SR Policy specific DPO */
103  /* IF Type = DEFAULT Then Load Balancer DPO among SID lists */
104  /* IF Type = SPRAY then Spray DPO with all SID lists */
105  dpo_id_t bsid_dpo; /**< SR Policy specific DPO - BSID */
106  dpo_id_t ip4_dpo; /**< SR Policy specific DPO - IPv6 */
107  dpo_id_t ip6_dpo; /**< SR Policy specific DPO - IPv4 */
108 
109  u32 fib_table; /**< FIB table */
110 
111  u8 is_encap; /**< Mode (0 is SRH insert, 1 Encaps) */
112 
114  void *plugin_mem;
116 
118 
119 /**
120  * @brief SR LocalSID
121  */
122 typedef struct
123 {
124  ip6_address_t localsid; /**< LocalSID IPv6 address */
125 
127 
128  char end_psp; /**< Combined with End.PSP? */
129 
130  u16 behavior; /**< Behavior associated to this localsid */
131 
132  union
133  {
134  u32 sw_if_index; /**< xconnect only */
135  u32 vrf_index; /**< vrf only */
136  };
137 
138  u32 fib_table; /**< FIB table where localsid is registered */
139 
140  u32 vlan_index; /**< VLAN tag (not an index) */
141 
142  ip46_address_t next_hop; /**< Next_hop for xconnect usage only */
143 
144  u32 nh_adj; /**< Next_adj for xconnect usage only */
145 
146  ip6_address_t usid_block;
147  ip6_address_t usid_block_mask;
148 
151 
154 
155  void *plugin_mem; /**< Memory to be used by the plugin callback functions */
157 
158 typedef int (sr_plugin_callback_t) (ip6_sr_localsid_t * localsid);
159 
160 /**
161  * @brief SR LocalSID behavior registration
162  */
163 typedef struct
164 {
165  u16 sr_localsid_function_number; /**< SR LocalSID plugin function (>SR_BEHAVIOR_LAST) */
166 
167  u8 *function_name; /**< Function name. (key). */
168 
169  u8 *keyword_str; /**< Behavior keyword (i.e. End.X) */
170 
171  u8 *def_str; /**< Behavior definition (i.e. Endpoint with cross-connect) */
172 
173  u8 *params_str; /**< Behavior parameters (i.e. <oif> <IP46next_hop>) */
174 
176 
177  dpo_type_t dpo; /**< DPO type registration */
178 
179  format_function_t *ls_format; /**< LocalSID format function */
180 
181  unformat_function_t *ls_unformat; /**< LocalSID unformat function */
182 
183  sr_plugin_callback_t *creation; /**< Function within plugin that will be called after localsid creation*/
184 
185  sr_plugin_callback_t *removal; /**< Function within plugin that will be called before localsid removal */
187 
188 /**
189  * @brief SR Policy behavior registration
190  */
191 typedef struct
192 {
193  u16 sr_policy_function_number; /**< SR Policy plugin function */
194 
195  u8 *function_name; /**< Function name. (key). */
196 
197  u8 *keyword_str; /**< Behavior keyword (i.e. End.X) */
198 
199  u8 *def_str; /**< Behavior definition (i.e. Endpoint with cross-connect) */
200 
201  u8 *params_str; /**< Behavior parameters (i.e. <oif> <IP46next_hop>) */
202 
204 
205  dpo_type_t dpo; /**< DPO type registration */
206 
207  format_function_t *ls_format; /**< LocalSID format function */
208 
209  unformat_function_t *ls_unformat; /**< LocalSID unformat function */
210 
211  sr_p_plugin_callback_t *creation; /**< Function within plugin that will be called after localsid creation*/
212 
213  sr_p_plugin_callback_t *removal; /**< Function within plugin that will be called before localsid removal */
215 
216 /**
217  * @brief Steering db key
218  *
219  * L3 is IPv4/IPv6 + mask
220  * L2 is sf_if_index + vlan
221  */
222 typedef struct
223 {
224  union
225  {
226  struct
227  {
228  ip46_address_t prefix; /**< IP address of the prefix */
229  u32 mask_width; /**< Mask width of the prefix */
230  u32 fib_table; /**< VRF of the prefix */
231  } l3;
232  struct
233  {
234  u32 sw_if_index; /**< Incoming software interface */
235  } l2;
236  };
237  u8 traffic_type; /**< Traffic type (IPv4, IPv6, L2) */
240 
241 typedef struct
242 {
243  sr_steering_key_t classify; /**< Traffic classification */
244  u32 sr_policy; /**< SR Policy index */
246 
247 typedef struct
248 {
249  ip6_address_t address;
253 
254 /**
255  * @brief Segment Routing main datastructure
256  */
257 typedef struct
258 {
259  /* L2-input -> SR rewrite next index */
261 
262  /* SR SID lists */
264 
265  /* SRv6 policies */
267 
268  /* Hash table mapping BindingSID to SRv6 policy */
270 
271  /* Pool of SR localsid instances */
273 
274  /* Hash table mapping LOC:FUNC to SR LocalSID instance */
276 
277  /* Pool of SR steer policies instances */
279 
280  /* Hash table mapping steering rules to SR steer instance */
282 
283  /* L2 steering ifaces - sr_policies */
285 
286  /* Spray DPO */
288 
289  /* Plugin functions */
291 
292  /* Find plugin function by name */
294 
295  /* Plugin functions for Policy */
297 
298  /* Find plugin function by name */
300 
301  /* Counters */
304 
305  /* SR Policies FIBs */
308 
309  /* convenience */
312 } ip6_sr_main_t;
313 
314 extern ip6_sr_main_t sr_main;
315 
320 
321 extern void sr_dpo_lock (dpo_id_t * dpo);
322 extern void sr_dpo_unlock (dpo_id_t * dpo);
323 
324 extern int
326  u8 * keyword_str, u8 * def_str,
327  u8 * params_str, u8 prefix_length,
328  dpo_type_t * dpo,
329  format_function_t * ls_format,
330  unformat_function_t * ls_unformat,
331  sr_plugin_callback_t * creation_fn,
332  sr_plugin_callback_t * removal_fn);
333 
334 extern int
336  u8 * keyword_str, u8 * def_str,
337  u8 * params_str, u8 prefix_length,
338  dpo_type_t * dpo,
339  format_function_t * ls_format,
340  unformat_function_t * ls_unformat,
341  sr_p_plugin_callback_t * creation_fn,
342  sr_p_plugin_callback_t * removal_fn);
343 
344 extern int
345 sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments,
346  u32 weight, u8 behavior, u32 fib_table, u8 is_encap,
347  u16 plugin, void *plugin_mem);
348 extern int sr_policy_mod (ip6_address_t * bsid, u32 index, u32 fib_table,
349  u8 operation, ip6_address_t * segments,
351 extern int sr_policy_del (ip6_address_t * bsid, u32 index);
352 
353 extern int
354 sr_cli_localsid (char is_del, ip6_address_t * localsid_addr,
355  u16 localsid_prefix_len, char end_psp, u8 behavior,
356  u32 sw_if_index, u32 vlan_index, u32 fib_table,
357  ip46_address_t * nh_addr, int usid_len, void *ls_plugin_mem);
358 
359 extern int
360 sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
361  u32 table_id, ip46_address_t * prefix, u32 mask_width,
362  u32 sw_if_index, u8 traffic_type);
363 
364 extern void sr_set_source (ip6_address_t * address);
365 extern ip6_address_t *sr_get_encaps_source ();
366 
367 extern void sr_set_hop_limit (u8 hop_limit);
368 extern u8 sr_get_hop_limit (void);
369 
370 /**
371  * @brief SR rewrite string computation for SRH insertion (inline)
372  *
373  * @param sl is a vector of IPv6 addresses composing the Segment List
374  *
375  * @return precomputed rewrite string for SRH insertion
376  */
377 static inline u8 *
379 {
380  ip6_sr_header_t *srh;
381  ip6_address_t *addrp, *this_address;
382  u32 header_length = 0;
383  u8 *rs = NULL;
384 
385  header_length = 0;
386  header_length += sizeof (ip6_sr_header_t);
387  header_length += (vec_len (sl) + 1) * sizeof (ip6_address_t);
388 
389  vec_validate (rs, header_length - 1);
390 
391  srh = (ip6_sr_header_t *) rs;
393  srh->segments_left = vec_len (sl);
394  srh->last_entry = vec_len (sl);
395  srh->length = ((sizeof (ip6_sr_header_t) +
396  ((vec_len (sl) + 1) * sizeof (ip6_address_t))) / 8) - 1;
397  srh->flags = 0x00;
398  srh->tag = 0x0000;
399  addrp = srh->segments + vec_len (sl);
400  vec_foreach (this_address, sl)
401  {
402  clib_memcpy_fast (addrp->as_u8, this_address->as_u8,
403  sizeof (ip6_address_t));
404  addrp--;
405  }
406  return rs;
407 }
408 
409 #endif /* included_vnet_sr_h */
410 
411 /*
412  * fd.io coding-style-patch-verification: ON
413  *
414  * Local Variables:
415  * eval: (c-set-style "gnu")
416  * End:
417  */
ip6_sr_localsid_t::end_psp
char end_psp
Combined with End.PSP?
Definition: sr.h:128
ip6_sr_policy_t::is_encap
u8 is_encap
Mode (0 is SRH insert, 1 Encaps)
Definition: sr.h:111
sr_localsid_fn_registration_t::sr_localsid_function_number
u16 sr_localsid_function_number
SR LocalSID plugin function (>SR_BEHAVIOR_LAST)
Definition: sr.h:165
weight
u8 weight
Definition: fib_types.api:120
sr_dpo_lock
void sr_dpo_lock(dpo_id_t *dpo)
no-op lock function.
Definition: sr.c:38
sr_steering_key_t::prefix
ip46_address_t prefix
IP address of the prefix.
Definition: sr.h:228
ip6_sr_main_t::sr_ls_valid_counters
vlib_combined_counter_main_t sr_ls_valid_counters
Definition: sr.h:302
sr_dpo_unlock
void sr_dpo_unlock(dpo_id_t *dpo)
no-op unlock function.
Definition: sr.c:47
ip6_sr_localsid_t::usid_block
ip6_address_t usid_block
Definition: sr.h:146
sr_policy_fn_registration_t::ls_unformat
unformat_function_t * ls_unformat
LocalSID unformat function.
Definition: sr.h:209
ip6_sr_localsid_t
SR LocalSID.
Definition: sr.h:122
sr_localsid_register_function
int sr_localsid_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_plugin_callback_t *creation_fn, sr_plugin_callback_t *removal_fn)
SR LocalSID plugin registry.
Definition: sr_localsid.c:2347
ip6_sr_main_t::l2_sr_policy_rewrite_index
u32 l2_sr_policy_rewrite_index
Definition: sr.h:260
sl_index
u32 sl_index
Definition: sr.api:35
sr_policy_fn_registration_t::creation
sr_p_plugin_callback_t * creation
Function within plugin that will be called after localsid creation.
Definition: sr.h:211
string.h
sr_localsid_fn_registration_t::ls_format
format_function_t * ls_format
LocalSID format function.
Definition: sr.h:179
ip6_sr_localsid_t::plugin_mem
void * plugin_mem
Memory to be used by the plugin callback functions.
Definition: sr.h:155
ip6_sr_main_t::plugin_functions_by_key
uword * plugin_functions_by_key
Definition: sr.h:293
padding
u32 padding
Definition: vhost_user.h:124
mhash_t
Definition: mhash.h:46
sr_localsid_fn_registration_t::params_str
u8 * params_str
Behavior parameters (i.e.
Definition: sr.h:173
ip6_sr_localsid_t::sw_if_index
u32 sw_if_index
xconnect only
Definition: sr.h:134
ip6_sr_sl_t::plugin
u16 plugin
Definition: sr.h:85
ip6_sr_localsid_t::next_hop
ip46_address_t next_hop
Next_hop for xconnect usage only.
Definition: sr.h:142
ip6_sr_main_t::steer_policies
ip6_sr_steering_policy_t * steer_policies
Definition: sr.h:278
u16
unsigned short u16
Definition: types.h:57
ip6_sr_sl_t::plugin_mem
void * plugin_mem
Definition: sr.h:86
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
ip6_sr_localsid_t::usid_block_mask
ip6_address_t usid_block_mask
Definition: sr.h:147
ip6_sr_main_t::sw_iface_sr_policies
u32 * sw_iface_sr_policies
Definition: sr.h:284
ip6_sr_localsid_t::usid_len
u8 usid_len
Definition: sr.h:150
ip6_sr_main_t::policy_plugin_functions_by_key
uword * policy_plugin_functions_by_key
Definition: sr.h:299
ip6_sr_localsid_t::usid_next_len
u8 usid_next_len
Definition: sr.h:153
def_str
unsigned char def_str[64]
Definition: srv6_localsid_sample.c:30
sr_policy_fn_registration_t::ls_format
format_function_t * ls_format
LocalSID format function.
Definition: sr.h:207
ip6_sr_sl_t::rewrite
u8 * rewrite
Precomputed rewrite header.
Definition: sr.h:76
sr_cli_localsid
int sr_cli_localsid(char is_del, ip6_address_t *localsid_addr, u16 localsid_prefix_len, char end_psp, u8 behavior, u32 sw_if_index, u32 vlan_index, u32 fib_table, ip46_address_t *nh_addr, int usid_len, void *ls_plugin_mem)
SR localsid add/del.
Definition: sr_localsid.c:77
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
ip6_sr_localsid_t::vlan_index
u32 vlan_index
VLAN tag (not an index)
Definition: sr.h:140
ip6_sr_header_t::segments
ip6_address_t segments[0]
Definition: sr_packet.h:149
ethernet.h
sr_policy_fn_registration_t::removal
sr_p_plugin_callback_t * removal
Function within plugin that will be called before localsid removal.
Definition: sr.h:213
ip6_sr_steering_policy_t::classify
sr_steering_key_t classify
Traffic classification.
Definition: sr.h:243
sr_packet.h
ip6srv_combo_header_t::sr
ip6_sr_header_t sr
Definition: sr.h:63
mask_width
u8 mask_width
Definition: dhcp.api:204
ip6_sr_header_t::type
u8 type
Definition: sr_packet.h:130
sr_localsid_fn_registration_t::dpo
dpo_type_t dpo
DPO type registration.
Definition: sr.h:177
ip6_packet.h
ip6_sr_sl_t::ip4_dpo
dpo_id_t ip4_dpo
DPO for Encaps IPv6.
Definition: sr.h:83
ip6_sr_policy_t::plugin_mem
void * plugin_mem
Definition: sr.h:114
ip6_sr_policy_t
SR Policy.
Definition: sr.h:95
ip6_sr_main_t::sr_ls_invalid_counters
vlib_combined_counter_main_t sr_ls_invalid_counters
Definition: sr.h:303
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
sr_steering_key_t::mask_width
u32 mask_width
Mask width of the prefix.
Definition: sr.h:229
ip6_sr_main_t::vnet_main
vnet_main_t * vnet_main
Definition: sr.h:311
sr_steering_key_t::fib_table
u32 fib_table
VRF of the prefix.
Definition: sr.h:230
fn_name
static u8 fn_name[]
Definition: gtp4_d.c:66
sr_policy_rewrite_insert_node
vlib_node_registration_t sr_policy_rewrite_insert_node
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node)
Definition: sr_policy_rewrite.c:2658
sr_steering_key_t::traffic_type
u8 traffic_type
Traffic type (IPv4, IPv6, L2)
Definition: sr.h:237
ip6_sr_sl_t::egress_fib_table
u32 egress_fib_table
Egress FIB table for encap packet.
Definition: sr.h:79
ip6_sr_sl_t
SR Segment List (SID list)
Definition: sr.h:70
ip6_sr_main_t::vlib_main
vlib_main_t * vlib_main
Definition: sr.h:310
sr_p_plugin_callback_t
int() sr_p_plugin_callback_t(ip6_sr_policy_t *sr)
Definition: sr.h:117
ip6_sr_header_t::flags
u8 flags
Definition: sr_packet.h:145
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.
Definition: sr_policy_rewrite.c:831
sr_policy_del
int sr_policy_del(ip6_address_t *bsid, u32 index)
Delete a SR policy.
Definition: sr_policy_rewrite.c:723
ip6_sr_policy_t::segments_lists
u32 * segments_lists
SID lists indexes (vector)
Definition: sr.h:97
ip6_sr_header_t::segments_left
u8 segments_left
Definition: sr_packet.h:133
sr_policy_rewrite_encaps_node
vlib_node_registration_t sr_policy_rewrite_encaps_node
(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node)
Definition: sr_policy_rewrite.c:1501
sr_set_source
void sr_set_source(ip6_address_t *address)
Definition: sr_policy_rewrite.c:117
uword
u64 uword
Definition: types.h:112
sr_localsid_d_node
vlib_node_registration_t sr_localsid_d_node
(constructor) VLIB_REGISTER_NODE (sr_localsid_d_node)
Definition: sr_localsid.c:1442
ip6_sr_main_t::policy_plugin_functions
sr_policy_fn_registration_t * policy_plugin_functions
Definition: sr.h:296
sr_policy_fn_registration_t::function_name
u8 * function_name
Function name.
Definition: sr.h:195
ip6_sr_steering_policy_t::sr_policy
u32 sr_policy
SR Policy index.
Definition: sr.h:244
dpo_type_t
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type()
sr_get_encaps_source
ip6_address_t * sr_get_encaps_source()
Definition: sr_policy_rewrite.c:123
ip6_sr_sl_t::weight
u32 weight
SID list weight (wECMP / UCMP)
Definition: sr.h:74
sr_steering_key_t::sw_if_index
u32 sw_if_index
Incoming software interface.
Definition: sr.h:234
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
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: sr_policy_rewrite.c:3396
address
manual_print typedef address
Definition: ip_types.api:96
ip6_sr_policy_t::bsid_dpo
dpo_id_t bsid_dpo
SR Policy specific DPO - BSID.
Definition: sr.h:105
ip6_sr_policy_t::ip4_dpo
dpo_id_t ip4_dpo
SR Policy specific DPO - IPv6.
Definition: sr.h:106
sr_steering_policy
int sr_steering_policy(int is_del, ip6_address_t *bsid, u32 sr_policy_index, u32 table_id, ip46_address_t *prefix, u32 mask_width, u32 sw_if_index, u8 traffic_type)
Steer traffic L2 and L3 traffic through a given SR policy.
Definition: sr_steering.c:60
hop_limit
u8 hop_limit
Definition: tunnel_types.api:88
ip6_sr_header_t::length
u8 length
Definition: sr_packet.h:127
sr_policy_fn_registration_t::prefix_length
u8 prefix_length
Definition: sr.h:203
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
ip6_sr_localsid_t::nh_adj
u32 nh_adj
Next_adj for xconnect usage only.
Definition: sr.h:144
sr_plugin_callback_t
int() sr_plugin_callback_t(ip6_sr_localsid_t *localsid)
Definition: sr.h:158
params_str
unsigned char params_str[32]
Definition: srv6_localsid_sample.c:31
sr_localsid_fn_registration_t::ls_unformat
unformat_function_t * ls_unformat
LocalSID unformat function.
Definition: sr.h:181
ip6_sr_main_t::localsids
ip6_sr_localsid_t * localsids
Definition: sr.h:272
sr_localsid_fn_registration_t::prefix_length
u8 prefix_length
Definition: sr.h:175
keyword_str
unsigned char keyword_str[32]
Definition: srv6_localsid_sample.c:29
sr_policy_fn_registration_t::keyword_str
u8 * keyword_str
Behavior keyword (i.e.
Definition: sr.h:197
ip6_sr_header_t::last_entry
u8 last_entry
Definition: sr_packet.h:136
format_function_t
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
ip6_sr_main_t
Segment Routing main datastructure.
Definition: sr.h:257
vnet_main_t
Definition: vnet.h:76
index
u32 index
Definition: flow_types.api:221
ip6_sr_policy_t::bsid
ip6_address_t bsid
BindingSID (key)
Definition: sr.h:99
ip6_sr_localsid_t::usid_index
u8 usid_index
Definition: sr.h:149
sr_localsid_node
vlib_node_registration_t sr_localsid_node
(constructor) VLIB_REGISTER_NODE (sr_localsid_node)
Definition: sr_localsid.c:1752
ip6_sr_policy_t::type
u8 type
Type (default is 0)
Definition: sr.h:101
ip6_sr_localsid_t::localsid
ip6_address_t localsid
LocalSID IPv6 address.
Definition: sr.h:124
sr_policy_fn_registration_t::dpo
dpo_type_t dpo
DPO type registration.
Definition: sr.h:205
vlib_combined_counter_main_t
A collection of combined counters.
Definition: counter.h:203
sr_localsid_fn_registration_t::creation
sr_plugin_callback_t * creation
Function within plugin that will be called after localsid creation.
Definition: sr.h:183
ip6srv_combo_header_t
Definition: sr.h:60
ip6_sr_localsid_t::vrf_index
u32 vrf_index
vrf only
Definition: sr.h:135
ip6_sr_sl_t::segments
ip6_address_t * segments
SIDs (key)
Definition: sr.h:72
u32
unsigned int u32
Definition: types.h:88
sr_set_hop_limit
void sr_set_hop_limit(u8 hop_limit)
Definition: sr_policy_rewrite.c:154
table_id
u32 table_id
Definition: wireguard.api:102
nh_addr
vl_api_address_t nh_addr
Definition: lisp_gpe.api:222
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
sr_localsid_fn_registration_t::function_name
u8 * function_name
Function name.
Definition: sr.h:167
ROUTING_HEADER_TYPE_SR
#define ROUTING_HEADER_TYPE_SR
Definition: sr_packet.h:117
ip6_sr_localsid_t::localsid_prefix_len
u16 localsid_prefix_len
Definition: sr.h:126
unformat_function_t
uword() unformat_function_t(unformat_input_t *input, va_list *args)
Definition: format.h:225
sr_localsid_key_t
Definition: sr.h:247
ip6_sr_header_t
Definition: sr_packet.h:119
ip6_header_t
Definition: ip6_packet.h:294
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 *plugin_mem)
Create a new SR policy.
Definition: sr_policy_rewrite.c:635
sr_localsid_key_t::address
ip6_address_t address
Definition: sr.h:249
ip6_sr_main_t::sr_steer_policies_hash
mhash_t sr_steer_policies_hash
Definition: sr.h:281
sr_policy_fn_registration_t::def_str
u8 * def_str
Behavior definition (i.e.
Definition: sr.h:199
vlib_main_t
Definition: main.h:102
ip6_sr_main_t::sr_pr_spray_dpo_type
dpo_type_t sr_pr_spray_dpo_type
Definition: sr.h:287
sr_steering_key_t
Steering db key.
Definition: sr.h:222
sr_localsid_key_t::pref_len
u16 pref_len
Definition: sr.h:250
sr_localsid_fn_registration_t::removal
sr_plugin_callback_t * removal
Function within plugin that will be called before localsid removal.
Definition: sr.h:185
u8
unsigned char u8
Definition: types.h:56
sr_main
ip6_sr_main_t sr_main
Definition: sr.c:31
ip6_sr_main_t::fib_table_ip6
u32 fib_table_ip6
Definition: sr.h:306
ip6_sr_sl_t::ip6_dpo
dpo_id_t ip6_dpo
DPO for Encaps/Insert IPv6.
Definition: sr.h:82
ip6_sr_main_t::plugin_functions
sr_localsid_fn_registration_t * plugin_functions
Definition: sr.h:290
ip6_sr_header_t::tag
u16 tag
Definition: sr_packet.h:146
sr_get_hop_limit
u8 sr_get_hop_limit(void)
Definition: sr_policy_rewrite.c:160
ip6_sr_compute_rewrite_string_insert
static u8 * ip6_sr_compute_rewrite_string_insert(ip6_address_t *sl)
SR rewrite string computation for SRH insertion (inline)
Definition: sr.h:378
sr_policy_fn_registration_t
SR Policy behavior registration.
Definition: sr.h:191
ip6_sr_policy_t::fib_table
u32 fib_table
FIB table.
Definition: sr.h:109
ip6_sr_main_t::sr_policies
ip6_sr_policy_t * sr_policies
Definition: sr.h:266
ip6_sr_policy_t::ip6_dpo
dpo_id_t ip6_dpo
SR Policy specific DPO - IPv4.
Definition: sr.h:107
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
sr_policy_fn_registration_t::params_str
u8 * params_str
Behavior parameters (i.e.
Definition: sr.h:201
sr_policy_fn_registration_t::sr_policy_function_number
u16 sr_policy_function_number
SR Policy plugin function.
Definition: sr.h:193
vnet.h
ip6_sr_steering_policy_t
Definition: sr.h:241
ip6_sr_sl_t::bsid_dpo
dpo_id_t bsid_dpo
DPO for Encaps/Insert for BSID.
Definition: sr.h:81
ip6_sr_main_t::sid_lists
ip6_sr_sl_t * sid_lists
Definition: sr.h:263
ip6_sr_localsid_t::behavior
u16 behavior
Behavior associated to this localsid.
Definition: sr.h:130
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
sr_localsid_fn_registration_t::keyword_str
u8 * keyword_str
Behavior keyword (i.e.
Definition: sr.h:169
ip6_sr_localsid_t::fib_table
u32 fib_table
FIB table where localsid is registered.
Definition: sr.h:138
ip6_sr_main_t::sr_policies_index_hash
mhash_t sr_policies_index_hash
Definition: sr.h:269
ip6_sr_main_t::fib_table_ip4
u32 fib_table_ip4
Definition: sr.h:307
sr_localsid_fn_registration_t::def_str
u8 * def_str
Behavior definition (i.e.
Definition: sr.h:171
ip6srv_combo_header_t::ip
ip6_header_t ip
Definition: sr.h:62
ip6_sr_policy_t::plugin
u16 plugin
Definition: sr.h:113
sr_localsid_fn_registration_t
SR LocalSID behavior registration.
Definition: sr.h:163
ip6_sr_main_t::sr_localsids_index_hash
mhash_t sr_localsids_index_hash
Definition: sr.h:275
ip6_sr_sl_t::rewrite_bsid
u8 * rewrite_bsid
Precomputed rewrite header for bindingSID.
Definition: sr.h:77
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
ip6_sr_localsid_t::usid_next_index
u8 usid_next_index
Definition: sr.h:152