FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ipsec_itf.c
Go to the documentation of this file.
1 /*
2  * ipsec_itf.c: IPSec dedicated interface type
3  *
4  * Copyright (c) 2020 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vnet/ip/ip.h>
19 #include <vnet/ipsec/ipsec_itf.h>
20 #include <vnet/ipsec/ipsec_tun.h>
21 #include <vnet/ipsec/ipsec.h>
22 #include <vnet/adj/adj_midchain.h>
24 
25 /* bitmap of Allocated IPSEC_ITF instances */
27 
28 /* pool of interfaces */
30 
32 
35 {
36  return (pool_elt_at_index (ipsec_itf_pool, ii));
37 }
38 
39 static ipsec_itf_t *
41 {
43  return NULL;
45  if (ti == ~0)
46  return NULL;
48 }
49 
50 static u8 *
51 format_ipsec_itf_name (u8 * s, va_list * args)
52 {
53  u32 dev_instance = va_arg (*args, u32);
54  return format (s, "ipsec%d", dev_instance);
55 }
56 
57 void
59 {
61 }
62 
63 void
65 {
66  const vnet_hw_interface_t *hw;
67 
69 
71  {
72  const ipsec_sa_t *sa;
74 
75  sa = ipsec_sa_get (sai);
78  }
79  else
81 }
82 
83 static adj_walk_rc_t
85 {
86  ipsec_tun_protect_t *itp = arg;
87 
89 
90  return (ADJ_WALK_RC_CONTINUE);
91 }
92 
93 static void
95 {
98 
99  itp = ipsec_tun_protect_get (itpi);
100 
101  /*
102  * walk all the adjacencies on the interface and restack them
103  */
105  {
107  }
108 }
109 
110 static walk_rc_t
112 {
113  const ipsec_itf_t *itf = arg;
114 
115  ipsec_itf_restack (itpi, itf);
116 
117  return (WALK_CONTINUE);
118 }
119 
120 static clib_error_t *
122 {
124  ipsec_itf_t *itf;
125  u32 hw_flags;
126 
127  hi = vnet_get_hw_interface (vnm, hw_if_index);
128  hw_flags = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP ?
130  vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
131 
132  itf = ipsec_itf_find_by_sw_if_index (hi->sw_if_index);
133 
134  if (itf)
137 
138  return (NULL);
139 }
140 
141 static int
143  ip46_address_t * src, ip46_address_t * dst, u8 * is_l2)
144 {
147  *is_l2 = 0;
148 
149  return (0);
150 }
151 
152 static u8 *
154 {
155  /*
156  * passing the adj code a NULL rewrite means 'i don't have one cos
157  * t'other end is unresolved'. That's not the case here. For the ipsec
158  * tunnel there are just no bytes of encap to apply in the adj.
159  * So return a zero length rewrite. Encap will be added by a tunnel mode SA.
160  */
161  u8 *rewrite = NULL;
162 
163  vec_validate (rewrite, 0);
165 
166  return (rewrite);
167 }
168 
169 static u8 *
172  vnet_link_t link_type, const void *dst_address)
173 {
174  return (ipsec_itf_build_rewrite ());
175 }
176 
177 void
179 {
182 }
183 
184 /* *INDENT-OFF* */
185 VNET_DEVICE_CLASS (ipsec_itf_device_class) = {
186  .name = "IPSEC Tunnel",
187  .format_device_name = format_ipsec_itf_name,
188  .admin_up_down_function = ipsec_itf_admin_up_down,
189  .ip_tun_desc = ipsec_itf_tunnel_desc,
190 };
191 
192 VNET_HW_INTERFACE_CLASS(ipsec_hw_interface_class) = {
193  .name = "IPSec",
194  .build_rewrite = ipsec_itf_build_rewrite_i,
195  .update_adjacency = ipsec_itf_update_adj,
197 };
198 VNET_HW_INTERFACE_CLASS(ipsec_p2mp_hw_interface_class) = {
199  .name = "IPSec",
200  .build_rewrite = ipsec_itf_build_rewrite_i,
201  .update_adjacency = ipsec_itf_update_adj,
203 };
204 /* *INDENT-ON* */
205 
206 /*
207  * Maintain a bitmap of allocated ipsec_itf instance numbers.
208  */
209 #define IPSEC_ITF_MAX_INSTANCE (16 * 1024)
210 
211 static u32
213 {
214  /*
215  * Check for dynamically allocated instance number.
216  */
217  if (~0 == want)
218  {
219  u32 bit;
220 
222  if (bit >= IPSEC_ITF_MAX_INSTANCE)
223  {
224  return ~0;
225  }
227  return bit;
228  }
229 
230  /*
231  * In range?
232  */
233  if (want >= IPSEC_ITF_MAX_INSTANCE)
234  {
235  return ~0;
236  }
237 
238  /*
239  * Already in use?
240  */
242  {
243  return ~0;
244  }
245 
246  /*
247  * Grant allocation request.
248  */
250 
251  return want;
252 }
253 
254 static int
256 {
258  {
259  return -1;
260  }
261 
263  {
264  return -1;
265  }
266 
268  return 0;
269 }
270 
271 int
272 ipsec_itf_create (u32 user_instance, tunnel_mode_t mode, u32 * sw_if_indexp)
273 {
274  vnet_main_t *vnm = vnet_get_main ();
275  u32 instance, hw_if_index;
278 
279  ASSERT (sw_if_indexp);
280 
281  *sw_if_indexp = (u32) ~ 0;
282 
283  /*
284  * Allocate a ipsec_itf instance. Either select on dynamically
285  * or try to use the desired user_instance number.
286  */
287  instance = ipsec_itf_instance_alloc (user_instance);
288  if (instance == ~0)
289  return VNET_API_ERROR_INVALID_REGISTRATION;
290 
292 
293  /* tunnel index (or instance) */
294  u32 t_idx = ipsec_itf - ipsec_itf_pool;
295 
296  ipsec_itf->ii_mode = mode;
297  ipsec_itf->ii_user_instance = instance;
298 
299  hw_if_index = vnet_register_interface (vnm,
300  ipsec_itf_device_class.index,
301  ipsec_itf->ii_user_instance,
302  (mode == TUNNEL_MODE_P2P ?
303  ipsec_hw_interface_class.index :
304  ipsec_p2mp_hw_interface_class.index),
305  t_idx);
306 
307  hi = vnet_get_hw_interface (vnm, hw_if_index);
308  vnet_sw_interface_set_mtu (vnm, hi->sw_if_index, 9000);
309 
311  INDEX_INVALID);
312  ipsec_itf_index_by_sw_if_index[hi->sw_if_index] = t_idx;
313 
314  ipsec_itf->ii_sw_if_index = *sw_if_indexp = hi->sw_if_index;
315 
316  return 0;
317 }
318 
319 int
321 {
322  vnet_main_t *vnm = vnet_get_main ();
323 
325  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
326 
328  if (hw == 0 || hw->dev_class_index != ipsec_itf_device_class.index)
329  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
330 
333  if (NULL == ipsec_itf)
334  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
335 
337  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
338 
341 
342  return 0;
343 }
344 
345 void
347 {
348  ipsec_itf_t *itf;
349 
351  {
352  if (WALK_CONTINUE != cb (itf, ctx))
353  break;
354  }
355 }
356 
357 static clib_error_t *
359  unformat_input_t * input, vlib_cli_command_t * cmd)
360 {
361  unformat_input_t _line_input, *line_input = &_line_input;
365  int rv;
366 
367  error = NULL;
368  instance = sw_if_index = ~0;
370 
371  if (unformat_user (input, unformat_line_input, line_input))
372  {
373  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
374  {
375  if (unformat (line_input, "instance %d", &instance))
376  ;
377  else
378  {
379  error = clib_error_return (0, "unknown input: %U",
380  format_unformat_error, line_input);
381  break;
382  }
383  }
384 
385  unformat_free (line_input);
386 
387  if (error)
388  return error;
389  }
390 
391  rv = ipsec_itf_create (instance, TUNNEL_MODE_P2P, &sw_if_index);
392 
393  if (rv)
394  return clib_error_return (0, "iPSec interface create failed");
395 
397  sw_if_index);
398  return 0;
399 }
400 
401 /*?
402  * Create a IPSec interface.
403  *
404  * @cliexpar
405  * The following two command syntaxes are equivalent:
406  * @cliexcmd{ipsec itf create [instance <instance>]}
407  * Example of how to create a ipsec interface:
408  * @cliexcmd{ipsec itf create}
409 ?*/
410 /* *INDENT-OFF* */
412  .path = "ipsec itf create",
413  .short_help = "ipsec itf create [instance <instance>]",
414  .function = ipsec_itf_create_cli,
415 };
416 /* *INDENT-ON* */
417 
418 static clib_error_t *
420  unformat_input_t * input, vlib_cli_command_t * cmd)
421 {
422  vnet_main_t *vnm;
424  int rv;
425 
426  vnm = vnet_get_main ();
427  sw_if_index = ~0;
428 
430  {
431  if (unformat
432  (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
433  ;
434  else
435  break;
436  }
437 
438  if (~0 != sw_if_index)
439  {
441 
442  if (rv)
443  return clib_error_return (0, "ipsec interface delete failed");
444  }
445  else
446  return clib_error_return (0, "no such interface: %U",
447  format_unformat_error, input);
448 
449  return 0;
450 }
451 
452 /*?
453  * Delete a IPSEC_ITF interface.
454  *
455  * @cliexpar
456  * The following two command syntaxes are equivalent:
457  * @cliexcmd{ipsec itf delete <interface>}
458  * Example of how to create a ipsec_itf interface:
459  * @cliexcmd{ipsec itf delete ipsec0}
460 ?*/
461 /* *INDENT-OFF* */
463  .path = "ipsec itf delete",
464  .short_help = "ipsec itf delete <interface>",
465  .function = ipsec_itf_delete_cli,
466 };
467 /* *INDENT-ON* */
468 
469 static clib_error_t *
471  unformat_input_t * input, vlib_cli_command_t * cmd)
472 {
473  index_t ii;
474 
475  /* *INDENT-OFF* */
477  {
478  vlib_cli_output (vm, "%U", format_ipsec_itf, ii);
479  }
480  /* *INDENT-ON* */
481 
482  return NULL;
483 }
484 
485 /**
486  * show IPSEC tunnel protection hash tables
487  */
488 /* *INDENT-OFF* */
490 {
491  .path = "show ipsec interface",
492  .function = ipsec_interface_show,
493  .short_help = "show ipsec interface",
494 };
495 /* *INDENT-ON* */
496 
497 /*
498  * fd.io coding-style-patch-verification: ON
499  *
500  * Local Variables:
501  * eval: (c-set-style "gnu")
502  * End:
503  */
ipsec_itf_adj_stack
void ipsec_itf_adj_stack(adj_index_t ai, u32 sai)
Definition: ipsec_itf.c:64
vec_reset_length
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Definition: vec_bootstrap.h:194
ipsec.h
adj_midchain.h
ipsec_tun.h
mac
vl_api_mac_address_t mac
Definition: l2.api:559
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
vnet_sw_interface_set_mtu
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
Definition: interface.c:706
ipsec_itf_t_::ii_sw_if_index
u32 ii_sw_if_index
Definition: ipsec_itf.h:98
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
ipsec_itf_instance_free
static int ipsec_itf_instance_free(u32 instance)
Definition: ipsec_itf.c:255
FOR_EACH_FIB_IP_PROTOCOL
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
Definition: fib_types.h:69
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
adj_get_sw_if_index
u32 adj_get_sw_if_index(adj_index_t ai)
Return the sw interface index of the adjacency.
Definition: adj.c:543
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
ipsec_itf_t_
A dedicated IPSec interface type.
Definition: ipsec_itf.h:94
ip46_address_reset
static void ip46_address_reset(ip46_address_t *ip46)
Definition: ip46_address.h:74
ipsec_itf_build_rewrite
static u8 * ipsec_itf_build_rewrite(void)
Definition: ipsec_itf.c:153
adj_walk_rc_t
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
vnet_hw_interface_t::flags
vnet_hw_interface_flags_t flags
Definition: interface.h:642
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
adj_midchain_delegate_stack
void adj_midchain_delegate_stack(adj_index_t ai, u32 fib_index, const fib_prefix_t *pfx)
create/attach a midchain delegate and stack it on the prefix passed
Definition: adj_midchain_delegate.c:101
tunnel_t_::t_fib_index
u32 t_fib_index
derived data
Definition: tunnel.h:99
vlib_cli_command_t::path
char * path
Definition: cli.h:96
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
ipsec_itf_find_by_sw_if_index
static ipsec_itf_t * ipsec_itf_find_by_sw_if_index(u32 sw_if_index)
Definition: ipsec_itf.c:40
ip_address_to_fib_prefix
void ip_address_to_fib_prefix(const ip_address_t *addr, fib_prefix_t *prefix)
convert from a IP address to a FIB prefix
Definition: ip_types.c:270
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:844
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
ipsec_interface_show_node
static vlib_cli_command_t ipsec_interface_show_node
show IPSEC tunnel protection hash tables
Definition: ipsec_itf.c:489
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
ipsec_tun_protect_walk_state_change
static walk_rc_t ipsec_tun_protect_walk_state_change(index_t itpi, void *arg)
Definition: ipsec_itf.c:111
unformat_input_t
struct _unformat_input_t unformat_input_t
vnet_hw_interface_t::dev_instance
u32 dev_instance
Definition: interface.h:660
ipsec_itf_update_adj
void ipsec_itf_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
Definition: ipsec_itf.c:178
ipsec_sa_t::tunnel
tunnel_t tunnel
Definition: ipsec_sa.h:204
clib_bitmap_first_clear
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
Definition: bitmap.h:432
error
Definition: cJSON.c:88
ipsec_itf_adj_stack_cb
static adj_walk_rc_t ipsec_itf_adj_stack_cb(adj_index_t ai, void *arg)
Definition: ipsec_itf.c:84
ipsec_itf_tunnel_desc
static int ipsec_itf_tunnel_desc(u32 sw_if_index, ip46_address_t *src, ip46_address_t *dst, u8 *is_l2)
Definition: ipsec_itf.c:142
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
ti
u32 ti
Definition: interface_output.c:425
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
ipsec_itf_restack
static void ipsec_itf_restack(index_t itpi, const ipsec_itf_t *itf)
Definition: ipsec_itf.c:94
ipsec_itf_create
int ipsec_itf_create(u32 user_instance, tunnel_mode_t mode, u32 *sw_if_indexp)
Definition: ipsec_itf.c:272
ipsec_itf
typedef ipsec_itf
Definition: ipsec.api:362
ipsec_itf_adj_unstack
void ipsec_itf_adj_unstack(adj_index_t ai)
Definition: ipsec_itf.c:58
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
clib_bitmap_get
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
Definition: bitmap.h:197
ipsec_tun_protect_t_
Definition: ipsec_tun.h:107
ipsec_itf.h
ipsec_sa_get
static ipsec_sa_t * ipsec_sa_get(u32 sa_index)
Definition: ipsec_sa.h:605
vnet_get_hw_interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:44
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
mac_address.h
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
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
format_ipsec_itf_name
static u8 * format_ipsec_itf_name(u8 *s, va_list *args)
Definition: ipsec_itf.c:51
ipsec_itf_instance_alloc
static u32 ipsec_itf_instance_alloc(u32 want)
Definition: ipsec_itf.c:212
uword
u64 uword
Definition: types.h:112
vnet_delete_hw_interface
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:1051
vnet_hw_interface_t::dev_class_index
u32 dev_class_index
Definition: interface.h:659
ipsec_tun_protect_t_::itp_out_sa
index_t itp_out_sa
Definition: ipsec_tun.h:110
ipsec_itf_walk_cb_t
walk_rc_t(* ipsec_itf_walk_cb_t)(ipsec_itf_t *itf, void *ctx)
Definition: ipsec_itf.h:113
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
mac_address_set_zero
static_always_inline void mac_address_set_zero(mac_address_t *mac)
Definition: mac_address.h:146
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
src
vl_api_address_t src
Definition: gre.api:54
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
clib_bitmap_set
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
Definition: bitmap.h:167
ipsec_itf_admin_up_down
static clib_error_t * ipsec_itf_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: ipsec_itf.c:121
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
vnet_interface_main_t::sw_interfaces
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:1015
adj_midchain_delegate_unstack
void adj_midchain_delegate_unstack(adj_index_t ai)
unstack a midchain delegate (this stacks it on a drop)
Definition: adj_midchain_delegate.c:135
ipsec_itf_delete_command
static vlib_cli_command_t ipsec_itf_delete_command
(constructor) VLIB_CLI_COMMAND (ipsec_itf_delete_command)
Definition: ipsec_itf.c:462
ipsec_sa_t
Definition: ipsec_sa.h:116
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
adj_nbr_midchain_update_rewrite
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
Definition: adj_midchain.c:213
ipsec_itf_index_by_sw_if_index
static u32 * ipsec_itf_index_by_sw_if_index
Definition: ipsec_itf.c:31
VNET_DEVICE_CLASS
VNET_DEVICE_CLASS(ipsec_itf_device_class)
ipsec_itf_create_command
static vlib_cli_command_t ipsec_itf_create_command
(constructor) VLIB_CLI_COMMAND (ipsec_itf_create_command)
Definition: ipsec_itf.c:411
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:572
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:458
ipsec_itf_get
ipsec_itf_t * ipsec_itf_get(index_t ii)
Definition: ipsec_itf.c:34
unformat_vnet_sw_interface
unformat_function_t unformat_vnet_sw_interface
Definition: interface_funcs.h:462
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vec_validate_init_empty
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Definition: vec.h:570
IPSEC_ITF_MAX_INSTANCE
#define IPSEC_ITF_MAX_INSTANCE
Definition: ipsec_itf.c:209
ipsec_itf_create_cli
static clib_error_t * ipsec_itf_create_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ipsec_itf.c:358
ip.h
u32
unsigned int u32
Definition: types.h:88
vnet_get_sup_hw_interface
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:92
ipsec_interface_show
static clib_error_t * ipsec_interface_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ipsec_itf.c:470
tunnel_t_::t_dst
ip_address_t t_dst
Definition: tunnel.h:88
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
ipsec_itf_build_rewrite_i
static u8 * ipsec_itf_build_rewrite_i(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Definition: ipsec_itf.c:170
ipsec_itf_pool
static ipsec_itf_t * ipsec_itf_pool
Definition: ipsec_itf.c:29
instance
u32 instance
Definition: gre.api:51
mac_address_t_
Definition: mac_address.h:21
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
tunnel_mode_t
enum tunnel_mode_t_ tunnel_mode_t
vlib_main_t
Definition: main.h:102
vnet_link_t
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vnet_hw_interface_set_flags
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
Definition: interface.c:513
ADJ_WALK_RC_CONTINUE
@ ADJ_WALK_RC_CONTINUE
Definition: adj_types.h:44
VNET_HW_INTERFACE_CLASS_FLAG_P2P
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
Definition: interface.h:394
adj_nbr_walk
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
Definition: adj_nbr.c:592
ipsec_itf_walk
void ipsec_itf_walk(ipsec_itf_walk_cb_t cb, void *ctx)
Definition: ipsec_itf.c:346
vnet_hw_interface_t::hw_if_index
u32 hw_if_index
Definition: interface.h:667
rv
int __clib_unused rv
Definition: application.c:491
ipsec_itf_delete
int ipsec_itf_delete(u32 sw_if_index)
Definition: ipsec_itf.c:320
VNET_HW_INTERFACE_CLASS_FLAG_NBMA
@ VNET_HW_INTERFACE_CLASS_FLAG_NBMA
a non-broadcast multiple access interface
Definition: interface.h:398
ipsec_tun_protect_get
static ipsec_tun_protect_t * ipsec_tun_protect_get(u32 index)
Definition: ipsec_tun.h:175
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
ipsec_itf_delete_cli
static clib_error_t * ipsec_itf_delete_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ipsec_itf.c:419
VNET_HW_INTERFACE_CLASS
VNET_HW_INTERFACE_CLASS(ipsec_hw_interface_class)
vlib_cli_command_t
Definition: cli.h:92
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
ipsec_tun_protect_walk_itf
void ipsec_tun_protect_walk_itf(u32 sw_if_index, ipsec_tun_protect_walk_cb_t fn, void *ctx)
Definition: ipsec_tun.c:759
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
rewrite
rewrite
Definition: pnat.api:158
format_ipsec_itf
u8 * format_ipsec_itf(u8 *s, va_list *a)
Definition: ipsec_format.c:413
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
ADJ_FLAG_MIDCHAIN_IP_STACK
@ ADJ_FLAG_MIDCHAIN_IP_STACK
Definition: adj.h:218
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
ipsec_itf_instances
static uword * ipsec_itf_instances
Definition: ipsec_itf.c:26
vnet_register_interface
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
Definition: interface.c:812
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105