FD.io VPP  v19.04.2-12-g66b1689
Vector Packet Processing
gbp_policy_dpo.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 <vnet/dpo/dvr_dpo.h>
17 #include <vnet/dpo/drop_dpo.h>
20 
21 #include <plugins/gbp/gbp.h>
23 #include <plugins/gbp/gbp_recirc.h>
24 
25 #ifndef CLIB_MARCH_VARIANT
26 /**
27  * DPO pool
28  */
30 
31 /**
32  * DPO type registered for these GBP FWD
33  */
35 
36 static gbp_policy_dpo_t *
38 {
39  gbp_policy_dpo_t *gpd;
40 
41  pool_get_aligned_zero (gbp_policy_dpo_pool, gpd, CLIB_CACHE_LINE_BYTES);
42 
43  return (gpd);
44 }
45 
46 static inline gbp_policy_dpo_t *
48 {
50 
51  return (gbp_policy_dpo_get (dpo->dpoi_index));
52 }
53 
54 static inline index_t
56 {
57  return (gpd - gbp_policy_dpo_pool);
58 }
59 
60 static void
62 {
63  gbp_policy_dpo_t *gpd;
64 
65  gpd = gbp_policy_dpo_get_from_dpo (dpo);
66  gpd->gpd_locks++;
67 }
68 
69 static void
71 {
72  gbp_policy_dpo_t *gpd;
73 
74  gpd = gbp_policy_dpo_get_from_dpo (dpo);
75  gpd->gpd_locks--;
76 
77  if (0 == gpd->gpd_locks)
78  {
79  dpo_reset (&gpd->gpd_dpo);
80  pool_put (gbp_policy_dpo_pool, gpd);
81  }
82 }
83 
84 static u32
86 {
87  gbp_policy_dpo_t *gpd;
88 
89  gpd = gbp_policy_dpo_get_from_dpo (dpo);
90 
91  return (gpd->gpd_sw_if_index);
92 }
93 
94 void
97 {
98  gbp_policy_dpo_t *gpd;
99  dpo_id_t parent = DPO_INVALID;
100 
101  gpd = gbp_policy_dpo_alloc ();
102 
103  gpd->gpd_proto = dproto;
105  gpd->gpd_sclass = sclass;
106 
107  if (~0 != sw_if_index)
108  {
109  /*
110  * stack on the DVR DPO for the output interface
111  */
112  dvr_dpo_add_or_lock (sw_if_index, dproto, &parent);
113  }
114  else
115  {
116  dpo_copy (&parent, drop_dpo_get (dproto));
117  }
118 
119  dpo_stack (gbp_policy_dpo_type, dproto, &gpd->gpd_dpo, &parent);
121 }
122 
123 u8 *
124 format_gbp_policy_dpo (u8 * s, va_list * ap)
125 {
126  index_t index = va_arg (*ap, index_t);
127  u32 indent = va_arg (*ap, u32);
128  gbp_policy_dpo_t *gpd = gbp_policy_dpo_get (index);
129  vnet_main_t *vnm = vnet_get_main ();
130 
131  s = format (s, "gbp-policy-dpo: %U, sclass:%d out:%U",
133  (int) gpd->gpd_sclass,
135  s = format (s, "\n%U", format_white_space, indent + 2);
136  s = format (s, "%U", format_dpo_id, &gpd->gpd_dpo, indent + 4);
137 
138  return (s);
139 }
140 
141 /**
142  * Interpose a policy DPO
143  */
144 static void
146  const dpo_id_t * parent, dpo_id_t * clone)
147 {
148  gbp_policy_dpo_t *gpd, *gpd_clone;
149 
150  gpd_clone = gbp_policy_dpo_alloc ();
151  gpd = gbp_policy_dpo_get (original->dpoi_index);
152 
153  gpd_clone->gpd_proto = gpd->gpd_proto;
154  gpd_clone->gpd_sclass = gpd->gpd_sclass;
155  gpd_clone->gpd_sw_if_index = gpd->gpd_sw_if_index;
156 
157  /*
158  * if no interface is provided, grab one from the parent
159  * on which we stack
160  */
161  if (~0 == gpd_clone->gpd_sw_if_index)
162  gpd_clone->gpd_sw_if_index = dpo_get_urpf (parent);
163 
165  gpd_clone->gpd_proto, &gpd_clone->gpd_dpo, parent);
166 
167  dpo_set (clone,
169  gpd_clone->gpd_proto, gbp_policy_dpo_get_index (gpd_clone));
170 }
171 
172 const static dpo_vft_t gbp_policy_dpo_vft = {
174  .dv_unlock = gbp_policy_dpo_unlock,
175  .dv_format = format_gbp_policy_dpo,
176  .dv_get_urpf = gbp_policy_dpo_get_urpf,
177  .dv_mk_interpose = gbp_policy_dpo_interpose,
178 };
179 
180 /**
181  * @brief The per-protocol VLIB graph nodes that are assigned to a glean
182  * object.
183  *
184  * this means that these graph nodes are ones from which a glean is the
185  * parent object in the DPO-graph.
186  */
187 const static char *const gbp_policy_dpo_ip4_nodes[] = {
188  "ip4-gbp-policy-dpo",
189  NULL,
190 };
191 
192 const static char *const gbp_policy_dpo_ip6_nodes[] = {
193  "ip6-gbp-policy-dpo",
194  NULL,
195 };
196 
197 const static char *const *const gbp_policy_dpo_nodes[DPO_PROTO_NUM] = {
200 };
201 
204 {
205  return (gbp_policy_dpo_type);
206 }
207 
208 static clib_error_t *
210 {
211  gbp_policy_dpo_type = dpo_register_new_type (&gbp_policy_dpo_vft,
213 
214  return (NULL);
215 }
216 
218 #endif /* CLIB_MARCH_VARIANT */
219 
220 typedef enum
221 {
222 #define _(sym,str) GBP_POLICY_DPO_ERROR_##sym,
224 #undef _
227 
229 #define _(sym,string) string,
231 #undef _
232 };
233 
235 {
242 
243 typedef enum
244 {
248 
250 gbp_rule_l3_redirect (const gbp_rule_t * gu, vlib_buffer_t * b0, int is_ip6)
251 {
252  gbp_policy_node_t pnode;
253  const dpo_id_t *dpo;
254  dpo_proto_t dproto;
255 
256  pnode = (is_ip6 ? GBP_POLICY_NODE_IP6 : GBP_POLICY_NODE_IP4);
257  dproto = (is_ip6 ? DPO_PROTO_IP6 : DPO_PROTO_IP4);
258  dpo = &gu->gu_dpo[pnode][dproto];
259 
260  /* The flow hash is still valid as this is a IP packet being switched */
261  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = dpo->dpoi_index;
262 
263  return (dpo->dpoi_next_node);
264 }
265 
268  vlib_node_runtime_t * node,
269  vlib_frame_t * from_frame, u8 is_ip6)
270 {
271  gbp_main_t *gm = &gbp_main;
272  u32 n_left_from, next_index, *from, *to_next, thread_index;
273  u32 n_allow_intra, n_allow_a_bit;
274  gbp_rule_t *gu;
275 
276  from = vlib_frame_vector_args (from_frame);
277  n_left_from = from_frame->n_vectors;
278  n_allow_intra = n_allow_a_bit = 0;
279  thread_index = vm->thread_index;
280 
281  next_index = node->cached_next_index;
282 
283  while (n_left_from > 0)
284  {
285  u32 n_left_to_next;
286 
287  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
288 
289  while (n_left_from > 0 && n_left_to_next > 0)
290  {
291  const gbp_policy_dpo_t *gpd0;
292  u32 bi0, next0;
293  gbp_contract_key_t key0;
294  gbp_contract_t *gc0;
295  vlib_buffer_t *b0;
296  index_t gci0;
297  u8 action0;
298 
299  action0 = 0;
300  bi0 = from[0];
301  to_next[0] = bi0;
302  from += 1;
303  to_next += 1;
304  n_left_from -= 1;
305  n_left_to_next -= 1;
306  next0 = GBP_POLICY_DROP;
307 
308  b0 = vlib_get_buffer (vm, bi0);
309 
310  gc0 = NULL;
311  gpd0 = gbp_policy_dpo_get (vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
312  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = gpd0->gpd_dpo.dpoi_index;
313 
314  /*
315  * Reflection check; in and out on an ivxlan tunnel
316  */
318  && (vnet_buffer2 (b0)->gbp.flags & VXLAN_GBP_GPFLAGS_R))
319  {
320  goto trace;
321  }
322 
323  if (vnet_buffer2 (b0)->gbp.flags & VXLAN_GBP_GPFLAGS_A)
324  {
325  next0 = gpd0->gpd_dpo.dpoi_next_node;
326  key0.as_u32 = ~0;
327  n_allow_a_bit++;
328  goto trace;
329  }
330 
331  key0.gck_src = vnet_buffer2 (b0)->gbp.sclass;
332  key0.gck_dst = gpd0->gpd_sclass;
333 
334  if (SCLASS_INVALID != key0.gck_src)
335  {
336  if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
337  {
338  /*
339  * intra-epg allowed
340  */
341  next0 = gpd0->gpd_dpo.dpoi_next_node;
342  vnet_buffer2 (b0)->gbp.flags |= VXLAN_GBP_GPFLAGS_A;
343  n_allow_intra++;
344  action0 = 0;
345  }
346  else
347  {
348  gci0 = gbp_contract_find (&key0);
349 
350  if (INDEX_INVALID != gci0)
351  {
352  fa_5tuple_opaque_t pkt_5tuple0;
353  u32 acl_pos_p0, acl_match_p0;
354  u32 rule_match_p0, trace_bitmap0;
355  /*
356  * tests against the ACL
357  */
358  gc0 = gbp_contract_get (gci0);
361  gc0->gc_lc_index, b0,
362  is_ip6,
363  /* is_input */ 1,
364  /* is_l2_path */ 0,
365  &pkt_5tuple0);
368  gc0->gc_lc_index,
369  &pkt_5tuple0, is_ip6,
370  &action0, &acl_pos_p0,
371  &acl_match_p0,
372  &rule_match_p0,
373  &trace_bitmap0);
374 
375  if (action0 > 0)
376  {
377  vnet_buffer2 (b0)->gbp.flags |= VXLAN_GBP_GPFLAGS_A;
378  gu = gbp_rule_get (gc0->gc_rules[rule_match_p0]);
379  action0 = gu->gu_action;
380 
381  switch (gu->gu_action)
382  {
383  case GBP_RULE_PERMIT:
384  next0 = gpd0->gpd_dpo.dpoi_next_node;
385  break;
386  case GBP_RULE_DENY:
387  next0 = GBP_POLICY_DROP;
388  break;
389  case GBP_RULE_REDIRECT:
390  next0 = gbp_rule_l3_redirect (gu, b0, is_ip6);
391  break;
392  }
393  }
394  if (next0 == GBP_POLICY_DROP)
395  {
398  thread_index,
399  gci0, 1, vlib_buffer_length_in_chain (vm, b0));
400  b0->error =
401  node->errors[GBP_POLICY_DPO_ERROR_DROP_CONTRACT];
402  }
403  else
404  {
407  thread_index,
408  gci0, 1, vlib_buffer_length_in_chain (vm, b0));
409  }
410 
411  }
412  else
413  {
414  b0->error =
415  node->errors[GBP_POLICY_DPO_ERROR_DROP_NO_CONTRACT];
416  }
417  }
418  }
419  else
420  {
421  /*
422  * the src EPG is not set when the packet arrives on an EPG
423  * uplink interface and we do not need to apply policy
424  */
425  next0 = gpd0->gpd_dpo.dpoi_next_node;
426  }
427  trace:
428  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
429  {
431 
432  tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
433  tr->sclass = key0.gck_src;
434  tr->dclass = key0.gck_dst;
435  tr->acl_index = (gc0 ? gc0->gc_acl_index : ~0);
436  tr->flags = vnet_buffer2 (b0)->gbp.flags;
437  tr->action = action0;
438  }
439 
440  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
441  n_left_to_next, bi0, next0);
442  }
443  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
444  }
445 
447  GBP_POLICY_DPO_ERROR_ALLOW_INTRA,
448  n_allow_intra);
450  GBP_POLICY_DPO_ERROR_ALLOW_A_BIT,
451  n_allow_a_bit);
452 
453  return from_frame->n_vectors;
454 }
455 
456 static u8 *
457 format_gbp_policy_dpo_trace (u8 * s, va_list * args)
458 {
459  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
460  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
461  gbp_policy_dpo_trace_t *t = va_arg (*args, gbp_policy_dpo_trace_t *);
462 
463  s = format (s, " sclass:%d dclass:%d acl-index:%d flags:%U action:%d",
464  t->sclass, t->dclass, t->acl_index,
466 
467  return s;
468 }
469 
471  vlib_node_runtime_t * node,
472  vlib_frame_t * from_frame)
473 {
474  return (gbp_policy_dpo_inline (vm, node, from_frame, 0));
475 }
476 
478  vlib_node_runtime_t * node,
479  vlib_frame_t * from_frame)
480 {
481  return (gbp_policy_dpo_inline (vm, node, from_frame, 1));
482 }
483 
484 /* *INDENT-OFF* */
486  .name = "ip4-gbp-policy-dpo",
487  .vector_size = sizeof (u32),
488  .format_trace = format_gbp_policy_dpo_trace,
489 
491  .error_strings = gbp_policy_dpo_error_strings,
492 
493  .n_next_nodes = GBP_POLICY_N_NEXT,
494  .next_nodes =
495  {
496  [GBP_POLICY_DROP] = "ip4-drop",
497  }
498 };
500  .name = "ip6-gbp-policy-dpo",
501  .vector_size = sizeof (u32),
502  .format_trace = format_gbp_policy_dpo_trace,
503 
505  .error_strings = gbp_policy_dpo_error_strings,
506 
507  .n_next_nodes = GBP_POLICY_N_NEXT,
508  .next_nodes =
509  {
510  [GBP_POLICY_DROP] = "ip6-drop",
511  }
512 };
513 /* *INDENT-ON* */
514 
515 /*
516  * fd.io coding-style-patch-verification: ON
517  *
518  * Local Variables:
519  * eval: (c-set-style "gnu")
520  * End:
521  */
u32 sw_if_index
Definition: ipsec_gre.api:37
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:124
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:404
gbp_policy_next_t
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Definition: vlib_api_cli.c:862
static char * gbp_policy_dpo_error_strings[]
u16 sclass_t
Definition: gbp_types.h:24
#define CLIB_UNUSED(x)
Definition: clib.h:82
A virtual function table regisitered for a DPO type.
Definition: dpo.h:399
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
Definition: counter.h:220
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
#define vnet_buffer2(b)
Definition: buffer.h:428
#define NULL
Definition: clib.h:58
The key for an Contract.
Definition: gbp_contract.h:34
u32 thread_index
Definition: main.h:197
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:261
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:41
u32 dpo_get_urpf(const dpo_id_t *dpo)
Get a uRPF interface for the DPO.
Definition: dpo.c:381
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
#define VLIB_NODE_FN(node)
Definition: node.h:201
static gbp_rule_t * gbp_rule_get(index_t gui)
Definition: gbp_contract.h:198
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:469
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:366
static gbp_policy_dpo_t * gbp_policy_dpo_get_from_dpo(const dpo_id_t *dpo)
format_function_t format_vnet_sw_if_index_name
unsigned char u8
Definition: types.h:56
static acl_plugin_methods_t acl_plugin
static const char *const gbp_policy_dpo_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a glean object.
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
gbp_policy_dpo_t * gbp_policy_dpo_pool
DPO pool.
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
#define always_inline
Definition: clib.h:98
u8 * format_vxlan_gbp_header_gpflags(u8 *s, va_list *args)
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:113
static u32 vxlan_gbp_tunnel_by_sw_if_index(u32 sw_if_index)
Definition: vxlan_gbp.h:230
static uword gbp_policy_dpo_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip6)
static u8 * format_gbp_policy_dpo_trace(u8 *s, va_list *args)
static gbp_policy_dpo_t * gbp_policy_dpo_alloc(void)
unsigned int u32
Definition: types.h:88
u32 gpd_sw_if_index
output sw_if_index
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static void acl_plugin_fill_5tuple_inline(void *p_acl_main, u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
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:341
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:136
static clib_error_t * gbp_policy_dpo_module_init(vlib_main_t *vm)
dpo_type_t gbp_policy_dpo_get_type(void)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
u8 * format_gbp_policy_dpo(u8 *s, va_list *ap)
static u32 gbp_policy_dpo_get_urpf(const dpo_id_t *dpo)
The GBP FWD DPO.
static void gbp_policy_dpo_lock(dpo_id_t *dpo)
#define gm
Definition: dlmalloc.c:1217
dpo_type_t dpoi_type
the type
Definition: dpo.h:172
index_t * gc_rules
The ACL to apply for packets from the source to the destination EPG.
Definition: gbp_contract.h:132
static const char *const gbp_policy_dpo_ip6_nodes[]
sclass_t gck_src
source and destination EPGs for which the ACL applies
Definition: gbp_contract.h:43
u16 sclass
Definition: gbp.api:118
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:286
gbp_rule_action_t gu_action
Definition: gbp_contract.h:105
#define PREDICT_FALSE(x)
Definition: clib.h:111
static void gbp_policy_dpo_unlock(dpo_id_t *dpo)
#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:233
#define SCLASS_INVALID
Definition: gbp_types.h:25
u32 node_index
Node index.
Definition: node.h:495
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
Definition: buffer_node.h:218
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:368
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1180
void dvr_dpo_add_or_lock(u32 sw_if_index, dpo_proto_t dproto, dpo_id_t *dpo)
Definition: dvr_dpo.c:90
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
u16 n_vectors
Definition: node.h:395
#define foreach_gbp_policy_error
Definition: gbp_contract.h:21
vlib_main_t * vm
Definition: buffer.c:312
vlib_combined_counter_main_t gbp_contract_permit_counters
Definition: gbp_contract.c:44
struct gbp_policy_dpo_trace_t_ gbp_policy_dpo_trace_t
dpo_id_t gu_dpo[GBP_POLICY_N_NODES][FIB_PROTOCOL_IP_MAX]
DPO of the load-balance object used to redirect.
Definition: gbp_contract.h:112
#define ARRAY_LEN(x)
Definition: clib.h:62
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:465
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:185
static void gbp_policy_dpo_interpose(const dpo_id_t *original, const dpo_id_t *parent, dpo_id_t *clone)
Interpose a policy DPO.
sclass_t gpd_sclass
SClass.
static const char *const *const gbp_policy_dpo_nodes[DPO_PROTO_NUM]
gbp_policy_dpo_error_t
static gbp_policy_dpo_t * gbp_policy_dpo_get(index_t index)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:514
#define ASSERT(truth)
gbp_main_t gbp_main
Definition: gbp_api.c:87
static int acl_plugin_match_5tuple_inline(void *p_acl_main, u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
u16 gpd_locks
number of locks.
dpo_type_t gbp_policy_dpo_type
DPO type registered for these GBP FWD.
vlib_node_registration_t ip4_gbp_policy_dpo_node
(constructor) VLIB_REGISTER_NODE (ip4_gbp_policy_dpo_node)
static gbp_contract_t * gbp_contract_get(index_t gci)
Definition: gbp_contract.h:190
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
Definition: dpo.c:147
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:57
Definition: defs.h:47
#define DPO_PROTO_NUM
Definition: dpo.h:70
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:184
static u32 gbp_rule_l3_redirect(const gbp_rule_t *gu, vlib_buffer_t *b0, int is_ip6)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
VLIB buffer representation.
Definition: buffer.h:102
u64 uword
Definition: types.h:112
dpo_id_t gpd_dpo
Stacked DPO on DVR/ADJ of output interface.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:274
static index_t gbp_policy_dpo_get_index(gbp_policy_dpo_t *gpd)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:195
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
Definition: dpo.c:177
void gbp_policy_dpo_add_or_lock(dpo_proto_t dproto, sclass_t sclass, u32 sw_if_index, dpo_id_t *dpo)
Group Base Policy (GBP) defines:
Definition: gbp.h:43
dpo_proto_t gpd_proto
The protocol of packets using this DPO.
#define vnet_buffer(b)
Definition: buffer.h:369
enum gbp_policy_node_t_ gbp_policy_node_t
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:231
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:180
vlib_combined_counter_main_t gbp_contract_drop_counters
Definition: gbp_contract.c:49
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
vlib_node_registration_t ip6_gbp_policy_dpo_node
(constructor) VLIB_REGISTER_NODE (ip6_gbp_policy_dpo_node)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:85
static index_t gbp_contract_find(gbp_contract_key_t *key)
Definition: gbp_contract.h:175
A Group Based Policy Contract.
Definition: gbp_contract.h:119
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:515