FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
lisp_gpe.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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  * @file
17  * @brief Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
18  *
19  */
20 
21 #include <lisp/lisp-gpe/lisp_gpe.h>
25 #include <vnet/fib/fib_path_list.h>
26 #include <vnet/fib/fib_table.h>
27 #include <vnet/fib/fib_internal.h>
28 
29 /** LISP-GPE global state */
31 
32 
33 /** CLI command to add/del forwarding entry. */
34 static clib_error_t *
36  unformat_input_t * input,
37  vlib_cli_command_t * cmd)
38 {
39  unformat_input_t _line_input, *line_input = &_line_input;
40  u8 is_add = 1;
41  ip_address_t lloc, rloc;
42  clib_error_t *error = 0;
43  gid_address_t _reid, *reid = &_reid, _leid, *leid = &_leid;
44  u8 reid_set = 0, leid_set = 0, is_negative = 0, dp_table_set = 0,
45  vni_set = 0;
46  u32 vni = 0, dp_table = 0, action = ~0, w;
47  locator_pair_t pair, *pairs = 0;
48  int rv;
49 
50  clib_memset (leid, 0, sizeof (*leid));
51  clib_memset (reid, 0, sizeof (*reid));
52 
53  /* Get a line of input. */
54  if (!unformat_user (input, unformat_line_input, line_input))
55  return 0;
56 
57  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
58  {
59  if (unformat (line_input, "del"))
60  is_add = 0;
61  else if (unformat (line_input, "add"))
62  is_add = 1;
63  else if (unformat (line_input, "leid %U", unformat_gid_address, leid))
64  {
65  leid_set = 1;
66  }
67  else if (unformat (line_input, "reid %U", unformat_gid_address, reid))
68  {
69  reid_set = 1;
70  }
71  else if (unformat (line_input, "vni %u", &vni))
72  {
75  vni_set = 1;
76  }
77  else if (unformat (line_input, "vrf %u", &dp_table))
78  {
79  dp_table_set = 1;
80  }
81  else if (unformat (line_input, "bd %u", &dp_table))
82  {
83  dp_table_set = 1;
84  }
85  else if (unformat (line_input, "negative action %U",
87  {
88  is_negative = 1;
89  }
90  else if (unformat (line_input, "loc-pair %U %U w %d",
91  unformat_ip_address, &lloc,
92  unformat_ip_address, &rloc, &w))
93  {
94  ip_address_copy (&pair.lcl_loc, &lloc);
95  ip_address_copy (&pair.rmt_loc, &rloc);
96  pair.weight = w;
97  pair.priority = 0;
98  vec_add1 (pairs, pair);
99  }
100  else
101  {
102  error = unformat_parse_error (line_input);
103  vlib_cli_output (vm, "parse error: '%U'",
104  format_unformat_error, line_input);
105  goto done;
106  }
107  }
108 
109  if (!reid_set)
110  {
111  vlib_cli_output (vm, "remote eid must be set!");
112  goto done;
113  }
114 
115  if (gid_address_type (reid) != GID_ADDR_NSH && (!vni_set || !dp_table_set))
116  {
117  vlib_cli_output (vm, "vni and vrf/bd must be set!");
118  goto done;
119  }
120 
121  if (is_negative)
122  {
123  if (~0 == action)
124  {
125  vlib_cli_output (vm, "no action set for negative tunnel!");
126  goto done;
127  }
128  }
129  else
130  {
131  if (vec_len (pairs) == 0)
132  {
133  vlib_cli_output (vm, "expected ip4/ip6 locators");
134  goto done;
135  }
136  }
137 
138  if (!leid_set)
139  {
140  /* if leid not set, make sure it's the same AFI like reid */
144  }
145 
146  /* add fwd entry */
148  clib_memset (a, 0, sizeof (a[0]));
149 
150  a->is_add = is_add;
151  a->is_negative = is_negative;
152  a->vni = vni;
153  a->table_id = dp_table;
154  gid_address_copy (&a->lcl_eid, leid);
155  gid_address_copy (&a->rmt_eid, reid);
156  a->locator_pairs = pairs;
157  a->action = action;
158 
160  if (0 != rv)
161  {
162  vlib_cli_output (vm, "failed to %s gpe tunnel!",
163  is_add ? "add" : "delete");
164  }
165 
166 done:
167  unformat_free (line_input);
168  vec_free (pairs);
169  return error;
170 }
171 
172 /* *INDENT-OFF* */
174  .path = "gpe entry",
175  .short_help = "gpe entry add/del vni <vni> vrf/bd <id> [leid <leid>]"
176  "reid <reid> [loc-pair <lloc> <rloc> w <weight>] "
177  "[negative action <action>]",
179 };
180 /* *INDENT-ON* */
181 
182 /** Check if LISP-GPE is enabled. */
183 u8
185 {
187 
188  return lgm->is_en;
189 }
190 
191 /** Enable/disable LISP-GPE. */
192 clib_error_t *
194 {
197 
198  if (a->is_en)
199  {
200  lgm->is_en = 1;
201  udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe,
202  lisp_gpe_ip4_input_node.index, 1 /* is_ip4 */ );
203  udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe6,
204  lisp_gpe_ip6_input_node.index, 0 /* is_ip4 */ );
205  }
206  else
207  {
208  /* remove all entries */
210 
211  /* disable all l3 ifaces */
213 
214  udp_unregister_dst_port (vm, UDP_DST_PORT_lisp_gpe, 0 /* is_ip4 */ );
215  udp_unregister_dst_port (vm, UDP_DST_PORT_lisp_gpe6, 1 /* is_ip4 */ );
216  lgm->is_en = 0;
217  }
218 
219  return 0;
220 }
221 
222 /** Set GPE encapsulation mode. */
223 int
225 {
227 
228  if (mode >= GPE_ENCAP_COUNT)
229  return VNET_API_ERROR_INVALID_GPE_MODE;
230 
231  if (pool_elts (lgm->lisp_fwd_entry_pool) != 0)
232  return VNET_API_ERROR_LISP_GPE_ENTRIES_PRESENT;
233 
234  lgm->encap_mode = mode;
235  return 0;
236 }
237 
238 /** CLI command to set GPE encap */
239 static clib_error_t *
241  unformat_input_t * input,
242  vlib_cli_command_t * cmd)
243 {
244  unformat_input_t _line_input, *line_input = &_line_input;
247 
248  /* Get a line of input. */
249  if (!unformat_user (input, unformat_line_input, line_input))
250  return 0;
251 
252  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
253  {
254  if (unformat (line_input, "lisp"))
256  else if (unformat (line_input, "vxlan"))
258  else
259  {
260  return clib_error_return (0, "parse error: '%U'",
261  format_unformat_error, line_input);
262  }
263  }
265  if (rv)
266  {
267  return clib_error_return (0,
268  "Error: invalid mode or GPE entries are present!");
269  }
270 
271  return 0;
272 }
273 
274 /* *INDENT-OFF* */
276  .path = "gpe encap",
277  .short_help = "gpe encap [lisp|vxlan]",
278  .function = gpe_set_encap_mode_command_fn,
279 };
280 /* *INDENT-ON* */
281 
282 /** Format GPE encap mode. */
283 u8 *
284 format_vnet_gpe_encap_mode (u8 * s, va_list * args)
285 {
287 
288  switch (lgm->encap_mode)
289  {
290  case GPE_ENCAP_LISP:
291  return format (s, "lisp");
292  case GPE_ENCAP_VXLAN:
293  return format (s, "vxlan");
294  default:
295  return 0;
296  }
297  return 0;
298 }
299 
300 /** CLI command to show GPE encap */
301 static clib_error_t *
303  unformat_input_t * input,
304  vlib_cli_command_t * cmd)
305 {
306  vlib_cli_output (vm, "encap mode: %U", format_vnet_gpe_encap_mode);
307  return 0;
308 }
309 
310 /* *INDENT-OFF* */
312  .path = "show gpe encap",
313  .short_help = "show GPE encapulation mode",
314  .function = gpe_show_encap_mode_command_fn,
315 };
316 /* *INDENT-ON* */
317 
318 /** CLI command to enable/disable LISP-GPE. */
319 static clib_error_t *
321  unformat_input_t * input,
322  vlib_cli_command_t * cmd)
323 {
324  unformat_input_t _line_input, *line_input = &_line_input;
325  u8 is_en = 1;
327  clib_error_t *error = NULL;
328 
329  /* Get a line of input. */
330  if (!unformat_user (input, unformat_line_input, line_input))
331  return clib_error_return (0, "expected enable | disable");
332 
333  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
334  {
335  if (unformat (line_input, "enable"))
336  is_en = 1;
337  else if (unformat (line_input, "disable"))
338  is_en = 0;
339  else
340  {
341  error = clib_error_return (0, "parse error: '%U'",
342  format_unformat_error, line_input);
343  goto done;
344  }
345  }
346  a->is_en = is_en;
348 
349 done:
350  unformat_free (line_input);
351 
352  return error;
353 }
354 
355 /* *INDENT-OFF* */
357  .path = "gpe",
358  .short_help = "gpe [enable|disable]",
360 };
361 /* *INDENT-ON* */
362 
363 /** CLI command to show LISP-GPE interfaces. */
364 static clib_error_t *
366  unformat_input_t * input,
367  vlib_cli_command_t * cmd)
368 {
370  hash_pair_t *p;
371 
372  vlib_cli_output (vm, "%=10s%=12s", "vrf", "hw_if_index");
373 
374  /* *INDENT-OFF* */
376  vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]);
377  }));
378  /* *INDENT-ON* */
379 
380  if (0 != lgm->l2_ifaces.hw_if_index_by_dp_table)
381  {
382  vlib_cli_output (vm, "%=10s%=12s", "bd_id", "hw_if_index");
383  /* *INDENT-OFF* */
385  vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]);
386  }));
387  /* *INDENT-ON* */
388  }
389  return 0;
390 }
391 
392 /* *INDENT-OFF* */
394  .path = "show gpe interface",
395  .short_help = "show gpe interface",
396  .function = lisp_show_iface_command_fn,
397 };
398 /* *INDENT-ON* */
399 
400 /** CLI command to show GPE fwd native route path. */
401 static clib_error_t *
403  unformat_input_t * input,
404  vlib_cli_command_t * cmd)
405 {
407  fib_route_path_t *rpath;
408 
409  if (vec_len (lgm->native_fwd_rpath[AF_IP4]))
410  {
411  vec_foreach (rpath, lgm->native_fwd_rpath[AF_IP4])
412  {
413  vlib_cli_output (vm, "nh: %U fib_index %u sw_if_index %u",
414  format_ip46_address, &rpath->frp_addr,
416  rpath->frp_sw_if_index);
417  }
418  }
419  if (vec_len (lgm->native_fwd_rpath[AF_IP6]))
420  {
421  vec_foreach (rpath, lgm->native_fwd_rpath[AF_IP6])
422  {
423  vlib_cli_output (vm, "nh: %U fib_index %u sw_if_index %u",
425  rpath->frp_fib_index, rpath->frp_sw_if_index);
426  }
427  }
428  return 0;
429 }
430 
431 /* *INDENT-OFF* */
433  .path = "show gpe native-forward",
434  .short_help = "show gpe native-forward",
436 };
437 /* *INDENT-ON* */
438 
439 void
441 {
444  fib_prefix_t fib_prefix;
445  u32 *lfei;
446 
447  vec_foreach (lfei, lgm->native_fwd_lfes[ip_version])
448  {
449  lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, lfei[0]);
450  ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &fib_prefix);
453  lgm->native_fwd_rpath[ip_version]);
454  }
455 }
456 
457 int
459 {
461  fib_route_path_t *rpath;
462  u8 ip_version;
463 
464  ip_version = a->rpath.frp_proto == DPO_PROTO_IP4 ? AF_IP4 : AF_IP6;
465 
466  if (a->is_add)
467  {
468  vec_add1 (lgm->native_fwd_rpath[ip_version], a->rpath);
469  }
470  else
471  {
472  vec_foreach (rpath, lgm->native_fwd_rpath[ip_version])
473  {
474  if (!fib_route_path_cmp (rpath, &a->rpath))
475  {
476  vec_del1 (lgm->native_fwd_rpath[ip_version],
477  rpath - lgm->native_fwd_rpath[ip_version]);
478  break;
479  }
480  }
481  }
482  gpe_update_native_fwd_path (ip_version);
483  return 0;
484 }
485 
486 /**
487  * CLI command to add action for native forward.
488  */
489 static clib_error_t *
491  vlib_cli_command_t * cmd)
492 {
493  vnet_main_t *vnm = vnet_get_main ();
494  unformat_input_t _line_input, *line_input = &_line_input;
496  fib_route_path_t rpath;
497  u32 table_id = ~0;
499  u8 is_add = 1;
500  clib_error_t *error = 0;
501 
502  /* Get a line of input. */
503  if (!unformat_user (input, unformat_line_input, line_input))
504  return 0;
505 
506  clib_memset (&rpath, 0, sizeof (rpath));
507 
508  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
509  {
510  if (unformat (line_input, "table %d", &table_id))
511  ;
512  else if (unformat (line_input, "del"))
513  is_add = 0;
514  else if (unformat (line_input, "via %U %U",
516  &rpath.frp_addr.ip4,
518  &rpath.frp_sw_if_index))
519  {
520  rpath.frp_weight = 1;
521  rpath.frp_proto = DPO_PROTO_IP4;
522  }
523  else if (unformat (line_input, "via %U %U",
525  &rpath.frp_addr.ip6,
527  &rpath.frp_sw_if_index))
528  {
529  rpath.frp_weight = 1;
530  rpath.frp_proto = DPO_PROTO_IP6;
531  }
532  else if (unformat (line_input, "via %U",
533  unformat_ip4_address, &rpath.frp_addr.ip4))
534  {
535  rpath.frp_weight = 1;
536  rpath.frp_sw_if_index = ~0;
537  rpath.frp_proto = DPO_PROTO_IP4;
538  }
539  else if (unformat (line_input, "via %U",
540  unformat_ip6_address, &rpath.frp_addr.ip6))
541  {
542  rpath.frp_weight = 1;
543  rpath.frp_sw_if_index = ~0;
544  rpath.frp_proto = DPO_PROTO_IP6;
545  }
546  else
547  {
548  return clib_error_return (0, "parse error: '%U'",
549  format_unformat_error, line_input);
550  }
551  }
552 
553  if ((u32) ~ 0 == table_id)
554  {
555  rpath.frp_fib_index = 0;
556  }
557  else
558  {
559  rpath.frp_fib_index =
561  if ((u32) ~ 0 == rpath.frp_fib_index)
562  {
563  error = clib_error_return (0, "Nonexistent table id %d", table_id);
564  goto done;
565  }
566  }
567 
568  a->rpath = rpath;
569  a->is_add = is_add;
570 
572  if (rv)
573  {
574  return clib_error_return (0, "Error: couldn't add path!");
575  }
576 
577 done:
578  return error;
579 }
580 
581 /* *INDENT-OFF* */
583  .path = "gpe native-forward",
584  .short_help = "gpe native-forward [del] via <nh-ip-addr> [iface] "
585  "[table <table>]",
586  .function = gpe_native_forward_command_fn,
587 };
588 /* *INDENT-ON* */
589 
590 /** Format LISP-GPE status. */
591 u8 *
592 format_vnet_lisp_gpe_status (u8 * s, va_list * args)
593 {
595  return format (s, "%s", lgm->is_en ? "enabled" : "disabled");
596 }
597 
598 /** LISP-GPE init function. */
599 clib_error_t *
601 {
603  clib_error_t *error = 0;
604 
606  return error;
607 
609  return error;
610 
611  lgm->vnet_main = vnet_get_main ();
612  lgm->vlib_main = vm;
613  lgm->im4 = &ip4_main;
614  lgm->im6 = &ip6_main;
615  lgm->lm4 = &ip4_main.lookup_main;
616  lgm->lm6 = &ip6_main.lookup_main;
617  lgm->encap_mode = GPE_ENCAP_LISP;
618 
619  lgm->lisp_gpe_fwd_entries =
620  hash_create_mem (0, sizeof (lisp_gpe_fwd_entry_key_t), sizeof (uword));
621 
623  hash_create_mem (0, sizeof (lisp_stats_key_t), sizeof (uword));
624  clib_memset (&lgm->counters, 0, sizeof (lgm->counters));
625  lgm->counters.name = "LISP counters";
626 
627  return 0;
628 }
629 
632 {
634  return lgm->encap_mode;
635 }
636 
637 static clib_error_t *
639 {
640  vlib_frame_t *f;
641  vlib_buffer_t *b;
643  pcap_main_t pm;
644  clib_error_t *error = 0;
645 
646  if (!file_name)
647  return clib_error_create ("no pcap file specified!");
648 
649  clib_memset (&pm, 0, sizeof (pm));
650  pm.file_name = (char *) file_name;
651  error = pcap_read (&pm);
652  if (error)
653  return error;
654 
655  u32 bi;
656  if (vlib_buffer_alloc (lgm->vlib_main, &bi, 1) != 1)
657  return clib_error_create ("cannot allocate memory!");
658 
659  b = vlib_get_buffer (lgm->vlib_main, bi);
660  tunnel_lookup_t *nsh_ifaces = &lgm->nsh_ifaces;
661  uword *hip;
663 
664  hip = hash_get (nsh_ifaces->hw_if_index_by_dp_table, 0);
665  if (hip == 0)
666  return clib_error_create ("The NSH 0 interface doesn't exist");
667 
668  hi = vnet_get_hw_interface (lgm->vnet_main, hip[0]);
669 
670  vnet_buffer (b)->sw_if_index[VLIB_TX] = hi->sw_if_index;
674 
675  vlib_node_t *n =
676  vlib_get_node_by_name (lgm->vlib_main, (u8 *) "interface-output-arc-end");
678  u32 *to_next = vlib_frame_vector_args (f);
679  to_next[0] = bi;
680  f->n_vectors = 1;
682 
683  return error;
684 }
685 
686 static clib_error_t *
688  vlib_cli_command_t * cmd)
689 {
690  clib_error_t *error = 0;
691  u8 *file_name = 0;
692 
694  {
695  if (unformat (input, "pcap %v", &file_name))
696  {
697  error = lisp_gpe_test_send_nsh_packet (file_name);
698  goto done;
699  }
700  else
701  {
702  error = clib_error_create ("unknown input `%U'",
703  format_unformat_error, input);
704  goto done;
705  }
706  }
707 
708 done:
709  return error;
710 }
711 
712 /* *INDENT-OFF* */
714  .path = "test one nsh",
715  .short_help = "test gpe nsh pcap <path-to-pcap-file>",
716  .function = lisp_test_nsh_command_fn,
717 };
718 /* *INDENT-ON* */
719 
721 
722 /*
723  * fd.io coding-style-patch-verification: ON
724  *
725  * Local Variables:
726  * eval: (c-set-style "gnu")
727  * End:
728  */
ip_address
Definition: ip_types.h:79
vlib_frame_t::n_vectors
u16 n_vectors
Definition: node.h:387
fib_route_path_t_::frp_fib_index
u32 frp_fib_index
The FIB index to lookup the nexthop Only valid for recursive paths.
Definition: fib_types.h:556
lisp_stats_key_t
Definition: lisp_gpe.h:94
fib_route_path_cmp
int fib_route_path_cmp(const fib_route_path_t *rpath1, const fib_route_path_t *rpath2)
Definition: fib_types.c:320
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
vlib_buffer_put_uninit
static void * vlib_buffer_put_uninit(vlib_buffer_t *b, u16 size)
Append uninitialized data to buffer.
Definition: buffer.h:349
pcap_read
__clib_export clib_error_t * pcap_read(pcap_main_t *pm)
Read PCAP file.
Definition: pcap.c:176
vnet_lisp_gpe_enable_disable
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
Enable/disable LISP-GPE.
Definition: lisp_gpe.c:193
gpe_set_encap_mode_command_fn
static clib_error_t * gpe_set_encap_mode_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to set GPE encap.
Definition: lisp_gpe.c:240
leid
vl_api_eid_t leid
Definition: lisp.api:497
gpe_show_native_fwd_rpath_command
vlib_cli_command_t gpe_show_native_fwd_rpath_command
(constructor) VLIB_CLI_COMMAND (gpe_show_native_fwd_rpath_command)
Definition: lisp_gpe.c:432
ip4_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip4.h:109
lisp_gpe_fwd_entry_key_t_
LISP-GPE fwd entry key.
Definition: lisp_gpe_fwd_entry.h:63
gpe_native_forward_command_fn
static clib_error_t * gpe_native_forward_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to add action for native forward.
Definition: lisp_gpe.c:490
fib_route_path_t_::frp_weight
u8 frp_weight
[un]equal cost path weight
Definition: fib_types.h:599
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1104
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
f
vlib_frame_t * f
Definition: interface_output.c:1098
gid_address_ip_version
#define gid_address_ip_version(_a)
Definition: lisp_types.h:207
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
hash_foreach_pair
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
Definition: hash.h:373
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
vlib_buffer_pull
static void * vlib_buffer_pull(vlib_buffer_t *b, u8 size)
Retrieve bytes from buffer head.
Definition: buffer.h:428
lisp_gpe_enable_disable_command_fn
static clib_error_t * lisp_gpe_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to enable/disable LISP-GPE.
Definition: lisp_gpe.c:320
gpe_update_native_fwd_path
void gpe_update_native_fwd_path(u8 ip_version)
Definition: lisp_gpe.c:440
lisp_gpe_main::encap_mode
gpe_encap_mode_t encap_mode
Definition: lisp_gpe.h:161
vni
u32 vni
Definition: flow_types.api:160
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
lisp_test_nsh_command
static vlib_cli_command_t lisp_test_nsh_command
(constructor) VLIB_CLI_COMMAND (lisp_test_nsh_command)
Definition: lisp_gpe.c:713
IP46_TYPE_IP4
@ IP46_TYPE_IP4
Definition: ip46_address.h:26
vlib_cli_command_t::path
char * path
Definition: cli.h:96
gpe_encap_mode_t
enum gpe_encap_mode_e gpe_encap_mode_t
fib_table.h
fib_route_path_t_::frp_addr
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:516
gpe_set_encap_mode_command
static vlib_cli_command_t gpe_set_encap_mode_command
(constructor) VLIB_CLI_COMMAND (gpe_set_encap_mode_command)
Definition: lisp_gpe.c:275
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
vlib_call_init_function
#define vlib_call_init_function(vm, x)
Definition: init.h:259
unformat_parse_error
#define unformat_parse_error(input)
Definition: format.h:261
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
fib_route_path_t_::frp_sw_if_index
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:545
vlib_combined_counter_main_t::name
char * name
The counter collection's name.
Definition: counter.h:206
GPE_ENCAP_VXLAN
@ GPE_ENCAP_VXLAN
Definition: lisp_gpe.h:114
enable_disable_lisp_gpe_command
static vlib_cli_command_t enable_disable_lisp_gpe_command
(constructor) VLIB_CLI_COMMAND (enable_disable_lisp_gpe_command)
Definition: lisp_gpe.c:356
GID_ADDR_IP_PREFIX
@ GID_ADDR_IP_PREFIX
Definition: lisp_types.h:39
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
unformat_input_t
struct _unformat_input_t unformat_input_t
lisp_gpe_main::lisp_fwd_entry_pool
struct lisp_gpe_fwd_entry_t_ * lisp_fwd_entry_pool
A Pool of all LISP forwarding entries.
Definition: lisp_gpe.h:130
pcap_main_t
PCAP main state data structure.
Definition: pcap.h:155
fib_route_path_t_::frp_proto
dpo_proto_t frp_proto
The protocol of the address below.
Definition: fib_types.h:505
lisp_gpe_main::im4
ip4_main_t * im4
Definition: lisp_gpe.h:174
vlib_frame_t
Definition: node.h:372
vlib_get_frame_to_node
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
Definition: main.c:184
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
error
Definition: cJSON.c:88
lisp_gpe_fwd_entry_key_t_::rmt
dp_address_t rmt
Definition: lisp_gpe_fwd_entry.h:65
lisp_gpe_main::nsh_ifaces
tunnel_lookup_t nsh_ifaces
Definition: lisp_gpe.h:157
lisp_gpe.h
LISP-GPE definitions.
gpe_show_encap_mode_command
static vlib_cli_command_t gpe_show_encap_mode_command
(constructor) VLIB_CLI_COMMAND (gpe_show_encap_mode_command)
Definition: lisp_gpe.c:311
lisp_gpe_tenant_flush
void lisp_gpe_tenant_flush(void)
Flush/delete ALL the tenants.
Definition: lisp_gpe_tenant.c:261
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
vnet_lisp_gpe_get_main
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
Definition: lisp_gpe.h:184
vlib_put_frame_to_node
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
Definition: main.c:218
unformat_ip_address
uword unformat_ip_address(unformat_input_t *input, va_list *args)
Definition: ip_types.c:41
lisp_gpe_main::lm4
ip_lookup_main_t * lm4
Definition: lisp_gpe.h:176
lisp_gpe_main::l3_ifaces
tunnel_lookup_t l3_ifaces
Definition: lisp_gpe.h:139
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
clib_error_create
#define clib_error_create(args...)
Definition: error.h:96
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
vlib_node_t::index
u32 index
Definition: node.h:269
lisp_gpe_main::lm6
ip_lookup_main_t * lm6
Definition: lisp_gpe.h:177
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
vlib_buffer_alloc
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
Definition: buffer_funcs.h:702
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:441
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
tunnel_lookup
Definition: lisp_gpe.h:82
hash_get
#define hash_get(h, key)
Definition: hash.h:249
locator_pair::rmt_loc
ip_address_t rmt_loc
Definition: lisp_types.h:330
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
FIB_ENTRY_FLAG_NONE
@ FIB_ENTRY_FLAG_NONE
Definition: fib_entry.h:112
gid_address_vni
#define gid_address_vni(_a)
Definition: lisp_types.h:213
lisp_gpe_init
clib_error_t * lisp_gpe_init(vlib_main_t *vm)
LISP-GPE init function.
Definition: lisp_gpe.c:600
lisp_show_iface_command_fn
static clib_error_t * lisp_show_iface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show LISP-GPE interfaces.
Definition: lisp_gpe.c:365
ip4_lookup_init
static clib_error_t * ip4_lookup_init(vlib_main_t *vm)
Definition: ip4_forward.c:1108
uword
u64 uword
Definition: types.h:112
locator_pair::weight
u8 weight
Definition: lisp_types.h:333
ethernet_header_t
Definition: packet.h:52
locator_pair::lcl_loc
ip_address_t lcl_loc
Definition: lisp_types.h:329
lisp_gpe_tenant.h
udp_register_dst_port
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
Definition: udp_local.c:431
lisp_gpe_main
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.c:30
dp_table
u32 dp_table
Definition: lisp_gpe.api:116
lisp_gpe_main::native_fwd_rpath
fib_route_path_t * native_fwd_rpath[2]
Native fwd data structures.
Definition: lisp_gpe.h:168
format_vnet_gpe_encap_mode
u8 * format_vnet_gpe_encap_mode(u8 *s, va_list *args)
Format GPE encap mode.
Definition: lisp_gpe.c:284
udp_unregister_dst_port
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
Definition: udp_local.c:469
lisp_gpe_test_send_nsh_packet
static clib_error_t * lisp_gpe_test_send_nsh_packet(u8 *file_name)
Definition: lisp_gpe.c:638
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
vnet_lisp_gpe_add_del_fwd_entry_args_t
Definition: lisp_gpe.h:228
vnet_gpe_set_encap_mode
int vnet_gpe_set_encap_mode(gpe_encap_mode_t mode)
Set GPE encapsulation mode.
Definition: lisp_gpe.c:224
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
vnet_gpe_native_fwd_rpath_args_t
Definition: lisp_gpe.h:278
lisp_gpe_fwd_entry_t_::key
lisp_gpe_fwd_entry_key_t * key
The Entry's key: {lEID,rEID,vni}.
Definition: lisp_gpe_fwd_entry.h:91
lisp_gpe_main::lisp_stats_index_by_key
uword * lisp_stats_index_by_key
Definition: lisp_gpe.h:164
IP46_TYPE_IP6
@ IP46_TYPE_IP6
Definition: ip46_address.h:27
lisp_gpe_main::is_en
u8 is_en
Definition: lisp_gpe.h:135
ip_main_init
clib_error_t * ip_main_init(vlib_main_t *vm)
Definition: ip_init.c:45
pcap_main_t::packets_read
u8 ** packets_read
Packets read from file.
Definition: pcap.h:186
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
unformat_gid_address
uword unformat_gid_address(unformat_input_t *input, va_list *args)
Definition: lisp_types.c:272
locator_pair
Definition: lisp_types.h:326
lisp_gpe_add_del_fwd_entry_command_fn
static clib_error_t * lisp_gpe_add_del_fwd_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to add/del forwarding entry.
Definition: lisp_gpe.c:35
lisp_gpe_main::native_fwd_lfes
u32 * native_fwd_lfes[2]
Definition: lisp_gpe.h:169
gpe_native_forward_command
vlib_cli_command_t gpe_native_forward_command
(constructor) VLIB_CLI_COMMAND (gpe_native_forward_command)
Definition: lisp_gpe.c:582
vnet_lisp_gpe_enable_disable_status
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
Definition: lisp_gpe.c:184
vnet_lisp_gpe_add_del_fwd_entry
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
Forwarding entry create/remove dispatcher.
Definition: lisp_gpe_fwd_entry.c:1248
ip6_main
ip6_main_t ip6_main
Definition: ip6_forward.c:2785
reid
vl_api_eid_t reid
Definition: lisp_gpe.api:118
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
GID_ADDR_NSH
@ GID_ADDR_NSH
Definition: lisp_types.h:43
vlib_get_node_by_name
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
fib_path_list.h
gid_address_copy
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
Definition: lisp_types.c:1203
lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.h:119
dpo_proto_to_fib
fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto)
Definition: fib_types.c:359
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
gpe_show_native_fwd_rpath_command_fn
static clib_error_t * gpe_show_native_fwd_rpath_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show GPE fwd native route path.
Definition: lisp_gpe.c:402
vnet_lisp_gpe_enable_disable_args_t
Definition: lisp_gpe.h:211
format_ip46_address
format_function_t format_ip46_address
Definition: ip46_address.h:50
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
table_id
u32 table_id
Definition: wireguard.api:102
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
format_vnet_lisp_gpe_status
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
Format LISP-GPE status.
Definition: lisp_gpe.c:592
fid_address_t::ippref
ip_prefix_t ippref
Definition: lisp_types.h:73
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
GPE_ENCAP_COUNT
@ GPE_ENCAP_COUNT
Definition: lisp_gpe.h:115
lisp_gpe_add_del_fwd_entry_command
static vlib_cli_command_t lisp_gpe_add_del_fwd_entry_command
(constructor) VLIB_CLI_COMMAND (lisp_gpe_add_del_fwd_entry_command)
Definition: lisp_gpe.c:173
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
lisp_gpe_fwd_entry_t_
A LISP Forwarding Entry.
Definition: lisp_gpe_fwd_entry.h:75
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
ip6_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip6.h:112
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
lisp_gpe_ip6_input_node
vlib_node_registration_t lisp_gpe_ip6_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip6_input_node)
Definition: decap.c:482
vlib_node_t
Definition: node.h:247
lisp_gpe_main::vlib_main
vlib_main_t * vlib_main
convenience
Definition: lisp_gpe.h:172
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
lisp_gpe_adjacency.h
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
vnet_gpe_get_encap_mode
gpe_encap_mode_t vnet_gpe_get_encap_mode(void)
Definition: lisp_gpe.c:631
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
gid_address_type
#define gid_address_type(_a)
Definition: lisp_types.h:203
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
a
a
Definition: bitmap.h:525
lisp_gpe_ip4_input_node
vlib_node_registration_t lisp_gpe_ip4_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip4_input_node)
Definition: decap.c:460
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
fib_internal.h
vnet_gpe_add_del_native_fwd_rpath
int vnet_gpe_add_del_native_fwd_rpath(vnet_gpe_native_fwd_rpath_args_t *a)
Definition: lisp_gpe.c:458
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
unformat_negative_mapping_action
uword unformat_negative_mapping_action(unformat_input_t *input, va_list *args)
Definition: lisp_types.c:313
locator_pair::priority
u8 priority
Definition: lisp_types.h:332
pcap_main_t::file_name
char * file_name
File name of pcap output.
Definition: pcap.h:161
lisp_gpe_main::im6
ip6_main_t * im6
Definition: lisp_gpe.h:175
gid_address_t
struct _gid_address_t gid_address_t
lisp_gpe_fwd_entry_t_::eid_fib_index
u32 eid_fib_index
The FIB index for the overlay, i.e.
Definition: lisp_gpe_fwd_entry.h:122
unformat_ip6_address
unformat_function_t unformat_ip6_address
Definition: format.h:89
lisp_gpe_fwd_entry.h
LISP-GPE definitions.
rv
int __clib_unused rv
Definition: application.c:491
unformat_ip4_address
unformat_function_t unformat_ip4_address
Definition: format.h:68
FIB_SOURCE_LISP
@ FIB_SOURCE_LISP
LISP.
Definition: fib_source.h:83
lisp_gpe_main::counters
vlib_combined_counter_main_t counters
Definition: lisp_gpe.h:165
lisp_gpe_main::lisp_gpe_fwd_entries
uword * lisp_gpe_fwd_entries
DB of all forwarding entries.
Definition: lisp_gpe.h:125
vlib_cli_command_t
Definition: cli.h:92
lisp_show_iface_command
vlib_cli_command_t lisp_show_iface_command
(constructor) VLIB_CLI_COMMAND (lisp_show_iface_command)
Definition: lisp_gpe.c:393
ip_address_copy
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
Definition: ip_types.c:133
fib_table_find
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1111
action
vl_api_mac_event_action_t action
Definition: l2.api:211
VLIB_TX
@ VLIB_TX
Definition: defs.h:47
lisp_gpe_main::vnet_main
vnet_main_t * vnet_main
Definition: lisp_gpe.h:173
lisp_gpe_main::l2_ifaces
tunnel_lookup_t l2_ifaces
Definition: lisp_gpe.h:147
tunnel_lookup::hw_if_index_by_dp_table
uword * hw_if_index_by_dp_table
Lookup lisp-gpe interfaces by dp table (eg.
Definition: lisp_gpe.h:85
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
lisp_test_nsh_command_fn
static clib_error_t * lisp_test_nsh_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: lisp_gpe.c:687
vnet_lisp_gpe_fwd_entry_flush
void vnet_lisp_gpe_fwd_entry_flush(void)
Flush all the forwrding entries.
Definition: lisp_gpe_fwd_entry.c:1354
vec_del1
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:896
fib_table_entry_update
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
Definition: fib_table.c:770
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
hash_pair_t
Definition: hash.h:159
GPE_ENCAP_LISP
@ GPE_ENCAP_LISP
Definition: lisp_gpe.h:113
vnet_api_error_t
vnet_api_error_t
Definition: api_errno.h:162
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
gpe_show_encap_mode_command_fn
static clib_error_t * gpe_show_encap_mode_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show GPE encap.
Definition: lisp_gpe.c:302
ip_prefix_to_fib_prefix
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix
Definition: ip_types.c:410