FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
stn.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 <stn/stn.h>
17 
18 #include <vnet/plugin/plugin.h>
19 #include <vpp/app/version.h>
20 #include <vnet/ip/format.h>
21 #include <vnet/ip/punt.h>
22 #include <vnet/ethernet/packet.h>
23 
27 
28 static u8 stn_hw_addr_local[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
29 static u8 stn_hw_addr_dst[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
30 
33 
34 typedef struct {
37 
38 static u8 *
39 format_stn_rule (u8 * s, va_list * args)
40 {
41  stn_rule_t *r = va_arg (*args, stn_rule_t *);
42  stn_main_t *stn = &stn_main;
43  u32 indent = format_get_indent (s);
45  vlib_node_t *next_node = vlib_get_next_node(vlib_get_main(), node_index, r->next_node_index);
46  s = format (s, "rule_index: %d\n", r - stn->rules);
47  s = format (s, "%Uaddress: %U\n", format_white_space, indent,
48  format_ip46_address, &r->address, IP46_TYPE_ANY);
49  s = format (s, "%Uiface: %U (%d)\n", format_white_space, indent,
51  r->sw_if_index);
52  s = format (s, "%Unext_node: %s (%d)", format_white_space, indent,
53  next_node->name, next_node->index);
54  return s;
55 }
56 
58 format_stn_ip46_punt_trace (u8 * s, va_list * args, u8 is_ipv4)
59 {
60  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
61  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
62  stn_ip46_punt_trace_t *t = va_arg (*args, stn_ip46_punt_trace_t *);
63  u32 indent = format_get_indent (s);
64 
65  s = format (s, "dst_address: %U\n", format_ip46_address,
66  (ip46_address_t *)t->kv.key, IP46_TYPE_ANY);
67 
68  if (t->kv.value == ~(0L))
69  {
70  s = format (s, "%Urule: none", format_white_space, indent);
71  }
72  else
73  {
74  s = format (s, "%Urule:\n%U%U", format_white_space, indent,
75  format_white_space, indent + 2,
77  }
78  return s;
79 }
80 
81 typedef enum
82 {
86 
91  u8 is_ipv4)
92 {
93  u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
94  stn_main_t *stn = &stn_main;
95 
97  n_left_from = frame->n_vectors;
98  next_index = node->cached_next_index;
99 
100  while (n_left_from > 0)
101  {
102  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
103 
104  /* Single loop */
105  while (n_left_from > 0 && n_left_to_next > 0)
106  {
107  u32 pi0;
108  vlib_buffer_t *p0;
110  u32 next0 = STN_IP_PUNT_DROP;
111 
112  pi0 = to_next[0] = from[0];
113  from += 1;
114  n_left_from -= 1;
115  to_next += 1;
116  n_left_to_next -= 1;
117 
118  p0 = vlib_get_buffer (vm, pi0);
119 
120  if (is_ipv4)
121  {
123  ip46_address_set_ip4((ip46_address_t *)kv.key, &hdr->dst_address);
124  }
125  else
126  {
128  kv.key[0] = hdr->dst_address.as_u64[0];
129  kv.key[1] = hdr->dst_address.as_u64[1];
130  }
131 
132  kv.value = ~(0L);
133  clib_bihash_search_inline_16_8 (&stn->rule_by_address_table, &kv);
134  if (kv.value != ~(0L))
135  {
136  ethernet_header_t *eth;
137  stn_rule_t *r = &stn->rules[kv.value];
138  vnet_buffer(p0)->sw_if_index[VLIB_TX] = r->sw_if_index;
139  next0 = r->next_node_index;
140  vlib_buffer_advance(p0, -sizeof(*eth));
142  if (is_ipv4)
143  clib_memcpy_fast(eth, &stn_ip4_ethernet_header, sizeof(*eth));
144  else
145  clib_memcpy_fast(eth, &stn_ip6_ethernet_header, sizeof(*eth));
146  }
147  else
148  {
149  vnet_feature_next (&next0, p0);
150  }
151 
152  if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED))
153  {
155  vlib_add_trace (vm, node, p0, sizeof (*tr));
156  tr->kv = kv;
157  }
158 
160  n_left_to_next, pi0, next0);
161  }
162  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
163  }
164 
165  return frame->n_vectors;
166 }
167 
168 
169 #define foreach_stn_ip_punt_error \
170  _(NONE, "no error")
171 
172 typedef enum {
173 #define _(sym,str) STN_IP_punt_ERROR_##sym,
175 #undef _
177 } ila_error_t;
178 
179 static char *stn_ip_punt_error_strings[] = {
180 #define _(sym,string) string,
182 #undef _
183 };
184 
185 u8 *
186 format_stn_ip6_punt_trace (u8 * s, va_list * args)
187 {
188  return format_stn_ip46_punt_trace (s, args, 0);
189 }
190 
191 static uword
194 {
195  return stn_ip46_punt_fn(vm, node, frame, 0);
196 }
197 
198 /** *INDENT-OFF* */
200 {
201  .function = stn_ip6_punt_fn,
202  .name = "stn-ip6-punt",
203  .vector_size = sizeof (u32),
204  .format_trace = format_stn_ip6_punt_trace,
205  .n_errors = STN_IP_PUNT_N_ERROR,
206  .error_strings = stn_ip_punt_error_strings,
207  .n_next_nodes = STN_IP_PUNT_N_NEXT,
208  .next_nodes =
209  {
210  [STN_IP_PUNT_DROP] = "error-drop"
211  },
212 };
213 VNET_FEATURE_INIT (stn_ip6_punt_feat_node, static) = {
214  .arc_name = "ip6-punt",
215  .node_name = "stn-ip6-punt",
216  .runs_before = VNET_FEATURES("ip6-punt-redirect"),
217 };
218 /** *INDENT-ON* */
219 
220 u8 *
221 format_stn_ip4_punt_trace (u8 * s, va_list * args)
222 {
223  return format_stn_ip46_punt_trace (s, args, 1);
224 }
225 
226 static uword
229 {
230  return stn_ip46_punt_fn(vm, node, frame, 1);
231 }
232 
233 /** *INDENT-OFF* */
235 {
236  .function = stn_ip4_punt_fn,
237  .name = "stn-ip4-punt",
238  .vector_size = sizeof (u32),
239  .format_trace = format_stn_ip4_punt_trace,
240  .n_errors = STN_IP_PUNT_N_ERROR,
241  .error_strings = stn_ip_punt_error_strings,
242  .n_next_nodes = STN_IP_PUNT_N_NEXT,
243  .next_nodes =
244  {
245  [STN_IP_PUNT_DROP] = "error-drop",
246  },
247 };
248 VNET_FEATURE_INIT (stn_ip4_punt_feat_node, static) = {
249  .arc_name = "ip4-punt",
250  .node_name = "stn-ip4-punt",
251  .runs_before = VNET_FEATURES("ip4-punt-redirect"),
252 };
253 /** *INDENT-ON* */
254 
255 clib_error_t *
257 {
258  stn_main_t *stn = &stn_main;
259  stn->rules = 0;
260  clib_bihash_init_16_8(&stn->rule_by_address_table, "stn addresses",
261  1024, 1<<20);
262 
265  stn_ip4_ethernet_header.type = clib_host_to_net_u16(ETHERNET_TYPE_IP4);
266 
269  stn_ip6_ethernet_header.type = clib_host_to_net_u16(ETHERNET_TYPE_IP6);
270 
271  return stn_api_init (vm, stn);
272 
273  return NULL;
274 }
275 
277 
278 /* *INDENT-OFF* */
280  .version = VPP_BUILD_VER,
281  .description = "VPP Steals the NIC (STN) for Container Integration",
282 };
283 /* *INDENT-ON* */
284 
286 {
287  vnet_main_t *vnm = vnet_get_main();
289  stn_main_t *stn = &stn_main;
290 
291  stn_rule_t *r = NULL;
293  kv.key[0] = args->address.as_u64[0];
294  kv.key[1] = args->address.as_u64[1];
295 
296  if (clib_bihash_search_inline_16_8 (&stn->rule_by_address_table, &kv) == 0)
297  {
298  r = &stn->rules[kv.value];
299  }
300  else if (!args->del)
301  {
302  pool_get(stn->rules, r);
303  kv.value = r - stn->rules;
304  clib_bihash_add_del_16_8(&stn->rule_by_address_table, &kv, 1);
305  r->address = args->address;
306 
307  stn->n_rules++;
308  if (stn->n_rules == 1)
309  {
310  vnet_feature_enable_disable("ip6-punt", "stn-ip6-punt",
311  0, 1, 0, 0);
312  vnet_feature_enable_disable("ip4-punt", "stn-ip4-punt",
313  0, 1, 0, 0);
314 
315  punt_reg_t pr = {
316  .punt = {
317  .l4 = {
318  .af = AF_IP4,
319  .port = ~0,
320  .protocol = IP_PROTOCOL_UDP,
321  },
322  },
323  .type = PUNT_TYPE_L4,
324  };
325  vnet_punt_add_del (vm, &pr, 1 /* is_add */);
326  pr.punt.l4.af = AF_IP6;
327  vnet_punt_add_del (vm, &pr, 1 /* is_add */);
328  pr.punt.l4.protocol = IP_PROTOCOL_TCP;
329  vnet_punt_add_del (vm, &pr, 1 /* is_add */);
330  pr.punt.l4.af = AF_IP4;
331  vnet_punt_add_del (vm, &pr, 1 /* is_add */);
332  }
333  }
334 
335  if (!args->del)
336  {
337  /* Getting output node and adding it as next */
338  u32 output_node_index =
341  stn_ip4_punt.index : stn_ip6_punt.index;
342 
343  r->sw_if_index = args->sw_if_index;
344  r->next_node_index =
345  vlib_node_add_next(vm, node_index, output_node_index);
346 
347  /* enabling forwarding on the output node (might not be done since
348  * it is unnumbered) */
351  }
352  else if (r)
353  {
354  clib_bihash_add_del_16_8(&stn->rule_by_address_table, &kv, 0);
355  pool_put(stn->rules, r);
356 
357  stn->n_rules--;
358  if (stn->n_rules == 0)
359  {
360  vnet_feature_enable_disable("ip6-punt", "stn-ip6-punt",
361  0, 0, 0, 0);
362  vnet_feature_enable_disable("ip4-punt", "stn-ip4-punt",
363  0, 0, 0, 0);
364  }
365  }
366  else
367  {
368  return VNET_API_ERROR_NO_SUCH_ENTRY;
369  }
370 
371  return 0;
372 }
373 
374 static clib_error_t *
376  unformat_input_t * input, vlib_cli_command_t * cmd)
377 {
378  stn_main_t *stn = &stn_main;
379  u8 *s = 0;
380  stn_rule_t *rule;
381  pool_foreach (rule, stn->rules) {
382  s = format (s, "- %U\n", format_stn_rule, rule);
383  }
384 
385  vlib_cli_output(vm, "%v", s);
386 
387  vec_free(s);
388  return NULL;
389 }
390 
392 {
393  .path = "show stn rules",
394  .short_help = "",
395  .function = show_stn_rules_fn,
396 };
397 
398 static clib_error_t *
400  unformat_input_t * input, vlib_cli_command_t * cmd)
401 {
402  unformat_input_t _line_input, *line_input = &_line_input;
403  clib_error_t *error = 0;
404  stn_rule_add_del_args_t args = {};
405  u8 got_addr = 0;
406  u8 got_iface = 0;
407  int ret;
408 
409  if (!unformat_user (input, unformat_line_input, line_input))
410  return 0;
411 
412  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
413  {
414  if (unformat (line_input, "address %U", unformat_ip46_address,
415  &args.address, IP46_TYPE_ANY))
416  got_addr = 1;
417  else if (unformat
418  (line_input, "interface %U", unformat_vnet_sw_interface,
419  vnet_get_main(), &args.sw_if_index))
420  got_iface = 1;
421  else if (unformat (line_input, "del"))
422  args.del = 1;
423  else
424  {
425  error = clib_error_return (0, "parse error: '%U'",
426  format_unformat_error, line_input);
427  goto done;
428  }
429  }
430 
431  if (!got_addr)
432  {
433  error = clib_error_return (0, "Missing address");
434  goto done;
435  }
436 
437  if (!got_iface)
438  {
439  error = clib_error_return (0, "Missing interface");
440  goto done;
441  }
442 
443  if ((ret = stn_rule_add_del (&args)))
444  {
445  error = clib_error_return (0, "stn_rule_add_del returned error %d", ret);
446  goto done;
447  }
448 
449 done:
450  unformat_free (line_input);
451  return error;
452 }
453 
455 {
456  .path = "stn rule",
457  .short_help = "address <addr> interface <iface> [del]",
458  .function = stn_rule_fn,
459 };
stn_ip46_punt_trace_t::kv
clib_bihash_kv_16_8_t kv
Definition: stn.c:35
stn_ip6_ethernet_header
static ethernet_header_t stn_ip6_ethernet_header
Definition: stn.c:32
foreach_stn_ip_punt_error
#define foreach_stn_ip_punt_error
Definition: stn.c:169
clib_bihash_kv_16_8_t::value
u64 value
Definition: bihash_16_8.h:43
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
format_stn_ip46_punt_trace
static_always_inline u8 * format_stn_ip46_punt_trace(u8 *s, va_list *args, u8 is_ipv4)
Definition: stn.c:58
frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: nat44_ei.c:3048
stn_main
stn_main_t stn_main
Definition: stn.c:24
show_stn_rules_command
static vlib_cli_command_t show_stn_rules_command
(constructor) VLIB_CLI_COMMAND (show_stn_rules_command)
Definition: stn.c:391
vlib_node_add_next
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1177
stn_ip4_punt
static vlib_node_registration_t stn_ip4_punt
INDENT-OFF
Definition: stn.c:25
stn_main_t::rules
stn_rule_t * rules
Definition: stn.h:32
punt_reg_t_
A registration, by a client, to direct punted traffic to a given node.
Definition: punt.h:96
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
vlib_get_buffer
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:111
ip4_sw_interface_enable_disable
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
Definition: ip4_forward.c:602
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
ip46_address_set_ip4
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)
Definition: ip46_address.h:67
stn_rule_command
static vlib_cli_command_t stn_rule_command
(constructor) VLIB_CLI_COMMAND (stn_rule_command)
Definition: stn.c:454
ethernet_header_t::dst_address
u8 dst_address[6]
Definition: packet.h:55
ethernet_header_t::src_address
u8 src_address[6]
Definition: packet.h:56
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
stn_rule_t
Definition: stn.h:24
ip46_address_is_ip4
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
Definition: ip46_address.h:55
punt_l4_t_::af
ip_address_family_t af
Definition: punt.h:73
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
STN_IP_PUNT_DROP
@ STN_IP_PUNT_DROP
Definition: stn.c:83
vlib_cli_command_t::path
char * path
Definition: cli.h:96
stn_ip4_ethernet_header
static ethernet_header_t stn_ip4_ethernet_header
Definition: stn.c:31
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
ethernet_header_t::type
u16 type
Definition: packet.h:59
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
node_index
node node_index
Definition: interface_output.c:440
stn_rule_add_del
int stn_rule_add_del(stn_rule_add_del_args_t *args)
Add or delete an stn rule.
Definition: stn.c:285
unformat_input_t
struct _unformat_input_t unformat_input_t
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
vlib_frame_t
Definition: node.h:372
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
stn_hw_addr_local
static u8 stn_hw_addr_local[6]
Definition: stn.c:28
ip4_header_t
Definition: ip4_packet.h:87
stn_rule_add_del_args_t::del
u8 del
Whether to delete the rule.
Definition: stn.h:52
error
Definition: cJSON.c:88
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
stn_rule_add_del_args_t::address
ip46_address_t address
Destination address of intercepted packets.
Definition: stn.h:48
stn_rule_add_del_args_t::sw_if_index
u32 sw_if_index
TX interface to send packets to.
Definition: stn.h:50
stn.h
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
stn_ip4_punt_fn
static uword stn_ip4_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: stn.c:227
vlib_buffer_advance
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:276
packet.h
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
vlib_node_t::index
u32 index
Definition: node.h:269
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:441
stn_api_init
clib_error_t * stn_api_init(vlib_main_t *vm, stn_main_t *sm)
Definition: stn_api.c:96
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
format.h
stn_ip_punt_next_t
stn_ip_punt_next_t
Definition: stn.c:81
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
vnet_feature_next
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:322
vlib_frame_vector_args
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
stn_ip_punt_error_strings
static char * stn_ip_punt_error_strings[]
Definition: stn.c:179
static_always_inline
#define static_always_inline
Definition: clib.h:112
format_stn_ip4_punt_trace
u8 * format_stn_ip4_punt_trace(u8 *s, va_list *args)
INDENT-ON
Definition: stn.c:221
uword
u64 uword
Definition: types.h:112
ethernet_header_t
Definition: packet.h:52
unformat_ip46_address
unformat_function_t unformat_ip46_address
Definition: format.h:63
ip6_header_t::dst_address
ip6_address_t dst_address
Definition: ip6_packet.h:310
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
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
stn_ip6_punt_fn
static uword stn_ip6_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: stn.c:192
punt_reg_t_::punt
punt_union_t punt
Definition: punt.h:99
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
ip4_header_t::dst_address
ip4_address_t dst_address
Definition: ip4_packet.h:125
stn_rule_add_del_args_t
Definition: stn.h:46
STN_IP_PUNT_N_NEXT
@ STN_IP_PUNT_N_NEXT
Definition: stn.c:84
stn_ip46_punt_fn
static_always_inline uword stn_ip46_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_ipv4)
Definition: stn.c:88
plugin.h
vnet_main_t
Definition: vnet.h:76
vlib_get_next_node
static vlib_node_t * vlib_get_next_node(vlib_main_t *vm, u32 node_index, u32 next_index)
Get vlib node by graph arc (next) index.
Definition: node_funcs.h:99
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vnet_tx_node_index_for_sw_interface
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: rewrite.c:89
vlib_validate_buffer_enqueue_x1
#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:224
punt.h
Definitions for punt infrastructure.
show_stn_rules_fn
static clib_error_t * show_stn_rules_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: stn.c:375
vnet_punt_add_del
clib_error_t * vnet_punt_add_del(vlib_main_t *vm, const punt_reg_t *pr, bool is_add)
Definition: punt.c:435
stn_rule_fn
static clib_error_t * stn_rule_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: stn.c:399
clib_bihash_kv_16_8_t
Definition: bihash_16_8.h:40
stn_main_t::n_rules
u32 n_rules
Definition: stn.h:35
STN_IP_PUNT_N_ERROR
@ STN_IP_PUNT_N_ERROR
Definition: stn.c:176
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
format_get_indent
static u32 format_get_indent(u8 *s)
Definition: format.h:72
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
format_ip46_address
format_function_t format_ip46_address
Definition: ip46_address.h:50
clib_bihash_kv_16_8_t::key
u64 key[2]
Definition: bihash_16_8.h:42
punt_l4_t_::protocol
ip_protocol_t protocol
Definition: punt.h:74
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
ila_error_t
ila_error_t
Definition: stn.c:172
ip6_sw_interface_enable_disable
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
Definition: ip6_forward.c:240
format_stn_ip6_punt_trace
u8 * format_stn_ip6_punt_trace(u8 *s, va_list *args)
Definition: stn.c:186
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
stn_main_t::rule_by_address_table
clib_bihash_16_8_t rule_by_address_table
Definition: stn.h:38
ip6_header_t
Definition: ip6_packet.h:294
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
vlib_main_t
Definition: main.h:102
vlib_node_t
Definition: node.h:247
vlib_add_trace
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
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
VLIB_PLUGIN_REGISTER
VLIB_PLUGIN_REGISTER()
stn_main_t
Definition: stn.h:30
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
stn_ip6_punt
static vlib_node_registration_t stn_ip6_punt
INDENT-OFF
Definition: stn.c:26
stn_ip46_punt_trace_t
Definition: stn.c:34
punt_union_t_::l4
punt_l4_t l4
Definition: punt.h:92
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
stn_init
clib_error_t * stn_init(vlib_main_t *vm)
INDENT-ON
Definition: stn.c:256
vlib_node_runtime_t
Definition: node.h:454
stn_hw_addr_dst
static u8 stn_hw_addr_dst[6]
Definition: stn.c:29
vlib_cli_command_t
Definition: cli.h:92
from
from
Definition: nat44_ei_hairpinning.c:415
format_stn_rule
static u8 * format_stn_rule(u8 *s, va_list *args)
Definition: stn.c:39
vlib_get_next_frame
#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:395
VLIB_TX
@ VLIB_TX
Definition: defs.h:47
n_left_from
n_left_from
Definition: nat44_ei_hairpinning.c:416
VNET_FEATURE_INIT
VNET_FEATURE_INIT(stn_ip6_punt_feat_node, static)
vlib_node_t::name
u8 * name
Definition: node.h:253
format_white_space
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169