FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
udp_encap.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 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 #include <vnet/udp/udp_encap.h>
17 #include <vnet/fib/fib_entry.h>
19 #include <vnet/fib/fib_table.h>
20 #include <vnet/dpo/drop_dpo.h>
21 
22 /**
23  * Registered DPO types for the IP header encapsulated, v4 or v6.
24  */
26 
27 /**
28  * Pool of encaps
29  */
31 
32 /**
33  * Stats for each UDP encap object
34  */
36  /**
37  * The counter collection's name.
38  */
39  .name = "udp-encap",
40  /**
41  * Name in stat segment directory
42  */
43  .stat_segment_name = "/net/udp-encap",
44 };
45 
46 static void
48 {
51  &ue->ue_dpo,
53 }
54 
55 index_t
57  index_t fib_index,
58  const ip46_address_t * src_ip,
59  const ip46_address_t * dst_ip,
60  u16 src_port,
62 {
63  udp_encap_t *ue;
64  u8 pfx_len = 0;
65  index_t uei;
66 
68  uei = ue - udp_encap_pool;
69 
72 
75  ue->ue_fib_index = fib_index;
76  ue->ue_flags = flags;
77  ue->ue_ip_proto = proto;
78 
79  switch (proto)
80  {
81  case FIB_PROTOCOL_IP4:
82  pfx_len = 32;
83  ue->ue_hdrs.ip4.ue_ip4.ip_version_and_header_length = 0x45;
84  ue->ue_hdrs.ip4.ue_ip4.ttl = 254;
85  ue->ue_hdrs.ip4.ue_ip4.protocol = IP_PROTOCOL_UDP;
86  ue->ue_hdrs.ip4.ue_ip4.src_address.as_u32 = src_ip->ip4.as_u32;
87  ue->ue_hdrs.ip4.ue_ip4.dst_address.as_u32 = dst_ip->ip4.as_u32;
88  ue->ue_hdrs.ip4.ue_ip4.checksum =
89  ip4_header_checksum (&ue->ue_hdrs.ip4.ue_ip4);
90  ue->ue_hdrs.ip4.ue_udp.src_port = clib_host_to_net_u16 (src_port);
91  ue->ue_hdrs.ip4.ue_udp.dst_port = clib_host_to_net_u16 (dst_port);
92 
93  break;
94  case FIB_PROTOCOL_IP6:
95  pfx_len = 128;
96  ue->ue_hdrs.ip6.ue_ip6.ip_version_traffic_class_and_flow_label =
97  clib_host_to_net_u32 (6 << 28);
98  ue->ue_hdrs.ip6.ue_ip6.hop_limit = 255;
99  ue->ue_hdrs.ip6.ue_ip6.protocol = IP_PROTOCOL_UDP;
100  ue->ue_hdrs.ip6.ue_ip6.src_address.as_u64[0] = src_ip->ip6.as_u64[0];
101  ue->ue_hdrs.ip6.ue_ip6.src_address.as_u64[1] = src_ip->ip6.as_u64[1];
102  ue->ue_hdrs.ip6.ue_ip6.dst_address.as_u64[0] = dst_ip->ip6.as_u64[0];
103  ue->ue_hdrs.ip6.ue_ip6.dst_address.as_u64[1] = dst_ip->ip6.as_u64[1];
104  ue->ue_hdrs.ip6.ue_udp.src_port = clib_host_to_net_u16 (src_port);
105  ue->ue_hdrs.ip6.ue_udp.dst_port = clib_host_to_net_u16 (dst_port);
106 
107  break;
108  default:
109  ASSERT (0);
110  }
111 
112  /*
113  * track the destination address
114  */
115  fib_prefix_t dst_pfx = {
116  .fp_proto = proto,
117  .fp_len = pfx_len,
118  .fp_addr = *dst_ip,
119  };
120 
121  ue->ue_fib_entry_index = fib_entry_track (fib_index,
122  &dst_pfx,
124  uei, &ue->ue_fib_sibling);
125  udp_encap_restack (ue);
126 
127  return (uei);
128 }
129 
130 void
132  dpo_id_t * dpo)
133 {
134  if (INDEX_INVALID == uei)
135  {
136  dpo_copy (dpo, drop_dpo_get (proto));
137  }
138  else
139  {
140  udp_encap_t *ue;
141 
142  ue = udp_encap_get (uei);
143 
144  dpo_set (dpo, udp_encap_dpo_types[ue->ue_ip_proto], proto, uei);
145  }
146 }
147 
148 void
150 {
151  udp_encap_t *ue;
152 
153  ue = udp_encap_get (uei);
154 
155  if (NULL != ue)
156  {
157  fib_node_lock (&ue->ue_fib_node);
158  }
159 }
160 
161 void
163 {
164  udp_encap_t *ue;
165 
166  if (INDEX_INVALID == uei)
167  {
168  return;
169  }
170 
171  ue = udp_encap_get (uei);
172 
173  if (NULL != ue)
174  {
176  }
177 }
178 
179 static void
181 {
182  udp_encap_t *ue;
183 
184  ue = udp_encap_get (dpo->dpoi_index);
185 
186  fib_node_lock (&ue->ue_fib_node);
187 }
188 
189 static void
191 {
192  udp_encap_t *ue;
193 
194  ue = udp_encap_get (dpo->dpoi_index);
195 
197 }
198 
199 static u8 *
200 format_udp_encap_i (u8 * s, va_list * args)
201 {
202  index_t uei = va_arg (*args, index_t);
203  u32 indent = va_arg (*args, u32);
204  u32 details = va_arg (*args, u32);
206  udp_encap_t *ue;
207 
208  ue = udp_encap_get (uei);
209 
210  // FIXME
211  s = format (s, "udp-encap:[%d]: ip-fib-index:%d ", uei, ue->ue_fib_index);
212  if (FIB_PROTOCOL_IP4 == ue->ue_ip_proto)
213  {
214  s = format (s, "ip:[src:%U, dst:%U] udp:[src:%d, dst:%d]",
216  &ue->ue_hdrs.ip4.ue_ip4.src_address,
218  &ue->ue_hdrs.ip4.ue_ip4.dst_address,
219  clib_net_to_host_u16 (ue->ue_hdrs.ip4.ue_udp.src_port),
220  clib_net_to_host_u16 (ue->ue_hdrs.ip4.ue_udp.dst_port));
221  }
222  else
223  {
224  s = format (s, "ip:[src:%U, dst:%U] udp:[src:%d dst:%d]",
226  &ue->ue_hdrs.ip6.ue_ip6.src_address,
228  &ue->ue_hdrs.ip6.ue_ip6.dst_address,
229  clib_net_to_host_u16 (ue->ue_hdrs.ip6.ue_udp.src_port),
230  clib_net_to_host_u16 (ue->ue_hdrs.ip6.ue_udp.dst_port));
231  }
233  s = format (s, " to:[%Ld:%Ld]]", to.packets, to.bytes);
234 
235  if (details)
236  {
237  s = format (s, " locks:%d", ue->ue_fib_node.fn_locks);
238  s = format (s, "\n%UStacked on:", format_white_space, indent + 1);
239  s = format (s, "\n%U%U",
240  format_white_space, indent + 2,
241  format_dpo_id, &ue->ue_dpo, indent + 3);
242  }
243  return (s);
244 }
245 
246 void
248 {
250 
252 
253  *packets = to.packets;
254  *bytes = to.bytes;
255 }
256 
257 static u8 *
258 format_udp_encap_dpo (u8 * s, va_list * args)
259 {
260  index_t uei = va_arg (*args, index_t);
261  u32 indent = va_arg (*args, u32);
262 
263  return (format (s, "%U", format_udp_encap_i, uei, indent, 1));
264 }
265 
266 u8 *
267 format_udp_encap (u8 * s, va_list * args)
268 {
269  index_t uei = va_arg (*args, u32);
270  u32 details = va_arg (*args, u32);
271 
272  return (format (s, "%U", format_udp_encap_i, uei, 0, details));
273 }
274 
275 static udp_encap_t *
277 {
278  ASSERT (FIB_NODE_TYPE_UDP_ENCAP == node->fn_type);
279  return ((udp_encap_t *) (((char *) node) -
280  STRUCT_OFFSET_OF (udp_encap_t, ue_fib_node)));
281 }
282 
283 /**
284  * Function definition to backwalk a FIB node
285  */
288 {
290 
292 }
293 
294 /**
295  * Function definition to get a FIB node from its index
296  */
297 static fib_node_t *
299 {
300  udp_encap_t *ue;
301 
303 
304  return (&ue->ue_fib_node);
305 }
306 
307 /**
308  * Function definition to inform the FIB node that its last lock has gone.
309  */
310 static void
312 {
313  udp_encap_t *ue;
314 
316 
317  /**
318  * reset the stacked DPO to unlock it
319  */
320  dpo_reset (&ue->ue_dpo);
321 
323 
324  pool_put (udp_encap_pool, ue);
325 }
326 
327 const static char *const udp4_encap_ip4_nodes[] = {
328  "udp4-encap",
329  NULL,
330 };
331 
332 const static char *const udp4_encap_ip6_nodes[] = {
333  "udp4-encap",
334  NULL,
335 };
336 
337 const static char *const udp4_encap_mpls_nodes[] = {
338  "udp4-encap",
339  NULL,
340 };
341 
342 const static char *const udp4_encap_bier_nodes[] = {
343  "udp4-encap",
344  NULL,
345 };
346 
347 const static char *const udp6_encap_ip4_nodes[] = {
348  "udp6-encap",
349  NULL,
350 };
351 
352 const static char *const udp6_encap_ip6_nodes[] = {
353  "udp6-encap",
354  NULL,
355 };
356 
357 const static char *const udp6_encap_mpls_nodes[] = {
358  "udp6-encap",
359  NULL,
360 };
361 
362 const static char *const udp6_encap_bier_nodes[] = {
363  "udp6-encap",
364  NULL,
365 };
366 
367 const static char *const *const udp4_encap_nodes[DPO_PROTO_NUM] = {
372 };
373 
374 const static char *const *const udp6_encap_nodes[DPO_PROTO_NUM] = {
379 };
380 
381 /*
382  * Virtual function table registered by UDP encaps
383  * for participation in the FIB object graph.
384  */
387  .fnv_last_lock = udp_encap_fib_last_lock_gone,
388  .fnv_back_walk = udp_encap_fib_back_walk,
389 };
390 
391 const static dpo_vft_t udp_encap_dpo_vft = {
393  .dv_unlock = udp_encap_dpo_unlock,
394  .dv_format = format_udp_encap_dpo,
395 };
396 
397 clib_error_t *
399 {
401 
406 
407  return (NULL);
408 }
409 
411 
412 clib_error_t *
414  unformat_input_t * main_input, vlib_cli_command_t * cmd)
415 {
416  unformat_input_t _line_input, *line_input = &_line_input;
417  clib_error_t *error = NULL;
418  ip46_address_t src_ip, dst_ip;
421  fib_protocol_t fproto;
422  index_t uei;
423  u8 is_del;
424 
425  is_del = 0;
426  table_id = 0;
428  fproto = FIB_PROTOCOL_MAX;
429  dst_port = 0;
430  uei = ~0;
431 
432  /* Get a line of input. */
433  if (!unformat_user (main_input, unformat_line_input, line_input))
434  return 0;
435 
436  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
437  {
438  if (unformat (line_input, "index %d", &uei))
439  ;
440  else if (unformat (line_input, "add"))
441  is_del = 0;
442  else if (unformat (line_input, "del"))
443  is_del = 1;
444  else if (unformat (line_input, "%U %U",
446  &src_ip.ip4, unformat_ip4_address, &dst_ip.ip4))
447  fproto = FIB_PROTOCOL_IP4;
448  else if (unformat (line_input, "%U %U",
450  &src_ip.ip6, unformat_ip6_address, &dst_ip.ip6))
451  fproto = FIB_PROTOCOL_IP6;
452  else if (unformat (line_input, "%d %d", &src_port, &dst_port))
453  ;
454  else if (unformat (line_input, "%d", &dst_port))
455  ;
456  else if (unformat (line_input, "table-id %d", &table_id))
457  ;
458  else if (unformat (line_input, "src-port-is-entropy"))
460  else
461  {
462  error = unformat_parse_error (line_input);
463  goto done;
464  }
465  }
466 
467  if (!is_del && fproto != FIB_PROTOCOL_MAX)
468  {
469  u32 fib_index;
470  index_t uei;
471 
472  fib_index = fib_table_find (fproto, table_id);
473 
474  if (~0 == fib_index)
475  {
476  error = clib_error_return (0, "Nonexistent table id %d", table_id);
477  goto done;
478  }
479 
480  uei = udp_encap_add_and_lock (fproto, fib_index,
481  &src_ip, &dst_ip,
483 
484  vlib_cli_output (vm, "udp-encap: %d\n", uei);
485  }
486  else if (is_del)
487  {
488  if (INDEX_INVALID == uei)
489  {
490  error = clib_error_return (0, "specify udp-encap object index");
491  goto done;
492  }
493  udp_encap_unlock (uei);
494  }
495  else
496  {
497  error = clib_error_return (0, "specify some IP addresses");
498  }
499 
500 done:
501  unformat_free (line_input);
502  return error;
503 }
504 
505 void
507 {
508  index_t uei;
509 
510  /* *INDENT-OFF* */
512  {
513  if (WALK_STOP == cb(uei, ctx))
514  break;
515  }
516  /* *INDENT-ON* */
517 }
518 
519 clib_error_t *
521  unformat_input_t * input, vlib_cli_command_t * cmd)
522 {
523  index_t uei;
524 
525  uei = INDEX_INVALID;
526 
527  /* Get a line of input. */
529  {
530  if (unformat (input, "%d", &uei))
531  ;
532  else
533  return clib_error_return (0, "unknown input `%U'",
534  format_unformat_error, input);
535  }
536 
537  if (INDEX_INVALID == uei)
538  {
539  /* *INDENT-OFF* */
541  {
542  vlib_cli_output(vm, "%U", format_udp_encap, uei, 0);
543  }
544  /* *INDENT-ON* */
545  }
546  else
547  {
548  vlib_cli_output (vm, "%U", format_udp_encap, uei, 1);
549  }
550 
551  return NULL;
552 }
553 
554 /* *INDENT-OFF* */
556  .path = "udp encap",
557  .short_help = "udp encap [add|del] <id ID> <src-ip> <dst-ip> [<src-port>] <dst-port> [src-port-is-entropy] [table-id <table>]",
558  .function = udp_encap_cli,
559  .is_mp_safe = 1,
560 };
562  .path = "show udp encap",
563  .short_help = "show udp encap [ID]",
564  .function = udp_encap_show,
565  .is_mp_safe = 1,
566 };
567 /* *INDENT-ON* */
568 
569 /*
570  * fd.io coding-style-patch-verification: ON
571  *
572  * Local Variables:
573  * eval: (c-set-style "gnu")
574  * End:
575  */
udp_encap_counters
vlib_combined_counter_main_t udp_encap_counters
Stats for each UDP encap object.
Definition: udp_encap.c:35
to
u32 * to
Definition: interface_output.c:1096
FIB_PROTOCOL_MAX
#define FIB_PROTOCOL_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements.
Definition: fib_types.h:51
fib_entry.h
dpo_register_new_type
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
Definition: dpo.c:349
udp_encap_restack
static void udp_encap_restack(udp_encap_t *ue)
Definition: udp_encap.c:47
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
dst_port
vl_api_ip_port_and_mask_t dst_port
Definition: flow_types.api:92
udp_encap_from_fib_node
static udp_encap_t * udp_encap_from_fib_node(fib_node_t *node)
Definition: udp_encap.c:276
udp4_encap_ip6_nodes
const static char *const udp4_encap_ip6_nodes[]
Definition: udp_encap.c:332
udp_encap_get_stats
void udp_encap_get_stats(index_t uei, u64 *packets, u64 *bytes)
Definition: udp_encap.c:247
fib_node_back_walk_rc_t
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
format_ip4_address
format_function_t format_ip4_address
Definition: format.h:73
udp_encap_t_::ue_fib_index
index_t ue_fib_index
The FIB index in which the encap destination resides.
Definition: udp_encap.h:104
pool_get_aligned_zero
#define pool_get_aligned_zero(P, E, A)
Allocate an object E from a pool P with alignment A and zero it.
Definition: pool.h:252
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
udp_encap_pool
udp_encap_t * udp_encap_pool
Pool of encaps.
Definition: udp_encap.c:30
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
udp_encap_contribute_forwarding
void udp_encap_contribute_forwarding(index_t uei, dpo_proto_t proto, dpo_id_t *dpo)
Definition: udp_encap.c:131
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
fib_entry_untrack
void fib_entry_untrack(fib_node_index_t fei, u32 sibling)
Stop tracking a FIB entry.
Definition: fib_entry_track.c:79
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
fib_node_vft_t_
A FIB graph nodes virtual function table.
Definition: fib_node.h:288
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
vlib_cli_command_t::path
char * path
Definition: cli.h:96
udp_encap_walk_cb_t
walk_rc_t(* udp_encap_walk_cb_t)(index_t uei, void *ctx)
Callback function invoked when walking all encap objects.
Definition: udp_encap.h:128
fib_table.h
udp_encap_dpo_unlock
static void udp_encap_dpo_unlock(dpo_id_t *dpo)
Definition: udp_encap.c:190
u16
unsigned short u16
Definition: types.h:57
fib_node_t_::fn_locks
u32 fn_locks
Number of dependents on this node.
Definition: fib_node.h:321
vlib_validate_combined_counter
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
Definition: counter.c:119
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
udp_encap_t_::ip4
struct udp_encap_t_::@565::@566 ip4
unformat_parse_error
#define unformat_parse_error(input)
Definition: format.h:261
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
udp_encap_t_::ip6
struct udp_encap_t_::@565::@567 ip6
DPO_PROTO_BIER
@ DPO_PROTO_BIER
Definition: dpo.h:68
vlib_combined_counter_main_t::name
char * name
The counter collection's name.
Definition: counter.h:206
udp_encap_t_
The UDP encap representation.
Definition: udp_encap.h:46
unformat_input_t
struct _unformat_input_t unformat_input_t
udp_encap_init
clib_error_t * udp_encap_init(vlib_main_t *vm)
Definition: udp_encap.c:398
drop_dpo.h
udp_encap_fib_back_walk
static fib_node_back_walk_rc_t udp_encap_fib_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node.
Definition: udp_encap.c:287
error
Definition: cJSON.c:88
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
udp6_encap_bier_nodes
const static char *const udp6_encap_bier_nodes[]
Definition: udp_encap.c:362
fib_entry_track
fib_node_index_t fib_entry_track(u32 fib_index, const fib_prefix_t *prefix, fib_node_type_t child_type, index_t child_index, u32 *sibling)
Trackers are used on FIB entries by objects that which to track the changing state of the entry.
Definition: fib_entry_track.c:49
STRUCT_OFFSET_OF
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:73
udp4_encap_bier_nodes
const static char *const udp4_encap_bier_nodes[]
Definition: udp_encap.c:342
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
udp4_encap_mpls_nodes
const static char *const udp4_encap_mpls_nodes[]
Definition: udp_encap.c:337
dpo_stack
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
Definition: dpo.c:535
udp_encap.h
udp_encap_show
clib_error_t * udp_encap_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: udp_encap.c:520
fib_entry_contribute_ip_forwarding
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:506
vlib_counter_t
Combined counter to hold both packets and byte differences.
Definition: counter_types.h:26
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
format_udp_encap_i
static u8 * format_udp_encap_i(u8 *s, va_list *args)
Definition: udp_encap.c:200
udp_encap_t_::ue_flags
udp_encap_fixup_flags_t ue_flags
Flags controlling fixup behaviour.
Definition: udp_encap.h:78
dst_ip
vl_api_address_t dst_ip
Definition: udp.api:44
udp6_encap_mpls_nodes
const static char *const udp6_encap_mpls_nodes[]
Definition: udp_encap.c:357
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
UDP_ENCAP_FIXUP_UDP_SRC_PORT_ENTROPY
@ UDP_ENCAP_FIXUP_UDP_SRC_PORT_ENTROPY
UDP source port contains an entropy/hash value for load-balancing by downstream peers.
Definition: udp_encap.h:40
vlib_zero_combined_counter
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
Definition: counter.h:298
udp_encap_cli
clib_error_t * udp_encap_cli(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
Definition: udp_encap.c:413
udp_encap_fixup_flags_t
enum udp_encap_fixup_flags_t_ udp_encap_fixup_flags_t
UDP encapsulation.
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()
src_port
vl_api_ip_port_and_mask_t src_port
Definition: flow_types.api:91
UDP_ENCAP_FIXUP_NONE
@ UDP_ENCAP_FIXUP_NONE
Definition: udp_encap.h:36
udp_encap_unlock
void udp_encap_unlock(index_t uei)
Definition: udp_encap.c:162
udp_encap_get
static udp_encap_t * udp_encap_get(index_t uei)
Definition: udp_encap.h:141
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
udp_encap_t_::ue_ip_proto
fib_protocol_t ue_ip_proto
the protocol of the IP header imposed
Definition: udp_encap.h:83
udp_encap_t_::ue_fib_sibling
u32 ue_fib_sibling
Definition: udp_encap.h:99
fib_node_register_type
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:60
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
FIB_NODE_BACK_WALK_CONTINUE
@ FIB_NODE_BACK_WALK_CONTINUE
Definition: fib_node.h:259
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
fib_proto_to_dpo
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
format_dpo_id
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
Definition: dpo.c:150
udp_encap_t_::ue_fib_entry_index
fib_node_index_t ue_fib_entry_index
Tracking information for the IP destination.
Definition: udp_encap.h:98
fib_entry_track.h
format_udp_encap
u8 * format_udp_encap(u8 *s, va_list *args)
Definition: udp_encap.c:267
udp_encap_fib_vft
const static fib_node_vft_t udp_encap_fib_vft
Definition: udp_encap.c:385
udp6_encap_ip6_nodes
const static char *const udp6_encap_ip6_nodes[]
Definition: udp_encap.c:352
vlib_get_combined_counter
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
Definition: counter.h:272
index
u32 index
Definition: flow_types.api:221
dpo_copy
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:264
udp_encap_walk
void udp_encap_walk(udp_encap_walk_cb_t cb, void *ctx)
Walk each of the encap objects.
Definition: udp_encap.c:506
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:572
udp_encap_add_and_lock
index_t udp_encap_add_and_lock(fib_protocol_t proto, index_t fib_index, const ip46_address_t *src_ip, const ip46_address_t *dst_ip, u16 src_port, u16 dst_port, udp_encap_fixup_flags_t flags)
Definition: udp_encap.c:56
udp_encap_fib_node_get
static fib_node_t * udp_encap_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
Definition: udp_encap.c:298
u64
unsigned long u64
Definition: types.h:89
FIB_NODE_TYPE_UDP_ENCAP
@ FIB_NODE_TYPE_UDP_ENCAP
Definition: fib_node.h:46
udp_encap_dpo_types
dpo_type_t udp_encap_dpo_types[FIB_PROTOCOL_MAX]
Registered DPO types for the IP header encapsulated, v4 or v6.
Definition: udp_encap.c:25
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_combined_counter_main_t
A collection of combined counters.
Definition: counter.h:203
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
DPO_PROTO_MPLS
@ DPO_PROTO_MPLS
Definition: dpo.h:66
u32
unsigned int u32
Definition: types.h:88
udp6_encap_ip4_nodes
const static char *const udp6_encap_ip4_nodes[]
Definition: udp_encap.c:347
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
udp4_encap_ip4_nodes
const static char *const udp4_encap_ip4_nodes[]
Definition: udp_encap.c:327
table_id
u32 table_id
Definition: wireguard.api:102
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
udp_encap_show_command
static vlib_cli_command_t udp_encap_show_command
(constructor) VLIB_CLI_COMMAND (udp_encap_show_command)
Definition: udp_encap.c:561
udp_encap_t_::ue_dpo
dpo_id_t ue_dpo
The DPO used to forward to the next node in the VLIB graph.
Definition: udp_encap.h:73
fib_node_lock
void fib_node_lock(fib_node_t *node)
Definition: fib_node.c:203
src_ip
vl_api_address_t src_ip
Definition: wireguard.api:38
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
udp_encap_t_::ue_fib_node
fib_node_t ue_fib_node
linkage into the FIB graph
Definition: udp_encap.h:93
fib_node_t_
An node in the FIB graph.
Definition: fib_node.h:301
udp_encap_t_::ue_hdrs
union udp_encap_t_::@565 ue_hdrs
The headers to paint, in packet painting order.
vlib_main_t
Definition: main.h:102
drop_dpo_get
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
fib_node_init
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
fib_node_unlock
void fib_node_unlock(fib_node_t *node)
Definition: fib_node.c:209
ip4_header_checksum
static u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:314
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
format_ip6_address
format_function_t format_ip6_address
Definition: format.h:91
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
fib_node_back_walk_ctx_t_
Context passed between object during a back walk.
Definition: fib_node.h:214
udp_encap_add_command
static vlib_cli_command_t udp_encap_add_command
(constructor) VLIB_CLI_COMMAND (udp_encap_add_command)
Definition: udp_encap.c:555
fib_node_vft_t_::fnv_get
fib_node_get_t fnv_get
Definition: fib_node.h:289
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
unformat_ip6_address
unformat_function_t unformat_ip6_address
Definition: format.h:89
unformat_ip4_address
unformat_function_t unformat_ip4_address
Definition: format.h:68
dpo_set
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:188
udp6_encap_nodes
const static char *const *const udp6_encap_nodes[DPO_PROTO_NUM]
Definition: udp_encap.c:374
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
vlib_cli_command_t
Definition: cli.h:92
format_udp_encap_dpo
static u8 * format_udp_encap_dpo(u8 *s, va_list *args)
Definition: udp_encap.c:258
udp_encap_dpo_vft
const static dpo_vft_t udp_encap_dpo_vft
Definition: udp_encap.c:391
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
fib_table_find
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1111
udp_encap_lock
void udp_encap_lock(index_t uei)
Definition: udp_encap.c:149
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
WALK_STOP
@ WALK_STOP
Definition: interface_funcs.h:173
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
format_white_space
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
udp_encap_fib_last_lock_gone
static void udp_encap_fib_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
Definition: udp_encap.c:311
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
udp_encap_dpo_lock
static void udp_encap_dpo_lock(dpo_id_t *dpo)
Definition: udp_encap.c:180
packets
units packets
Definition: map.api:366
udp4_encap_nodes
const static char *const *const udp4_encap_nodes[DPO_PROTO_NUM]
Definition: udp_encap.c:367
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105