FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
lisp_gpe_adjacency.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 adjacencys.
18  *
19  */
20 
21 #include <vnet/dpo/load_balance.h>
22 #include <vnet/lisp-cp/control.h>
27 #include <vnet/fib/fib_entry.h>
28 #include <vnet/adj/adj_midchain.h>
29 #include <vppinfra/bihash_24_8.h>
31 
32 /**
33  * Memory pool of all adjacencies
34  */
36 
37 /**
38  * Hash table of all adjacencies. key:{nh, itf}
39  * We never have an all zeros address since the interfaces are multi-access,
40  * therefore there is no ambiguity between a v4 and v6 next-hop, so we don't
41  * need to add the protocol to the key.
42  */
43 static
44 BVT (clib_bihash)
46 
47 #define LISP_ADJ_SET_KEY(_key, _itf, _nh) \
48 { \
49  _key.key[0] = (_nh)->ip.v6.as_u64[0]; \
50  _key.key[1] = (_nh)->ip.v6.as_u64[1]; \
51  _key.key[2] = (_itf); \
52 }
53 
55 {
56  BVT (clib_bihash_kv) kv;
57 
58  LISP_ADJ_SET_KEY (kv, sw_if_index, addr);
59 
60  if (BV (clib_bihash_search) (&lisp_adj_db, &kv, &kv) < 0)
61  {
62  return (INDEX_INVALID);
63  }
64  else
65  {
66  return (kv.value);
67  }
68 }
69 
70 static void
72 {
73  BVT (clib_bihash_kv) kv;
74 
75  LISP_ADJ_SET_KEY (kv, sw_if_index, addr);
76  kv.value = ai;
77 
78  BV (clib_bihash_add_del) (&lisp_adj_db, &kv, 1);
79 }
80 
81 static void
83 {
84  BVT (clib_bihash_kv) kv;
85 
86  LISP_ADJ_SET_KEY (kv, sw_if_index, addr);
87 
88  BV (clib_bihash_add_del) (&lisp_adj_db, &kv, 0);
89 }
90 
91 static lisp_gpe_adjacency_t *
93 {
94  return (pool_elt_at_index (lisp_adj_pool, lai));
95 }
96 
99 {
100  switch (ip_addr_version (&ladj->remote_rloc))
101  {
102  case AF_IP4:
104  case AF_IP6:
106  default:
107  ASSERT (0);
108  break;
109  }
111 }
112 
113 static void
114 ip46_address_to_ip_address (const ip46_address_t * a, ip_address_t * b)
115 {
116  if (ip46_address_is_ip4 (a))
117  {
118  clib_memset (b, 0, sizeof (*b));
119  ip_address_set (b, &a->ip4, AF_IP4);
120  }
121  else
122  {
123  ip_address_set (b, &a->ip6, AF_IP6);
124  }
125 }
126 
127 /**
128  * @brief Stack the tunnel's midchain on the IP forwarding chain of the via
129  */
130 static void
132 {
133  const lisp_gpe_tunnel_t *lgt;
134 
135  lgt = lisp_gpe_tunnel_get (ladj->tunnel_index);
136 
138  lgt->fib_entry_index,
140  (ladj));
141 }
142 
143 /**
144  * @brief Call back when restacking all adjacencies on a GRE interface
145  */
146 static adj_walk_rc_t
148 {
149  lisp_gpe_adjacency_t *ladj = ctx;
150 
151  lisp_gpe_adj_stack_one (ladj, ai);
152 
153  return (ADJ_WALK_RC_CONTINUE);
154 }
155 
156 static void
158 {
159  fib_protocol_t nh_proto;
160  ip46_address_t nh;
161 
162  ip_address_to_46 (&ladj->remote_rloc, &nh, &nh_proto);
163 
164  /*
165  * walk all the adjacencies on th lisp interface and restack them
166  */
168  nh_proto, &nh, lisp_gpe_adj_walk_cb, ladj);
169 }
170 
173 {
174  switch (linkt)
175  {
176  case VNET_LINK_IP4:
177  return (LISP_GPE_NEXT_PROTO_IP4);
178  case VNET_LINK_IP6:
179  return (LISP_GPE_NEXT_PROTO_IP6);
180  case VNET_LINK_ETHERNET:
182  case VNET_LINK_NSH:
183  return (LISP_GPE_NEXT_PROTO_NSH);
184  default:
185  ASSERT (0);
186  }
187  return (LISP_GPE_NEXT_PROTO_IP4);
188 }
189 
190 #define is_v4_packet(_h) ((*(u8*) _h) & 0xF0) == 0x40
191 
192 static lisp_afi_e
194 {
195  switch (link)
196  {
197  case VNET_LINK_IP4:
198  return LISP_AFI_IP;
199  case VNET_LINK_IP6:
200  return LISP_AFI_IP6;
201  case VNET_LINK_ETHERNET:
202  return LISP_AFI_MAC;
203  default:
204  return LISP_AFI_NO_ADDR;
205  }
206 }
207 
208 static void
210  const ip_adjacency_t * adj,
211  vlib_buffer_t * b)
212 {
214  lisp_gpe_adjacency_t *ladj;
215  ip_address_t rloc;
216  index_t lai;
217  u32 si, di;
219  uword *feip;
220 
221  ip46_address_to_ip_address (&adj->sub_type.nbr.next_hop, &rloc);
222  si = vnet_buffer (b)->sw_if_index[VLIB_TX];
223  lai = lisp_adj_find (&rloc, si);
224  ASSERT (INDEX_INVALID != lai);
225 
226  ladj = pool_elt_at_index (lisp_adj_pool, lai);
227 
228  u8 *lisp_data = (u8 *) vlib_buffer_get_current (b);
229 
230  /* skip IP header */
231  if (is_v4_packet (lisp_data))
232  lisp_data += sizeof (ip4_header_t);
233  else
234  lisp_data += sizeof (ip6_header_t);
235 
236  /* skip UDP header */
237  lisp_data += sizeof (udp_header_t);
238  // TODO: skip TCP?
239 
240  /* skip LISP GPE header */
241  lisp_data += sizeof (lisp_gpe_header_t);
242 
243  i16 saved_current_data = b->current_data;
244  b->current_data = lisp_data - b->data;
245 
247  get_src_and_dst_eids_from_buffer (lcm, b, &src, &dst, afi);
248  b->current_data = saved_current_data;
249  di = gid_dictionary_sd_lookup (&lcm->mapping_index_by_gid, &dst, &src);
250  if (PREDICT_FALSE (~0 == di))
251  {
252  clib_warning ("dst mapping not found (%U, %U)", format_gid_address,
253  &src, format_gid_address, &dst);
254  return;
255  }
256 
257  feip = hash_get (lcm->fwd_entry_by_mapping_index, di);
258  if (PREDICT_FALSE (!feip))
259  return;
260 
262  clib_memset (&key, 0, sizeof (key));
263  key.fwd_entry_index = feip[0];
264  key.tunnel_index = ladj->tunnel_index;
265 
266  uword *p = hash_get_mem (lgm->lisp_stats_index_by_key, &key);
267  ASSERT (p);
268 
269  /* compute payload length starting after GPE */
270  u32 bytes = b->current_length - (lisp_data - b->data - b->current_data);
272  p[0], 1, bytes);
273 }
274 
275 static void
277  const ip_adjacency_t * adj,
278  vlib_buffer_t * b, const void *data)
279 {
281 
282  if (lcm->flags & LISP_FLAG_STATS_ENABLED)
283  lisp_gpe_increment_stats_counters (lcm, adj, b);
284 
285  /* Fixup the checksum and len fields in the LISP tunnel encap
286  * that was applied at the midchain node */
288 }
289 
290 /**
291  * @brief The LISP-GPE interface registered function to update, i.e.
292  * provide an rewrite string for, an adjacency.
293  */
294 void
296 {
297  const lisp_gpe_tunnel_t *lgt;
298  lisp_gpe_adjacency_t *ladj;
299  ip_adjacency_t *adj;
300  ip_address_t rloc;
301  vnet_link_t linkt;
302  adj_flags_t af;
303  index_t lai;
304 
305  adj = adj_get (ai);
306  ip46_address_to_ip_address (&adj->sub_type.nbr.next_hop, &rloc);
307 
308  /*
309  * find an existing or create a new adj
310  */
311  lai = lisp_adj_find (&rloc, sw_if_index);
312 
313  ASSERT (INDEX_INVALID != lai);
314 
315  ladj = pool_elt_at_index (lisp_adj_pool, lai);
316  lgt = lisp_gpe_tunnel_get (ladj->tunnel_index);
317  linkt = adj_get_link_type (ai);
319  if (VNET_LINK_ETHERNET == linkt)
321 
323  (ai, lisp_gpe_fixup, NULL, af,
326  (linkt)));
327 
328  lisp_gpe_adj_stack_one (ladj, ai);
329 }
330 
331 u8 *
334  vnet_link_t link_type, const void *dst_address)
335 {
336  ASSERT (0);
337  return (NULL);
338 }
339 
340 index_t
342  u32 overlay_table_id, u32 vni)
343 {
344  const lisp_gpe_sub_interface_t *l3s;
345  const lisp_gpe_tunnel_t *lgt;
346  lisp_gpe_adjacency_t *ladj;
347  index_t lai, l3si;
348 
349  /*
350  * first find the L3 sub-interface that corresponds to the loacl-rloc and vni
351  */
353  overlay_table_id,
354  vni);
355  l3s = lisp_gpe_sub_interface_get (l3si);
356 
357  /*
358  * find an existing or create a new adj
359  */
360  lai = lisp_adj_find (&pair->rmt_loc, l3s->sw_if_index);
361 
362  if (INDEX_INVALID == lai)
363  {
364 
365  pool_get (lisp_adj_pool, ladj);
366  clib_memset (ladj, 0, sizeof (*ladj));
367  lai = (ladj - lisp_adj_pool);
368 
369  ip_address_copy (&ladj->remote_rloc, &pair->rmt_loc);
370  ladj->vni = vni;
371  /* transfer the lock to the adj */
372  ladj->lisp_l3_sub_index = l3si;
373  ladj->sw_if_index = l3s->sw_if_index;
374 
375  /* if vni is non-default */
376  if (ladj->vni)
377  ladj->flags = LISP_GPE_FLAGS_I;
378 
379  /* work in lisp-gpe not legacy mode */
380  ladj->flags |= LISP_GPE_FLAGS_P;
381 
382  /*
383  * find the tunnel that will provide the underlying transport
384  * and hence the rewrite.
385  * The RLOC FIB index is default table - always.
386  */
388 
389  lgt = lisp_gpe_tunnel_get (ladj->tunnel_index);
390 
391  /*
392  * become of child of the RLOC FIB entry so we are updated when
393  * its reachability changes, allowing us to re-stack the midcahins
394  */
397  lai);
398 
399  lisp_adj_insert (&ladj->remote_rloc, ladj->sw_if_index, lai);
400  }
401  else
402  {
403  /* unlock the interface from the find. */
405  ladj = lisp_gpe_adjacency_get_i (lai);
406  }
407 
408  ladj->locks++;
409 
410  return (lai);
411 }
412 
413 /**
414  * @brief Get a pointer to a tunnel from a pointer to a FIB node
415  */
416 static lisp_gpe_adjacency_t *
418 {
419  return ((lisp_gpe_adjacency_t *)
420  ((char *) node -
422 }
423 
424 static void
426 {
427  const lisp_gpe_tunnel_t *lgt;
428 
429  /*
430  * no children so we are not counting locks. no-op.
431  * at least not counting
432  */
433  lisp_adj_remove (&ladj->remote_rloc, ladj->sw_if_index);
434 
435  /*
436  * unlock the resources this adj holds
437  */
438  lgt = lisp_gpe_tunnel_get (ladj->tunnel_index);
439 
441 
444 
445  pool_put (lisp_adj_pool, ladj);
446 }
447 
448 void
450 {
451  lisp_gpe_adjacency_t *ladj;
452 
453  ladj = lisp_gpe_adjacency_get_i (lai);
454 
455  ladj->locks--;
456 
457  if (0 == ladj->locks)
458  {
460  }
461 }
462 
463 const lisp_gpe_adjacency_t *
465 {
466  return (lisp_gpe_adjacency_get_i (lai));
467 }
468 
469 
470 /**
471  * @brief LISP GPE tunnel back walk
472  *
473  * The FIB entry through which this tunnel resolves has been updated.
474  * re-stack the midchain on the new forwarding.
475  */
479 {
481 
483 }
484 
485 static fib_node_t *
487 {
488  lisp_gpe_adjacency_t *ladj;
489 
490  ladj = pool_elt_at_index (lisp_adj_pool, index);
491  return (&ladj->fib_node);
492 }
493 
494 static void
496 {
498 }
499 
500 const static fib_node_vft_t lisp_gpe_tuennel_vft = {
502  .fnv_back_walk = lisp_gpe_adjacency_back_walk,
503  .fnv_last_lock = lisp_gpe_adjacency_last_fib_lock_gone,
504 };
505 
506 u8 *
507 format_lisp_gpe_adjacency (u8 * s, va_list * args)
508 {
509  lisp_gpe_adjacency_t *ladj = va_arg (*args, lisp_gpe_adjacency_t *);
511  va_arg (*args, lisp_gpe_adjacency_format_flags_t);
512 
514  {
515  s =
516  format (s, "index %d locks:%d\n", ladj - lisp_adj_pool, ladj->locks);
517  }
518 
519  s = format (s, " vni: %d,", ladj->vni);
520  s = format (s, " remote-RLOC: %U,", format_ip_address, &ladj->remote_rloc);
521 
522  if (flags & LISP_GPE_ADJ_FORMAT_FLAG_DETAIL)
523  {
524  s = format (s, " %U\n",
527  s = format (s, " %U\n",
530  }
531  else
532  {
533  s = format (s, " LISP L3 sub-interface index: %d,",
534  ladj->lisp_l3_sub_index);
535  s = format (s, " LISP tunnel index: %d", ladj->tunnel_index);
536  }
537 
538 
539  return (s);
540 }
541 
542 static clib_error_t *
544  unformat_input_t * input, vlib_cli_command_t * cmd)
545 {
546  lisp_gpe_adjacency_t *ladj;
547  index_t index;
548 
549  if (pool_elts (lisp_adj_pool) == 0)
550  vlib_cli_output (vm, "No lisp-gpe Adjacencies");
551 
552  if (unformat (input, "%d", &index))
553  {
554  ladj = lisp_gpe_adjacency_get_i (index);
557  }
558  else
559  {
560  /* *INDENT-OFF* */
561  pool_foreach (ladj, lisp_adj_pool,
562  ({
563  vlib_cli_output (vm, "[%d] %U\n",
564  ladj - lisp_adj_pool,
567  }));
568  /* *INDENT-ON* */
569  }
570 
571  return 0;
572 }
573 
574 /* *INDENT-OFF* */
575 VLIB_CLI_COMMAND (show_lisp_gpe_tunnel_command, static) =
576 {
577  .path = "show gpe adjacency",
578  .function = lisp_gpe_adjacency_show,
579 };
580 /* *INDENT-ON* */
581 
582 #define LISP_ADJ_NBR_DEFAULT_HASH_NUM_BUCKETS (256)
583 #define LISP_ADJ_NBR_DEFAULT_HASH_MEMORY_SIZE (1<<20)
584 
585 static clib_error_t *
587 {
589  "Adjacency Neighbour table",
592 
593  fib_node_register_type (FIB_NODE_TYPE_LISP_ADJ, &lisp_gpe_tuennel_vft);
594  return (NULL);
595 }
596 
598 /*
599  * fd.io coding-style-patch-verification: ON
600  *
601  * Local Variables:
602  * eval: (c-set-style "gnu")
603  * End:
604  */
static void lisp_gpe_increment_stats_counters(lisp_cp_main_t *lcm, const ip_adjacency_t *adj, vlib_buffer_t *b)
const lisp_gpe_tunnel_t * lisp_gpe_tunnel_get(index_t lgti)
static lisp_gpe_adjacency_t * lisp_gpe_adjacency_get_i(index_t lai)
void adj_nbr_walk_nh(u32 sw_if_index, fib_protocol_t adj_nh_proto, const ip46_address_t *nh, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given next-hop.
Definition: adj_nbr.c:668
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:113
enum lisp_gpe_adjacency_format_flags_t_ lisp_gpe_adjacency_format_flags_t
Flags for displaying the adjacency.
a
Definition: bitmap.h:538
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
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: ip_types.c:152
#define LISP_ADJ_NBR_DEFAULT_HASH_MEMORY_SIZE
void lisp_gpe_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
The LISP-GPE interface registered function to update, i.e.
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
u32 locks
The number of locks/reference counts on the adjacency.
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: fib_entry.c:555
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:110
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
Definition: adj.c:475
#define NULL
Definition: clib.h:58
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
IP unicast adjacency.
Definition: adj.h:221
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
LISP-GPE global state.
Definition: lisp_gpe.h:118
index_t lisp_gpe_tunnel_find_or_create_and_lock(const locator_pair_t *pair, u32 rloc_fib_index)
u16 current_length
Nbytes between current data and the end of this buffer.
Definition: buffer.h:113
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
Definition: fib_entry.c:566
static clib_error_t * lisp_gpe_adj_module_init(vlib_main_t *vm)
u8 data[0]
Packet data.
Definition: buffer.h:181
static void lisp_gpe_adjacency_last_lock_gone(lisp_gpe_adjacency_t *ladj)
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
u8 * format_lisp_gpe_tunnel(u8 *s, va_list *args)
Format LISP-GPE tunnel.
vl_api_address_t src
Definition: gre.api:60
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:109
static index_t lisp_adj_find(const ip_address_t *addr, u32 sw_if_index)
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:65
static fib_node_t * lisp_gpe_adjacency_get_fib_node(fib_node_index_t index)
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
#define ip_addr_version(_a)
Definition: ip_types.h:52
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
Definition: ip46_address.h:55
u8 * format_lisp_gpe_sub_interface(u8 *s, va_list *ap)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:237
vhost_vring_addr_t addr
Definition: vhost_user.h:147
static fib_node_back_walk_rc_t lisp_gpe_adjacency_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
LISP GPE tunnel back walk.
unsigned char u8
Definition: types.h:56
static clib_error_t * lisp_gpe_adjacency_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:60
vnet_link_t ia_link
link/ether-type 1 bytes
Definition: adj.h:242
static lisp_gpe_next_protocol_e lisp_gpe_adj_proto_from_vnet_link_type(vnet_link_t linkt)
u32 fib_entry_child_index
This adjacency is a child of the FIB entry to reach the RLOC.
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
Definition: lisp_gpe.h:183
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:431
fib_node_index_t fib_entry_index
the FIB entry through which the remote rloc is reachable s
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:498
vl_api_interface_index_t sw_if_index
Definition: gre.api:59
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:173
u32 fwd_entry_index
Definition: lisp_gpe.h:95
fib_node_t fib_node
The LISP adj is a part of the FIB control plane graph.
static BVT(clib_bihash)
Definition: adj_nbr.c:28
vlib_combined_counter_main_t counters
Definition: lisp_gpe.h:164
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
static void lisp_gpe_adj_stack(lisp_gpe_adjacency_t *ladj)
void lisp_gpe_tunnel_unlock(index_t lgti)
struct ip_adjacency_t_::@119::@120 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
void lisp_gpe_adjacency_unlock(index_t lai)
u32 * fwd_entry_by_mapping_index
Definition: control.h:196
void adj_nbr_midchain_stack_on_fib_entry(adj_index_t ai, fib_node_index_t fei, fib_forward_chain_type_t fct)
[re]stack a midchain.
Definition: adj_midchain.c:603
const lisp_gpe_sub_interface_t * lisp_gpe_sub_interface_get(index_t l3si)
u32 sw_if_index
The SW if index assigned to this sub-interface.
union ip_adjacency_t_::@119 sub_type
u8 * lisp_gpe_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
unsigned int u32
Definition: types.h:88
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:304
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
LISP sub-interfaces.
static void ip46_address_to_ip_address(const ip46_address_t *a, ip_address_t *b)
void ip_address_to_46(const ip_address_t *addr, ip46_address_t *a, fib_protocol_t *proto)
Definition: ip_types.c:159
#define hash_get(h, key)
Definition: hash.h:249
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:519
Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
long ctx[MAX_CONNS]
Definition: main.c:144
struct _unformat_input_t unformat_input_t
u32 vni
Definition: lisp_gpe.api:129
static lisp_adj_db
Hash table of all adjacencies.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:229
void di(unformat_input_t *i)
Definition: unformat.c:163
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:287
#define PREDICT_FALSE(x)
Definition: clib.h:111
u32 sw_if_index
The SW IF index of the sub-interface this adjacency uses.
u8 * format_gid_address(u8 *s, va_list *args)
Definition: lisp_types.c:187
const lisp_gpe_adjacency_t * lisp_gpe_adjacency_get(index_t lai)
#define LISP_ADJ_NBR_DEFAULT_HASH_NUM_BUCKETS
ip_address_t lcl_loc
Definition: lisp_types.h:328
#define is_v4_packet(_h)
An node in the FIB graph.
Definition: fib_node.h:295
vl_api_address_t dst
Definition: gre.api:61
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
static void lisp_gpe_adjacency_last_fib_lock_gone(fib_node_t *node)
lisp_afi_e
Definition: lisp_types.h:181
vlib_main_t * vm
Definition: in2out_ed.c:1810
index_t lisp_gpe_adjacency_find_or_create_and_lock(const locator_pair_t *pair, u32 overlay_table_id, u32 vni)
static void ip_udp_fixup_one(vlib_main_t *vm, vlib_buffer_t *b0, u8 is_ip4)
Definition: udp.h:291
u32 flags
Definition: vhost_user.h:141
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:218
#define LISP_ADJ_SET_KEY(_key, _itf, _nh)
#define clib_warning(format, args...)
Definition: error.h:59
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
Definition: adj_midchain.c:532
fib_node_get_t fnv_get
Definition: fib_node.h:283
u8 * format_ip_address(u8 *s, va_list *args)
Definition: ip_types.c:20
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
LISP-GPE header.
void lisp_gpe_sub_interface_unlock(index_t l3si)
vlib_main_t vlib_node_runtime_t * node
Definition: in2out_ed.c:1810
Context passed between object during a back walk.
Definition: fib_node.h:208
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:152
struct _gid_address_t gid_address_t
#define ASSERT(truth)
static void lisp_gpe_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
u8 data[128]
Definition: ipsec_types.api:87
static lisp_afi_e lisp_afi_from_vnet_link_type(vnet_link_t link)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
gid_dictionary_t mapping_index_by_gid
Definition: control.h:168
u32 gid_dictionary_sd_lookup(gid_dictionary_t *db, gid_address_t *dst, gid_address_t *src)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
static adj_walk_rc_t lisp_gpe_adj_walk_cb(adj_index_t ai, void *ctx)
Call back when restacking all adjacencies on a GRE interface.
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
typedef key
Definition: ipsec_types.api:83
Definition: defs.h:47
A LISP GPE Adjacency.
index_t lisp_gpe_sub_interface_find_or_create_and_lock(const ip_address_t *lrloc, u32 overlay_table_id, u32 vni)
A LISP L3 sub-interface.
u32 tunnel_index
The index of the LISP GPE tunnel that provides the transport in the underlay.
#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
u8 * lisp_gpe_tunnel_build_rewrite(const lisp_gpe_tunnel_t *lgt, const lisp_gpe_adjacency_t *ladj, lisp_gpe_next_protocol_e payload_proto)
Compute IP-UDP-GPE sub-tunnel encap/rewrite header.
fib_forward_chain_type_t lisp_gpe_adj_get_fib_chain_type(const lisp_gpe_adjacency_t *ladj)
#define hash_get_mem(h, key)
Definition: hash.h:269
static void lisp_adj_remove(const ip_address_t *addr, u32 sw_if_index)
A FIB graph nodes virtual function table.
Definition: fib_node.h:282
u8 * format_lisp_gpe_adjacency(u8 *s, va_list *args)
#define vnet_buffer(b)
Definition: buffer.h:408
static lisp_gpe_adjacency_t * lisp_adj_pool
Memory pool of all adjacencies.
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
Definition: ip_types.c:115
void get_src_and_dst_eids_from_buffer(lisp_cp_main_t *lcm, vlib_buffer_t *b, gid_address_t *src, gid_address_t *dst, u16 type)
Definition: control.c:3308
ip_address_t rmt_loc
Definition: lisp_types.h:329
static lisp_gpe_adjacency_t * lisp_gpe_adjacency_from_fib_node(const fib_node_t *node)
Get a pointer to a tunnel from a pointer to a FIB node.
u32 lisp_l3_sub_index
The index of the LISP L3 subinterface.
uword * lisp_stats_index_by_key
Definition: lisp_gpe.h:163
lisp_gpe_next_protocol_e
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:689
u8 flags
LISP header fields in HOST byte order.
ip_address_t remote_rloc
remote RLOC.
A LISP GPE Tunnel.
static void lisp_adj_insert(const ip_address_t *addr, u32 sw_if_index, index_t ai)
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
static void lisp_gpe_adj_stack_one(lisp_gpe_adjacency_t *ladj, adj_index_t ai)
Stack the tunnel&#39;s midchain on the IP forwarding chain of the via.
signed short i16
Definition: types.h:46
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128