FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ad.c
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  * ad.c - SRv6 Dynamic Proxy (AD) function
18  *------------------------------------------------------------------
19  */
20 
21 #include <vnet/vnet.h>
22 #include <vnet/adj/adj.h>
23 #include <vnet/plugin/plugin.h>
24 #include <vpp/app/version.h>
25 #include <srv6-ad/ad.h>
26 
27 #define SID_CREATE_IFACE_FEATURE_ERROR -1
28 #define SID_CREATE_INVALID_IFACE_TYPE -3
29 #define SID_CREATE_INVALID_IFACE_INDEX -4
30 #define SID_CREATE_INVALID_ADJ_INDEX -5
31 
32 unsigned char function_name[] = "SRv6-AD-plugin";
33 unsigned char keyword_str[] = "End.AD";
34 unsigned char def_str[] =
35  "Endpoint with dynamic proxy to SR-unaware appliance";
36 unsigned char params_str[] = "nh <next-hop> oif <iface-out> iif <iface-in>";
37 
39 
40 /*****************************************/
41 /* SRv6 LocalSID instantiation and removal functions */
42 static int
44 {
45  ip6_sr_main_t *srm = &sr_main;
47  srv6_ad_localsid_t *ls_mem = localsid->plugin_mem;
48  u32 localsid_index = localsid - srm->localsids;
49 
50  /* Step 1: Prepare xconnect adjacency for sending packets to the VNF */
51 
52  /* Retrieve the adjacency corresponding to the (OIF, next_hop) */
53  adj_index_t nh_adj_index = ADJ_INDEX_INVALID;
54  if (ls_mem->inner_type != AD_TYPE_L2)
55  {
56  if (ls_mem->inner_type == AD_TYPE_IP4)
57  nh_adj_index = adj_nbr_add_or_lock (FIB_PROTOCOL_IP4,
58  VNET_LINK_IP4, &ls_mem->nh_addr,
59  ls_mem->sw_if_index_out);
60  else if (ls_mem->inner_type == AD_TYPE_IP6)
61  nh_adj_index = adj_nbr_add_or_lock (FIB_PROTOCOL_IP6,
62  VNET_LINK_IP6, &ls_mem->nh_addr,
63  ls_mem->sw_if_index_out);
64  if (nh_adj_index == ADJ_INDEX_INVALID)
65  {
66  clib_mem_free (ls_mem);
68  }
69  }
70 
71  ls_mem->nh_adj = nh_adj_index;
72 
73 
74  /* Step 2: Prepare inbound policy for packets returning from the VNF */
75 
76  /* Sanitise the SW_IF_INDEX */
78  ls_mem->sw_if_index_in))
79  {
80  adj_unlock (ls_mem->nh_adj);
81  clib_mem_free (ls_mem);
83  }
84 
86  ls_mem->sw_if_index_in);
88  {
89  adj_unlock (ls_mem->nh_adj);
90  clib_mem_free (ls_mem);
92  }
93 
94  if (ls_mem->inner_type == AD_TYPE_L2)
95  {
96  /* Enable End.AD2 rewrite node for this interface */
97  int ret =
98  vnet_feature_enable_disable ("device-input", "srv6-ad2-rewrite",
99  ls_mem->sw_if_index_in, 1, 0, 0);
100  if (ret != 0)
101  {
102  clib_mem_free (ls_mem);
104  }
105 
106  /* Set interface in promiscuous mode */
107  vnet_main_t *vnm = vnet_get_main ();
110  /* Make sure it is main interface */
111  if (hi->sw_if_index == ls_mem->sw_if_index_in)
112  ethernet_set_flags (vnm, hi->hw_if_index,
114 
115  /* Associate local SID index to this interface (resize vector if needed) */
116  if (ls_mem->sw_if_index_in >= vec_len (sm->sw_iface_localsid2))
117  {
120  - vec_len (sm->sw_iface_localsid2)));
121  }
122  sm->sw_iface_localsid2[ls_mem->sw_if_index_in] = localsid_index;
123  }
124  else if (ls_mem->inner_type == AD_TYPE_IP4)
125  {
126  /* Enable End.AD4 rewrite node for this interface */
127  int ret =
128  vnet_feature_enable_disable ("ip4-unicast", "srv6-ad4-rewrite",
129  ls_mem->sw_if_index_in, 1, 0, 0);
130  if (ret != 0)
131  {
132  adj_unlock (ls_mem->nh_adj);
133  clib_mem_free (ls_mem);
135  }
136 
137  /* Associate local SID index to this interface (resize vector if needed) */
138  if (ls_mem->sw_if_index_in >= vec_len (sm->sw_iface_localsid4))
139  {
142  - vec_len (sm->sw_iface_localsid4)));
143  }
144  sm->sw_iface_localsid4[ls_mem->sw_if_index_in] = localsid_index;
145  }
146  else if (ls_mem->inner_type == AD_TYPE_IP6)
147  {
148  /* Enable End.AD6 rewrite node for this interface */
149  int ret =
150  vnet_feature_enable_disable ("ip6-unicast", "srv6-ad6-rewrite",
151  ls_mem->sw_if_index_in, 1, 0, 0);
152  if (ret != 0)
153  {
154  adj_unlock (ls_mem->nh_adj);
155  clib_mem_free (ls_mem);
157  }
158 
159  /* Associate local SID index to this interface (resize vector if needed) */
160  if (ls_mem->sw_if_index_in >= vec_len (sm->sw_iface_localsid6))
161  {
164  - vec_len (sm->sw_iface_localsid6)));
165  }
166  sm->sw_iface_localsid6[ls_mem->sw_if_index_in] = localsid_index;
167  }
168 
169  ls_mem->rw_len = 0;
170 
171  /* Step 3: Initialize rewrite counters */
172  srv6_ad_localsid_t **ls_p;
173  pool_get (sm->sids, ls_p);
174  *ls_p = ls_mem;
175  ls_mem->index = ls_p - sm->sids;
176 
179 
182 
183  return 0;
184 }
185 
186 static int
188 {
190  srv6_ad_localsid_t *ls_mem = localsid->plugin_mem;
191 
192  if (ls_mem->inner_type == AD_TYPE_L2)
193  {
194  /* Disable End.AD2 rewrite node for this interface */
195  int ret =
196  vnet_feature_enable_disable ("device-input", "srv6-ad2-rewrite",
197  ls_mem->sw_if_index_in, 0, 0, 0);
198  if (ret != 0)
199  return -1;
200 
201  /* Disable promiscuous mode on the interface */
202  vnet_main_t *vnm = vnet_get_main ();
205  /* Make sure it is main interface */
206  if (hi->sw_if_index == ls_mem->sw_if_index_in)
207  ethernet_set_flags (vnm, hi->hw_if_index, 0);
208 
209  /* Remove local SID index from interface table */
210  sm->sw_iface_localsid2[ls_mem->sw_if_index_in] = ~(u32) 0;
211  }
212  else if (ls_mem->inner_type == AD_TYPE_IP4)
213  {
214  /* Disable End.AD4 rewrite node for this interface */
215  int ret =
216  vnet_feature_enable_disable ("ip4-unicast", "srv6-ad4-rewrite",
217  ls_mem->sw_if_index_in, 0, 0, 0);
218  if (ret != 0)
219  return -1;
220 
221  /* Remove local SID pointer from interface table */
222  sm->sw_iface_localsid4[ls_mem->sw_if_index_in] = ~(u32) 0;
223  }
224  else if (ls_mem->inner_type == AD_TYPE_IP6)
225  {
226  /* Disable End.AD6 rewrite node for this interface */
227  int ret =
228  vnet_feature_enable_disable ("ip6-unicast", "srv6-ad6-rewrite",
229  ls_mem->sw_if_index_in, 0, 0, 0);
230  if (ret != 0)
231  return -1;
232 
233  /* Remove local SID pointer from interface table */
234  sm->sw_iface_localsid6[ls_mem->sw_if_index_in] = ~(u32) 0;
235  }
236 
237 
238  /* Unlock (OIF, NHOP) adjacency */
239  adj_unlock (ls_mem->nh_adj);
240 
241  /* Delete SID entry */
242  pool_put (sm->sids, pool_elt_at_index (sm->sids, ls_mem->index));
243 
244  /* Clean up local SID memory */
245  vec_free (ls_mem->rewrite);
246  clib_mem_free (localsid->plugin_mem);
247 
248  return 0;
249 }
250 
251 /**********************************/
252 /* SRv6 LocalSID format functions */
253 /*
254  * Prints nicely the parameters of a localsid
255  * Example: print "Table 5"
256  */
257 u8 *
258 format_srv6_ad_localsid (u8 * s, va_list * args)
259 {
260  srv6_ad_localsid_t *ls_mem = va_arg (*args, void *);
261 
262  vnet_main_t *vnm = vnet_get_main ();
264 
265  if (ls_mem->inner_type == AD_TYPE_IP4)
266  {
267  s =
268  format (s, "Next-hop:\t%U\n\t", format_ip4_address,
269  &ls_mem->nh_addr.ip4);
270  }
271  else if (ls_mem->inner_type == AD_TYPE_IP6)
272  {
273  s =
274  format (s, "Next-hop:\t%U\n\t", format_ip6_address,
275  &ls_mem->nh_addr.ip6);
276  }
277 
278  s = format (s, "Outgoing iface:\t%U\n", format_vnet_sw_if_index_name, vnm,
279  ls_mem->sw_if_index_out);
280  s = format (s, "\tIncoming iface:\t%U\n", format_vnet_sw_if_index_name, vnm,
281  ls_mem->sw_if_index_in);
282 
283  vlib_counter_t valid, invalid;
284  vlib_get_combined_counter (&(sm->valid_counters), ls_mem->index, &valid);
286  &invalid);
287  s = format (s, "\tGood rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
288  valid.packets, valid.bytes);
289  s = format (s, "\tBad rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
290  invalid.packets, invalid.bytes);
291 
292  return s;
293 }
294 
295 /*
296  * Process the parameters of a localsid
297  * Example: process from:
298  * sr localsid address cafe::1 behavior new_srv6_localsid 5
299  * everything from behavior on... so in this case 'new_srv6_localsid 5'
300  * Notice that it MUST match the keyword_str and params_str defined above.
301  */
302 uword
304 {
305  void **plugin_mem_p = va_arg (*args, void **);
306  srv6_ad_localsid_t *ls_mem;
307 
308  vnet_main_t *vnm = vnet_get_main ();
309 
310  u8 inner_type = AD_TYPE_L2;
311  ip46_address_t nh_addr;
312  u32 sw_if_index_out;
313  u32 sw_if_index_in;
314 
315  u8 params = 0;
316 #define PARAM_AD_NH (1 << 0)
317 #define PARAM_AD_OIF (1 << 1)
318 #define PARAM_AD_IIF (1 << 2)
319 
320  if (!unformat (input, "end.ad"))
321  return 0;
322 
324  {
325  if (!(params & PARAM_AD_NH) && unformat (input, "nh %U",
327  &nh_addr.ip4))
328  {
329  inner_type = AD_TYPE_IP4;
330  params |= PARAM_AD_NH;
331  }
332  if (!(params & PARAM_AD_NH) && unformat (input, "nh %U",
334  &nh_addr.ip6))
335  {
336  inner_type = AD_TYPE_IP6;
337  params |= PARAM_AD_NH;
338  }
339  else if (!(params & PARAM_AD_OIF) && unformat (input, "oif %U",
341  vnm, &sw_if_index_out))
342  {
343  params |= PARAM_AD_OIF;
344  }
345  else if (!(params & PARAM_AD_IIF) && unformat (input, "iif %U",
347  vnm, &sw_if_index_in))
348  {
349  params |= PARAM_AD_IIF;
350  }
351  else
352  {
353  break;
354  }
355  }
356 
357  /* Make sure that all parameters are supplied */
358  u8 params_chk = (PARAM_AD_OIF | PARAM_AD_IIF);
359  if ((params & params_chk) != params_chk)
360  {
361  return 0;
362  }
363 
364  /* Allocate and initialize memory block for local SID parameters */
365  ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
366  clib_memset (ls_mem, 0, sizeof *ls_mem);
367  *plugin_mem_p = ls_mem;
368 
369  /* Set local SID parameters */
370  ls_mem->inner_type = inner_type;
371  if (inner_type == AD_TYPE_IP4)
372  ls_mem->nh_addr.ip4 = nh_addr.ip4;
373  else if (inner_type == AD_TYPE_IP6)
374  ls_mem->nh_addr.ip6 = nh_addr.ip6;
375  ls_mem->sw_if_index_out = sw_if_index_out;
376  ls_mem->sw_if_index_in = sw_if_index_in;
377 
378  return 1;
379 }
380 
381 /*************************/
382 /* SRv6 LocalSID FIB DPO */
383 static u8 *
384 format_srv6_ad_dpo (u8 * s, va_list * args)
385 {
386  index_t index = va_arg (*args, index_t);
387  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
388 
389  return (format (s, "SR: dynamic_proxy_index:[%u]", index));
390 }
391 
392 void
394 {
395 }
396 
397 void
399 {
400 }
401 
402 const static dpo_vft_t srv6_ad_vft = {
404  .dv_unlock = srv6_ad_dpo_unlock,
405  .dv_format = format_srv6_ad_dpo,
406 };
407 
408 const static char *const srv6_ad_ip6_nodes[] = {
409  "srv6-ad-localsid",
410  NULL,
411 };
412 
413 const static char *const *const srv6_ad_nodes[DPO_PROTO_NUM] = {
415 };
416 
417 /**********************/
418 static clib_error_t *
420 {
422  int rv = 0;
423 
424  sm->vlib_main = vm;
425  sm->vnet_main = vnet_get_main ();
426 
427  /* Create DPO */
429 
430  /* Register SRv6 LocalSID */
433  keyword_str,
434  def_str,
435  params_str,
436  128,
437  &sm->srv6_ad_dpo_type,
442  if (rv < 0)
443  clib_error_return (0, "SRv6 LocalSID function could not be registered.");
444  else
446 
447  return 0;
448 }
449 
450 /* *INDENT-OFF* */
451 VNET_FEATURE_INIT (srv6_ad2_rewrite, static) =
452 {
453  .arc_name = "device-input",
454  .node_name = "srv6-ad2-rewrite",
455  .runs_before = VNET_FEATURES ("ethernet-input"),
456 };
457 
458 VNET_FEATURE_INIT (srv6_ad4_rewrite, static) =
459 {
460  .arc_name = "ip4-unicast",
461  .node_name = "srv6-ad4-rewrite",
462  .runs_before = 0,
463 };
464 
465 VNET_FEATURE_INIT (srv6_ad6_rewrite, static) =
466 {
467  .arc_name = "ip6-unicast",
468  .node_name = "srv6-ad6-rewrite",
469  .runs_before = 0,
470 };
471 
473 
475  .version = VPP_BUILD_VER,
476  .description = "Dynamic Segment Routing for IPv6 (SRv6) Proxy",
477 };
478 /* *INDENT-ON* */
479 
480 /*
481 * fd.io coding-style-patch-verification: ON
482 *
483 * Local Variables:
484 * eval: (c-set-style "gnu")
485 * End:
486 */
PARAM_AD_OIF
#define PARAM_AD_OIF
VLIB_PLUGIN_REGISTER
VLIB_PLUGIN_REGISTER()
adj.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
srv6_ad_main_t::sw_iface_localsid4
u32 * sw_iface_localsid4
Retrieve local SID from iface.
Definition: ad.h:60
vnet_sw_interface_t::type
vnet_sw_interface_type_t type
Definition: interface.h:871
format_srv6_ad_dpo
static u8 * format_srv6_ad_dpo(u8 *s, va_list *args)
Definition: ad.c:384
SID_CREATE_IFACE_FEATURE_ERROR
#define SID_CREATE_IFACE_FEATURE_ERROR
Definition: ad.c:27
vnet_sw_interface_t
Definition: interface.h:869
srv6_ad_main_t::sids
srv6_ad_localsid_t ** sids
Pool of AD SID pointers.
Definition: ad.h:63
AD_TYPE_L2
#define AD_TYPE_L2
Definition: ad.h:26
srv6_ad_main_t::srv6_localsid_behavior_id
u32 srv6_localsid_behavior_id
SRv6 LocalSID behavior number.
Definition: ad.h:57
format_ip4_address
format_function_t format_ip4_address
Definition: format.h:73
adj_nbr_add_or_lock
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
Definition: adj_nbr.c:257
ethernet_set_flags
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:441
ADJ_INDEX_INVALID
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
Definition: adj_types.h:36
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
SID_CREATE_INVALID_ADJ_INDEX
#define SID_CREATE_INVALID_ADJ_INDEX
Definition: ad.c:30
ip6_sr_localsid_t
SR LocalSID.
Definition: sr.h:123
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
clib_mem_free
static void clib_mem_free(void *p)
Definition: mem.h:314
ip6_sr_localsid_t::plugin_mem
void * plugin_mem
Memory to be used by the plugin callback functions.
Definition: sr.h:156
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
def_str
unsigned char def_str[]
Definition: ad.c:34
AD_TYPE_IP4
#define AD_TYPE_IP4
Definition: ad.h:27
adj_unlock
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
Definition: adj.c:358
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
srv6_ad_localsid_t::nh_adj
u32 nh_adj
Adjacency index for out.
Definition: ad.h:38
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
srv6_ad_localsid_creation_fn
static int srv6_ad_localsid_creation_fn(ip6_sr_localsid_t *localsid)
Definition: ad.c:43
vnet_get_sw_interface
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:58
srv6_ad_main
srv6_ad_main_t srv6_ad_main
Definition: ad.c:38
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
unformat_input_t
struct _unformat_input_t unformat_input_t
srv6_ad_main_t::invalid_counters
vlib_combined_counter_main_t invalid_counters
Invalid rewrite counters.
Definition: ad.h:66
srv6_ad_localsid_removal_fn
static int srv6_ad_localsid_removal_fn(ip6_sr_localsid_t *localsid)
Definition: ad.c:187
VNET_FEATURE_INIT
VNET_FEATURE_INIT(srv6_ad2_rewrite, static)
srv6_ad_main_t
Definition: ad.h:48
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
srv6_ad_main_t::srv6_ad_dpo_type
dpo_type_t srv6_ad_dpo_type
DPO type.
Definition: ad.h:55
keyword_str
unsigned char keyword_str[]
Definition: ad.c:33
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
AD_TYPE_IP6
#define AD_TYPE_IP6
Definition: ad.h:28
params_str
unsigned char params_str[]
Definition: ad.c:36
VNET_LINK_IP4
@ VNET_LINK_IP4
Definition: interface.h:344
PARAM_AD_IIF
#define PARAM_AD_IIF
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
vlib_counter_t
Combined counter to hold both packets and byte differences.
Definition: counter_types.h:26
srv6_ad_localsid_t::index
u32 index
Definition: ad.h:45
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
uword
u64 uword
Definition: types.h:112
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
srv6_ad_dpo_lock
void srv6_ad_dpo_lock(dpo_id_t *dpo)
Definition: ad.c:393
ad.h
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
srv6_ad_localsid_t::rewrite
u8 * rewrite
Headers to be rewritten.
Definition: ad.h:43
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
unformat_srv6_ad_localsid
uword unformat_srv6_ad_localsid(unformat_input_t *input, va_list *args)
Definition: ad.c:303
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
vlib_counter_t::packets
counter_t packets
packet counter
Definition: counter_types.h:28
SID_CREATE_INVALID_IFACE_INDEX
#define SID_CREATE_INVALID_IFACE_INDEX
Definition: ad.c:29
srv6_ad_init
static clib_error_t * srv6_ad_init(vlib_main_t *vm)
Definition: ad.c:419
vnet_interface_main_t::sw_interfaces
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:1015
sr_main
ip6_sr_main_t sr_main
Definition: sr.c:31
srv6_ad_main_t::valid_counters
vlib_combined_counter_main_t valid_counters
Valid rewrite counters.
Definition: ad.h:65
ip6_sr_main_t::localsids
ip6_sr_localsid_t * localsids
Definition: sr.h:273
plugin.h
format_srv6_ad_localsid
u8 * format_srv6_ad_localsid(u8 *s, va_list *args)
Definition: ad.c:258
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
ip6_sr_main_t
Segment Routing main datastructure.
Definition: sr.h:258
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
pool_len
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:139
srv6_ad_localsid_t::inner_type
u8 inner_type
Definition: ad.h:39
index
u32 index
Definition: flow_types.api:221
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:458
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
srv6_ad_dpo_unlock
void srv6_ad_dpo_unlock(dpo_id_t *dpo)
Definition: ad.c:398
srv6_ad_main_t::sw_iface_localsid6
u32 * sw_iface_localsid6
Retrieve local SID from iface.
Definition: ad.h:61
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
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
srv6_ad_main_t::vlib_main
vlib_main_t * vlib_main
[convenience] vlib main
Definition: ad.h:52
vlib_counter_t::bytes
counter_t bytes
byte counter
Definition: counter_types.h:29
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
nh_addr
vl_api_address_t nh_addr
Definition: lisp_gpe.api:222
PARAM_AD_NH
#define PARAM_AD_NH
srv6_ad_main_t::vnet_main
vnet_main_t * vnet_main
[convenience] vnet main
Definition: ad.h:53
vec_resize
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
Definition: vec.h:296
vnet_feature_enable_disable
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
Definition: pnat_test_stubs.h:50
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
VNET_FEATURES
#define VNET_FEATURES(...)
Definition: feature.h:470
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
VNET_LINK_IP6
@ VNET_LINK_IP6
Definition: interface.h:348
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
ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
Definition: ethernet.h:162
srv6_ad_nodes
const static char *const *const srv6_ad_nodes[DPO_PROTO_NUM]
Definition: ad.c:413
srv6_ad_localsid_t::nh_addr
ip46_address_t nh_addr
Proxied device address.
Definition: ad.h:36
clib_mem_alloc_aligned_at_offset
static void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
Definition: mem.h:225
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
rv
int __clib_unused rv
Definition: application.c:491
unformat_ip4_address
unformat_function_t unformat_ip4_address
Definition: format.h:68
vnet.h
VNET_SW_INTERFACE_TYPE_HARDWARE
@ VNET_SW_INTERFACE_TYPE_HARDWARE
Definition: interface.h:764
srv6_ad_main_t::sw_iface_localsid2
u32 * sw_iface_localsid2
Retrieve local SID from iface.
Definition: ad.h:59
srv6_ad_localsid_t::rw_len
u32 rw_len
Number of bits to be rewritten.
Definition: ad.h:42
srv6_ad_vft
const static dpo_vft_t srv6_ad_vft
Definition: ad.c:402
SID_CREATE_INVALID_IFACE_TYPE
#define SID_CREATE_INVALID_IFACE_TYPE
Definition: ad.c:28
srv6_ad_localsid_t
Definition: ad.h:34
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
function_name
unsigned char function_name[]
Definition: ad.c:32
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
srv6_ad_localsid_t::sw_if_index_in
u32 sw_if_index_in
Incoming iface from proxied dev.
Definition: ad.h:41
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
srv6_ad_localsid_t::sw_if_index_out
u32 sw_if_index_out
Outgoing iface to proxied dev.
Definition: ad.h:37
srv6_ad_ip6_nodes
const static char *const srv6_ad_ip6_nodes[]
Definition: ad.c:408