FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
gbp_subnet.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 <plugins/gbp/gbp.h>
20 
21 #include <vnet/fib/fib_table.h>
22 #include <vnet/dpo/load_balance.h>
23 
24 /**
25  * a key for the DB
26  */
27 typedef struct gbp_subnet_key_t_
28 {
32 
33 /**
34  * Subnet
35  */
36 typedef struct gbp_subnet_t_
37 {
41 
42  union
43  {
44  struct
45  {
49  struct
50  {
52  } gs_l3_out;
53  };
54 
56 } gbp_subnet_t;
57 
58 /**
59  * A DB of the subnets; key={pfx,fib-index}
60  */
62 
63 /**
64  * pool of subnets
65  */
67 
69 
70 static index_t
71 gbp_subnet_db_find (u32 fib_index, const fib_prefix_t * pfx)
72 {
74  .gsk_pfx = *pfx,
75  .gsk_fib_index = fib_index,
76  };
77  uword *p;
78 
80 
81  if (NULL != p)
82  return p[0];
83 
84  return (INDEX_INVALID);
85 }
86 
87 static void
88 gbp_subnet_db_add (u32 fib_index, const fib_prefix_t * pfx, gbp_subnet_t * gs)
89 {
91 
92  key = clib_mem_alloc (sizeof (*key));
93 
94  clib_memcpy (&(key->gsk_pfx), pfx, sizeof (*pfx));
95  key->gsk_fib_index = fib_index;
96 
98 
99  gs->gs_key = key;
100 }
101 
102 static void
104 {
106 
107  clib_mem_free (gs->gs_key);
108  gs->gs_key = NULL;
109 }
110 
111 
112 static int
114 {
115  dpo_id_t gfd = DPO_INVALID;
116  gbp_route_domain_t *grd;
117  fib_protocol_t fproto;
118 
119  fproto = gs->gs_key->gsk_pfx.fp_proto;
120  grd = gbp_route_domain_get (gs->gs_rd);
121 
122  if (~0 == grd->grd_uu_sw_if_index[fproto])
123  return (VNET_API_ERROR_INVALID_SW_IF_INDEX);
124 
126  &gs->gs_key->gsk_pfx,
129  fib_proto_to_dpo (fproto),
131  grd->grd_uu_sw_if_index
132  [fproto], ~0, 1, NULL,
134 
135  dpo_reset (&gfd);
136 
137  return (0);
138 }
139 
140 static int
142 {
143  dpo_id_t gfd = DPO_INVALID;
144 
146  &gfd);
147 
149  &gs->gs_key->gsk_pfx,
152  &gfd);
153 
154  dpo_reset (&gfd);
155 
156  return (0);
157 }
158 
159 static int
161 {
162  dpo_id_t gpd = DPO_INVALID;
163 
164  gs->gs_stitched_external.gs_sclass = sclass;
165  gs->gs_stitched_external.gs_sw_if_index = sw_if_index;
166 
169  gs->gs_stitched_external.gs_sclass,
170  gs->gs_stitched_external.gs_sw_if_index, &gpd);
171 
173  &gs->gs_key->gsk_pfx,
177  &gpd);
178 
179  dpo_reset (&gpd);
180 
181  return (0);
182 }
183 
184 static int
186 {
188  dpo_id_t gpd = DPO_INVALID;
189 
190  gs->gs_l3_out.gs_sclass = sclass;
191 
194  gs->gs_l3_out.gs_sclass, ~0, &gpd);
195 
197  if (is_anon)
199 
201  &gs->gs_key->gsk_pfx,
203  flags, &gpd);
204 
205  dpo_reset (&gpd);
206 
207  return (0);
208 }
209 
210 static void
212 {
213  gbp_subnet_t *gs;
214 
216 
218  (GBP_SUBNET_L3_OUT == gs->gs_type
220  gs->gs_type) ? FIB_SOURCE_SPECIAL :
222 
223  gbp_subnet_db_del (gs);
225 
227 }
228 
229 int
231 {
232  gbp_route_domain_t *grd;
233  index_t gsi, grdi;
234  u32 fib_index;
235 
236  grdi = gbp_route_domain_find (rd_id);
237 
238  if (~0 == grdi)
239  return (VNET_API_ERROR_NO_SUCH_FIB);
240 
241  grd = gbp_route_domain_get (grdi);
242  fib_index = grd->grd_fib_index[pfx->fp_proto];
243 
244  gsi = gbp_subnet_db_find (fib_index, pfx);
245 
246  if (INDEX_INVALID == gsi)
247  return (VNET_API_ERROR_NO_SUCH_ENTRY);
248 
249  gbp_subnet_del_i (gsi);
250 
251  return (0);
252 }
253 
254 int
256  const fib_prefix_t * pfx,
258 {
259  gbp_route_domain_t *grd;
260  index_t grdi, gsi;
261  gbp_subnet_t *gs;
262  u32 fib_index;
263  int rv;
264 
265  switch (type)
266  {
270  case GBP_SUBNET_L3_OUT:
272  break;
273  default:
274  return (VNET_API_ERROR_INCORRECT_ADJACENCY_TYPE);
275  }
276 
278 
279  if (~0 == grdi)
280  return (VNET_API_ERROR_NO_SUCH_FIB);
281 
282  grd = gbp_route_domain_get (grdi);
283  fib_index = grd->grd_fib_index[pfx->fp_proto];
284 
285  gsi = gbp_subnet_db_find (fib_index, pfx);
286 
287  /*
288  * this is an update if the subnet already exists, so remove the old
289  */
290  if (INDEX_INVALID != gsi)
291  gbp_subnet_del_i (gsi);
292 
293  rv = -2;
294 
296 
297  gs->gs_type = type;
298  gs->gs_rd = grdi;
299  gbp_subnet_db_add (fib_index, pfx, gs);
300 
301  switch (type)
302  {
305  break;
308  break;
311  break;
312  case GBP_SUBNET_L3_OUT:
313  rv = gbp_subnet_l3_out_add (gs, sclass, 0 /* is_anon */ );
314  break;
316  rv = gbp_subnet_l3_out_add (gs, sclass, 1 /* is_anon */ );
317  break;
318  }
319 
320  return (rv);
321 }
322 
323 static clib_error_t *
325  unformat_input_t * input, vlib_cli_command_t * cmd)
326 {
327  unformat_input_t _line_input, *line_input = &_line_input;
328  vnet_main_t *vnm = vnet_get_main ();
330  int length;
331  u32 rd_id = ~0;
332  u32 sw_if_index = ~0;
333  gbp_subnet_type_t type = ~0;
334  u32 sclass = ~0;
335  int is_add = 1;
336  int rv;
337 
338  /* Get a line of input. */
339  if (!unformat_user (input, unformat_line_input, line_input))
340  return 0;
341 
342  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
343  {
344  if (unformat (line_input, "del"))
345  is_add = 0;
346  else if (unformat (line_input, "rd %d", &rd_id))
347  ;
348  else
349  if (unformat
350  (line_input, "prefix %U/%d", unformat_ip4_address,
351  &pfx.fp_addr.ip4, &length))
353  else
354  if (unformat
355  (line_input, "prefix %U/%d", unformat_ip6_address,
356  &pfx.fp_addr.ip6, &length))
358  else if (unformat (line_input, "type transport"))
360  else if (unformat (line_input, "type stitched-internal"))
362  else if (unformat (line_input, "type stitched-external"))
364  else if (unformat (line_input, "type anon-l3-out"))
366  else if (unformat (line_input, "type l3-out"))
368  else
369  if (unformat_user
370  (line_input, unformat_vnet_sw_interface, vnm, &sw_if_index))
371  ;
372  else if (unformat (line_input, "sclass %u", &sclass))
373  ;
374  else
375  return clib_error_return (0, "unknown input `%U'",
376  format_unformat_error, line_input);
377  }
378  unformat_free (line_input);
379 
380  pfx.fp_len = length;
381 
382  if (is_add)
384  else
385  rv = gbp_subnet_del (rd_id, &pfx);
386 
387  switch (rv)
388  {
389  case 0:
390  return 0;
391  case VNET_API_ERROR_NO_SUCH_FIB:
392  return clib_error_return (0, "no such FIB");
393  }
394 
395  return clib_error_return (0, "unknown error %d", rv);
396 }
397 
398 /*?
399  * Add Group Based Policy Subnets
400  *
401  * @cliexpar
402  * @cliexstart{gbp subnet [del] rd <ID> prefix <prefix> type <type> [<interface>] [sclass <sclass>]}
403  * @cliexend
404  ?*/
405 /* *INDENT-OFF* */
407  .path = "gbp subnet",
408  .short_help = "gbp subnet [del] rd <ID> prefix <prefix> type <type> [<interface>] [sclass <sclass>]\n",
409  .function = gbp_subnet_add_del_cli,
410 };
411 /* *INDENT-ON* */
412 
413 
414 
415 void
417 {
418  gbp_route_domain_t *grd;
419  gbp_subnet_t *gs;
422 
424  sw_if_index = ~0;
425 
426  /* *INDENT-OFF* */
428  {
429  grd = gbp_route_domain_get(gs->gs_rd);
430 
431  switch (gs->gs_type)
432  {
435  /* use defaults above */
436  break;
438  sw_if_index = gs->gs_stitched_external.gs_sw_if_index;
439  sclass = gs->gs_stitched_external.gs_sclass;
440  break;
441  case GBP_SUBNET_L3_OUT:
443  sclass = gs->gs_l3_out.gs_sclass;
444  break;
445  }
446 
447  if (WALK_STOP == cb (grd->grd_id, &gs->gs_key->gsk_pfx,
448  gs->gs_type, sw_if_index, sclass, ctx))
449  break;
450  }
451  /* *INDENT-ON* */
452 }
453 
455 {
459 
460 static u8 *
461 format_gbp_subnet_type (u8 * s, va_list * args)
462 {
463  gbp_subnet_type_t type = va_arg (*args, gbp_subnet_type_t);
464 
465  switch (type)
466  {
468  return (format (s, "stitched-internal"));
470  return (format (s, "stitched-external"));
472  return (format (s, "transport"));
473  case GBP_SUBNET_L3_OUT:
474  return (format (s, "l3-out"));
476  return (format (s, "anon-l3-out"));
477  }
478 
479  return (format (s, "unknown"));
480 }
481 
482 u8 *
483 format_gbp_subnet (u8 * s, va_list * args)
484 {
485  index_t gsi = va_arg (*args, index_t);
487  gbp_subnet_t *gs;
488  u32 table_id;
489 
491 
493  gs->gs_key->gsk_pfx.fp_proto);
494 
495  s = format (s, "[%d] tbl:%d %U %U", gsi, table_id,
498 
499  switch (gs->gs_type)
500  {
503  break;
505  s = format (s, " {sclass:%d %U}", gs->gs_stitched_external.gs_sclass,
507  vnet_get_main (), gs->gs_stitched_external.gs_sw_if_index);
508  break;
509  case GBP_SUBNET_L3_OUT:
511  s = format (s, " {sclass:%d}", gs->gs_l3_out.gs_sclass);
512  break;
513  }
514 
515  switch (flags)
516  {
518  {
519  s = format (s, "\n %U", format_fib_entry, gs->gs_fei,
521  }
523  break;
524  }
525  return (s);
526 }
527 
528 static clib_error_t *
530  unformat_input_t * input, vlib_cli_command_t * cmd)
531 {
532  u32 gsi;
533 
534  gsi = INDEX_INVALID;
535 
537  {
538  if (unformat (input, "%d", &gsi))
539  ;
540  else
541  break;
542  }
543 
544  if (INDEX_INVALID != gsi)
545  {
546  vlib_cli_output (vm, "%U", format_gbp_subnet, gsi,
548  }
549  else
550  {
551  /* *INDENT-OFF* */
553  {
554  vlib_cli_output (vm, "%U", format_gbp_subnet, gsi,
556  }
557  /* *INDENT-ON* */
558  }
559 
560  return (NULL);
561 }
562 
563 /*?
564  * Show Group Based Policy Subnets
565  *
566  * @cliexpar
567  * @cliexstart{show gbp subnet}
568  * @cliexend
569  ?*/
570 /* *INDENT-OFF* */
572  .path = "show gbp subnet",
573  .short_help = "show gbp subnet\n",
574  .function = gbp_subnet_show,
575 };
576 /* *INDENT-ON* */
577 
578 static clib_error_t *
580 {
582  sizeof (gbp_subnet_key_t), sizeof (u32));
583  gbp_fib_source = fib_source_allocate ("gbp-subnet",
586 
587  return (NULL);
588 }
589 
591 
592 /*
593  * fd.io coding-style-patch-verification: ON
594  *
595  * Local Variables:
596  * eval: (c-set-style "gnu")
597  * End:
598  */
load_balance.h
gbp_subnet_db_del
static void gbp_subnet_db_del(gbp_subnet_t *gs)
Definition: gbp_subnet.c:103
gbp_policy_dpo.h
DPO_INVALID
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
gbp_subnet_cb_t
walk_rc_t(* gbp_subnet_cb_t)(u32 rd_id, const fib_prefix_t *pfx, gbp_subnet_type_t type, u32 sw_if_index, sclass_t sclass, void *ctx)
Definition: gbp_subnet.h:37
fib_table_entry_special_dpo_add
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
Definition: fib_table.c:324
gbp_subnet_t_::gs_key
gbp_subnet_key_t * gs_key
Definition: gbp_subnet.c:38
gsb_subnet_show_flags_t
enum gsb_subnet_show_flags_t_ gsb_subnet_show_flags_t
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
fib_table_get_table_id
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
Definition: fib_table.c:1100
gbp_subnet_walk
void gbp_subnet_walk(gbp_subnet_cb_t cb, void *ctx)
Definition: gbp_subnet.c:416
fib_table_entry_update_one_path
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
Definition: fib_table.c:819
SCLASS_INVALID
#define SCLASS_INVALID
Definition: gbp_types.h:26
gpb_route_domain_t_::grd_fib_index
u32 grd_fib_index[FIB_PROTOCOL_IP_MAX]
Definition: gbp_route_domain.h:36
ip46_address_initializer
#define ip46_address_initializer
Definition: ip46_address.h:52
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
GBP_SUBNET_SHOW_DETAILS
@ GBP_SUBNET_SHOW_DETAILS
Definition: gbp_subnet.c:457
FIB_ENTRY_FORMAT_DETAIL
#define FIB_ENTRY_FORMAT_DETAIL
Definition: fib_entry.h:360
gbp_subnet_init
static clib_error_t * gbp_subnet_init(vlib_main_t *vm)
Definition: gbp_subnet.c:579
clib_mem_free
static void clib_mem_free(void *p)
Definition: mem.h:314
gbp_subnet_t_::gs_rd
index_t gs_rd
Definition: gbp_subnet.c:40
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
vlib_cli_command_t::path
char * path
Definition: cli.h:96
gbp_subnet_del_i
static void gbp_subnet_del_i(index_t gsi)
Definition: gbp_subnet.c:211
gbp_subnet_key_t
struct gbp_subnet_key_t_ gbp_subnet_key_t
a key for the DB
fib_table.h
gbp.h
gbp_subnet_key_t_::gsk_fib_index
u32 gsk_fib_index
Definition: gbp_subnet.c:30
ADJ_BCAST_ADDR
const ip46_address_t ADJ_BCAST_ADDR
The special broadcast address (to construct a broadcast adjacency.
Definition: adj.c:42
hash_set_mem
#define hash_set_mem(h, key, value)
Definition: hash.h:275
fib_prefix_t_::fp_len
u16 fp_len
The mask length.
Definition: fib_types.h:206
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
gpb_route_domain_t_
A route Domain Representation.
Definition: gbp_route_domain.h:29
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
GBP_SUBNET_STITCHED_INTERNAL
@ GBP_SUBNET_STITCHED_INTERNAL
Definition: gbp_subnet.h:24
gpb_route_domain_t_::grd_id
u32 grd_id
Route-domain ID.
Definition: gbp_route_domain.h:34
gbp_subnet_t_::gs_sclass
sclass_t gs_sclass
Definition: gbp_subnet.c:46
gbp_subnet_pool
gbp_subnet_t * gbp_subnet_pool
pool of subnets
Definition: gbp_subnet.c:66
FIB_ENTRY_FLAG_EXCLUSIVE
@ FIB_ENTRY_FLAG_EXCLUSIVE
Definition: fib_entry.h:116
unformat_input_t
struct _unformat_input_t unformat_input_t
gbp_subnet_add
int gbp_subnet_add(u32 rd_id, const fib_prefix_t *pfx, gbp_subnet_type_t type, u32 sw_if_index, sclass_t sclass)
Definition: gbp_subnet.c:255
FIB_ENTRY_FLAG_INTERPOSE
@ FIB_ENTRY_FLAG_INTERPOSE
Definition: fib_entry.h:123
fib_table_entry_special_dpo_update
fib_node_index_t fib_table_entry_special_dpo_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Update a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the...
Definition: fib_table.c:363
key
typedef key
Definition: ipsec_types.api:91
gbp_subnet_external_add
static int gbp_subnet_external_add(gbp_subnet_t *gs, u32 sw_if_index, sclass_t sclass)
Definition: gbp_subnet.c:160
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
gbp_subnet_add_del_cli
static clib_error_t * gbp_subnet_add_del_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gbp_subnet.c:324
GBP_SUBNET_STITCHED_EXTERNAL
@ GBP_SUBNET_STITCHED_EXTERNAL
Definition: gbp_subnet.h:25
FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT
@ FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT
Definition: fib_entry.h:120
GBP_SUBNET_TRANSPORT
@ GBP_SUBNET_TRANSPORT
Definition: gbp_subnet.h:23
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
gbp_subnet_t_::gs_sw_if_index
u32 gs_sw_if_index
Definition: gbp_subnet.c:47
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
fib_entry_flag_t
enum fib_entry_flag_t_ fib_entry_flag_t
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
gbp_subnet_t_::gs_type
gbp_subnet_type_t gs_type
Definition: gbp_subnet.c:39
hash_unset_mem
#define hash_unset_mem(h, key)
Definition: hash.h:291
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
gbp_subnet_add_del
static vlib_cli_command_t gbp_subnet_add_del
(constructor) VLIB_CLI_COMMAND (gbp_subnet_add_del)
Definition: gbp_subnet.c:406
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
gpb_route_domain_t_::grd_uu_sw_if_index
u32 grd_uu_sw_if_index[FIB_PROTOCOL_IP_MAX]
The interfaces on which to send packets to unnknown EPs.
Definition: gbp_route_domain.h:42
FIB_ENTRY_FLAG_NONE
@ FIB_ENTRY_FLAG_NONE
Definition: fib_entry.h:112
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
gbp_fwd_dpo_add_or_lock
void gbp_fwd_dpo_add_or_lock(dpo_proto_t dproto, dpo_id_t *dpo)
Definition: gbp_fwd_dpo.c:88
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
gbp_subnet_t_::gs_l3_out
struct gbp_subnet_t_::@677::@680 gs_l3_out
uword
u64 uword
Definition: types.h:112
gbp_fwd_dpo.h
gbp_subnet_db
uword * gbp_subnet_db
A DB of the subnets; key={pfx,fib-index}.
Definition: gbp_subnet.c:61
gbp_subnet_del
int gbp_subnet_del(u32 rd_id, const fib_prefix_t *pfx)
Definition: gbp_subnet.c:230
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
gbp_subnet_transport_add
static int gbp_subnet_transport_add(gbp_subnet_t *gs)
Definition: gbp_subnet.c:113
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
GBP_SUBNET_ANON_L3_OUT
@ GBP_SUBNET_ANON_L3_OUT
Definition: gbp_subnet.h:27
sclass
u16 sclass
Definition: gbp.api:131
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
gbp_subnet_type_t
enum gbp_subnet_type_t_ gbp_subnet_type_t
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
fib_source_allocate
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
Definition: fib_source.c:118
fib_proto_to_dpo
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
fib_prefix_t_::fp_addr
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:225
gbp_subnet_internal_add
static int gbp_subnet_internal_add(gbp_subnet_t *gs)
Definition: gbp_subnet.c:141
gbp_subnet_t
struct gbp_subnet_t_ gbp_subnet_t
Subnet.
gbp_route_domain_get_scope
gbp_scope_t gbp_route_domain_get_scope(index_t grdi)
Definition: gbp_route_domain.c:246
FIB_SOURCE_PRIORITY_HI
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
Definition: fib_source.h:284
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
vnet_main_t
Definition: vnet.h:76
gbp_subnet_db_find
static index_t gbp_subnet_db_find(u32 fib_index, const fib_prefix_t *pfx)
Definition: gbp_subnet.c:71
rd_id
u32 rd_id
Definition: gbp.api:35
format_gbp_subnet
u8 * format_gbp_subnet(u8 *s, va_list *args)
Definition: gbp_subnet.c:483
FIB_ENTRY_FLAG_COVERED_INHERIT
@ FIB_ENTRY_FLAG_COVERED_INHERIT
Definition: fib_entry.h:122
sclass_t
u16 sclass_t
Definition: gbp_types.h:25
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:572
gbp_subnet_key_t_
a key for the DB
Definition: gbp_subnet.c:27
GBP_SUBNET_L3_OUT
@ GBP_SUBNET_L3_OUT
Definition: gbp_subnet.h:26
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:458
gbp_subnet_t_
Subnet.
Definition: gbp_subnet.c:36
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
gbp_policy_dpo_add_or_lock
void gbp_policy_dpo_add_or_lock(dpo_proto_t dproto, gbp_scope_t scope, sclass_t sclass, u32 sw_if_index, dpo_id_t *dpo)
Definition: gbp_policy_dpo.c:97
FIB_ROUTE_PATH_FLAG_NONE
@ FIB_ROUTE_PATH_FLAG_NONE
Definition: fib_types.h:332
gbp_subnet_t_::gs_stitched_external
struct gbp_subnet_t_::@677::@679 gs_stitched_external
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
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
format_fib_prefix
u8 * format_fib_prefix(u8 *s, va_list *args)
Definition: fib_types.c:283
gbp_subnet_t_::gs_fei
fib_node_index_t gs_fei
Definition: gbp_subnet.c:55
gbp_route_domain_get
gbp_route_domain_t * gbp_route_domain_get(index_t i)
Definition: gbp_route_domain.c:72
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
gbp_route_domain_find_and_lock
index_t gbp_route_domain_find_and_lock(u32 rd_id)
Definition: gbp_route_domain.c:100
FIB_SOURCE_SPECIAL
@ FIB_SOURCE_SPECIAL
Special sources.
Definition: fib_source.h:45
length
char const int length
Definition: cJSON.h:163
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
gbp_fib_source
static fib_source_t gbp_fib_source
Definition: gbp_subnet.c:68
gbp_subnet_l3_out_add
static int gbp_subnet_l3_out_add(gbp_subnet_t *gs, sclass_t sclass, int is_anon)
Definition: gbp_subnet.c:185
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
FIB_SOURCE_BH_SIMPLE
@ FIB_SOURCE_BH_SIMPLE
add paths without path extensions
Definition: fib_source.h:210
format_gbp_subnet_type
static u8 * format_gbp_subnet_type(u8 *s, va_list *args)
Definition: gbp_subnet.c:461
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
fib_source_t
enum fib_source_t_ fib_source_t
The different sources that can create a route.
unformat_ip6_address
unformat_function_t unformat_ip6_address
Definition: format.h:89
rv
int __clib_unused rv
Definition: application.c:491
gbp_route_domain.h
unformat_ip4_address
unformat_function_t unformat_ip4_address
Definition: format.h:68
fib_table_entry_delete_index
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:924
GBP_SUBNET_SHOW_BRIEF
@ GBP_SUBNET_SHOW_BRIEF
Definition: gbp_subnet.c:456
gbp_subnet_key_t_::gsk_pfx
fib_prefix_t gsk_pfx
Definition: gbp_subnet.c:29
gbp_subnet_show
static clib_error_t * gbp_subnet_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gbp_subnet.c:529
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
gbp_subnet_show_node
static vlib_cli_command_t gbp_subnet_show_node
(constructor) VLIB_CLI_COMMAND (gbp_subnet_show_node)
Definition: gbp_subnet.c:571
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
gsb_subnet_show_flags_t_
gsb_subnet_show_flags_t_
Definition: gbp_subnet.c:454
gbp_route_domain_find
index_t gbp_route_domain_find(u32 rd_id)
Definition: gbp_route_domain.c:87
gbp_subnet_db_add
static void gbp_subnet_db_add(u32 fib_index, const fib_prefix_t *pfx, gbp_subnet_t *gs)
Definition: gbp_subnet.c:88
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
clib_mem_alloc
static void * clib_mem_alloc(uword size)
Definition: mem.h:256
WALK_STOP
@ WALK_STOP
Definition: interface_funcs.h:173
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
gbp_route_domain_unlock
void gbp_route_domain_unlock(index_t index)
Definition: gbp_route_domain.c:208
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
format_fib_entry
u8 * format_fib_entry(u8 *s, va_list *args)
Definition: fib_entry.c:130