FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
lisp_gpe_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * lisp_gpe_api.c - lisp_gpe api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 #include <lisp/lisp-gpe/lisp_gpe.h>
30 #include <vnet/fib/fib_table.h>
31 #include <vnet/ip/ip_types_api.h>
33 #include <lisp/lisp-gpe/lisp_types_api.h>
34 
35 /* define message IDs */
36 #include <vnet/format_fns.h>
37 #include <lisp/lisp-gpe/lisp_gpe.api_enum.h>
38 #include <lisp/lisp-gpe/lisp_gpe.api_types.h>
39 
40 /**
41  * Base message ID fot the plugin
42  */
44 #define REPLY_MSG_ID_BASE gpe_base_msg_id
45 
47 
48 static locator_pair_t *
49 unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
50 {
51  u32 i;
52  locator_pair_t *pairs = 0, pair, *p;
53  vl_api_gpe_locator_t *r;
54 
55  for (i = 0; i < rloc_num; i++)
56  {
57  /* local locator */
58  r = &((vl_api_gpe_locator_t *) locs)[i];
59  clib_memset (&pair, 0, sizeof (pair));
60  ip_address_decode2 (&r->addr, &pair.lcl_loc);
61 
62  pair.weight = r->weight;
63  vec_add1 (pairs, pair);
64  }
65 
66  for (i = rloc_num; i < rloc_num * 2; i++)
67  {
68  /* remote locators */
69  r = &((vl_api_gpe_locator_t *) locs)[i];
70  p = &pairs[i - rloc_num];
71  ip_address_decode2 (&r->addr, &p->rmt_loc);
72  }
73  return pairs;
74 }
75 
76 static void
79 {
80  mp->fwd_entry_index = clib_net_to_host_u32 (mp->fwd_entry_index);
81 }
82 
83 static void
84 lisp_api_set_locator (vl_api_gpe_locator_t * loc,
85  const ip_address_t * addr, u8 weight)
86 {
87  loc->weight = weight;
88  ip_address_encode2 (addr, &loc->addr);
89 }
90 
91 static void
94 {
100 
102 
104  if (!reg)
105  return;
106 
108  return;
109 
111 
113  return;
114 
115  vec_foreach (path, lfe->paths)
116  {
117  rmp = vl_msg_api_alloc (sizeof (*rmp));
118  clib_memset (rmp, 0, sizeof (*rmp));
119  const lisp_gpe_tunnel_t *lgt;
120 
121  rmp->_vl_msg_id =
122  clib_host_to_net_u16 (VL_API_GPE_FWD_ENTRY_PATH_DETAILS);
123 
124  const lisp_gpe_adjacency_t *ladj =
125  lisp_gpe_adjacency_get (path->lisp_adj);
126  lisp_api_set_locator (&rmp->rmt_loc, &ladj->remote_rloc, path->weight);
127  lgt = lisp_gpe_tunnel_get (ladj->tunnel_index);
128  lisp_api_set_locator (&rmp->lcl_loc, &lgt->key->lcl, path->weight);
129 
130  rmp->context = mp->context;
131  vl_api_send_msg (reg, (u8 *) rmp);
132  }
133 }
134 
135 static void
136 gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst,
138 {
140  u32 i = 0;
141 
142  vec_foreach (e, src)
143  {
144  clib_memset (&dst[i], 0, sizeof (*dst));
145  dst[i].dp_table = e->dp_table;
146  dst[i].fwd_entry_index = e->fwd_entry_index;
147  dst[i].vni = e->vni;
148  dst[i].action = e->action;
149  switch (fid_addr_type (&e->leid))
150  {
151  case FID_ADDR_IP_PREF:
152  dst[i].leid.type = EID_TYPE_API_PREFIX;
153  dst[i].reid.type = EID_TYPE_API_PREFIX;
155  &dst[i].leid.address.prefix);
157  &dst[i].reid.address.prefix);
158  break;
159  case FID_ADDR_MAC:
161  dst[i].leid.address.mac);
163  dst[i].reid.address.mac);
164  dst[i].leid.type = EID_TYPE_API_MAC;
165  dst[i].reid.type = EID_TYPE_API_MAC;
166  break;
167  default:
168  clib_warning ("unknown fid type %d!", fid_addr_type (&e->leid));
169  break;
170  }
171  i++;
172  }
173 }
174 
175 static void
177 {
178  mp->vni = clib_net_to_host_u32 (mp->vni);
179 }
180 
181 static void
182 gpe_entry_t_host_to_net (vl_api_gpe_fwd_entry_t * e)
183 {
184  e->fwd_entry_index = clib_host_to_net_u32 (e->fwd_entry_index);
185  e->dp_table = clib_host_to_net_u32 (e->dp_table);
186  e->vni = clib_host_to_net_u32 (e->vni);
187 }
188 
189 static void
192 {
193  u32 i;
194  vl_api_gpe_fwd_entry_t *e;
195 
196  for (i = 0; i < mp->count; i++)
197  {
198  e = &mp->entries[i];
200  }
201  mp->count = clib_host_to_net_u32 (mp->count);
202 }
203 
204 static void
206 {
208  hash_pair_t *p;
209  u32 i = 0;
210  int rv = 0;
211 
213  u32 size = hash_elts (vnis) * sizeof (u32);
214 
215  /* *INDENT-OFF* */
216  REPLY_MACRO4 (VL_API_GPE_FWD_ENTRY_VNIS_GET_REPLY, size,
217  {
218  rmp->count = clib_host_to_net_u32 (hash_elts (vnis));
219  hash_foreach_pair (p, vnis,
220  ({
221  rmp->vnis[i++] = clib_host_to_net_u32 (p->key);
222  }));
223  });
224  /* *INDENT-ON* */
225 
226  hash_free (vnis);
227 }
228 
229 static void
231 {
234  u32 size = 0;
235  int rv = 0;
236 
238 
240  size = vec_len (e) * sizeof (vl_api_gpe_fwd_entry_t);
241 
242  /* *INDENT-OFF* */
243  REPLY_MACRO4 (VL_API_GPE_FWD_ENTRIES_GET_REPLY, size,
244  {
245  rmp->count = vec_len (e);
246  gpe_fwd_entries_copy (rmp->entries, e);
248  });
249  /* *INDENT-ON* */
250 
251  vec_free (e);
252 }
253 
254 static void
256 {
257  mp->vni = clib_net_to_host_u32 (mp->vni);
258  mp->dp_table = clib_net_to_host_u32 (mp->dp_table);
259  mp->loc_num = clib_net_to_host_u32 (mp->loc_num);
260 }
261 
262 static void
264 {
267  locator_pair_t *pairs = 0;
268  int rv = 0;
269 
271  clib_memset (a, 0, sizeof (a[0]));
272 
273  rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, &mp->rmt_eid);
274  rv |= unformat_lisp_eid_api (&a->lcl_eid, mp->vni, &mp->lcl_eid);
275 
276  if (mp->loc_num % 2 != 0)
277  {
278  rv = -1;
279  goto send_reply;
280  }
281  pairs = unformat_gpe_loc_pairs (mp->locs, mp->loc_num / 2);
282 
283  if (rv)
284  goto send_reply;
285 
286  a->is_add = mp->is_add;
287  a->locator_pairs = pairs;
288  a->dp_table = mp->dp_table;
289  a->vni = mp->vni;
290  a->action = mp->action;
291  if (mp->loc_num == 0)
292  a->is_negative = 1;
293 
295  vec_free (pairs);
296 send_reply:
297  /* *INDENT-OFF* */
298  REPLY_MACRO2 (VL_API_GPE_ADD_DEL_FWD_ENTRY_REPLY,
299  {
300  rmp->fwd_entry_index = clib_host_to_net_u32 (a->fwd_entry_index);
301  });
302  /* *INDENT-ON* */
303 }
304 
305 static void
307 {
308  vl_api_gpe_enable_disable_reply_t *rmp;
309  int rv = 0;
311 
312  a->is_en = mp->is_enable;
314 
315  REPLY_MACRO (VL_API_GPE_ENABLE_DISABLE_REPLY);
316 }
317 
318 static void
320 {
321  vl_api_gpe_add_del_iface_reply_t *rmp;
322  int rv = 0;
323  u32 vni, dp_table;
324 
325  vni = clib_net_to_host_u32 (mp->vni);
326  dp_table = clib_net_to_host_u32 (mp->dp_table);
327 
328  if (mp->is_l2)
329  {
330  if (mp->is_add)
331  {
333  rv = 1;
334  }
335  else
337  }
338  else
339  {
340  if (mp->is_add)
341  {
343  rv = 1;
344  }
345  else
347  }
348 
349  REPLY_MACRO (VL_API_GPE_ADD_DEL_IFACE_REPLY);
350 }
351 
352 static void
354 {
355  vl_api_gpe_set_encap_mode_reply_t *rmp;
356  int rv = 0;
357 
359  REPLY_MACRO (VL_API_GPE_SET_ENCAP_MODE_REPLY);
360 }
361 
362 static void
364 {
366  int rv = 0;
367 
368  /* *INDENT-OFF* */
369  REPLY_MACRO2 (VL_API_GPE_GET_ENCAP_MODE_REPLY,
370  ({
372  }));
373  /* *INDENT-ON* */
374 }
375 
376 static void
379 {
380  vl_api_gpe_add_del_native_fwd_rpath_reply_t *rmp;
382  int rv = 0;
383 
384  clib_memset (a, 0, sizeof (a[0]));
385 
386  if (mp->nh_addr.af)
387  clib_memcpy (&a->rpath.frp_addr.ip6, mp->nh_addr.un.ip6,
388  sizeof (ip6_address_t));
389  else
390  clib_memcpy (&a->rpath.frp_addr.ip4, mp->nh_addr.un.ip4,
391  sizeof (ip4_address_t));
392 
393  a->is_add = mp->is_add;
394  a->rpath.frp_proto = mp->nh_addr.af ? DPO_PROTO_IP6 : DPO_PROTO_IP4;
395  a->rpath.frp_fib_index =
396  fib_table_find (dpo_proto_to_fib (a->rpath.frp_proto),
397  clib_net_to_host_u32 (mp->table_id));
398  if (~0 == a->rpath.frp_fib_index)
399  {
400  rv = VNET_API_ERROR_INVALID_VALUE;
401  goto done;
402  }
403 
404  a->rpath.frp_sw_if_index = clib_net_to_host_u32 (mp->nh_sw_if_index);
405  a->rpath.frp_weight = 1;
406 
408 done:
409  REPLY_MACRO (VL_API_GPE_ADD_DEL_NATIVE_FWD_RPATH_REPLY);
410 }
411 
412 static void
413 gpe_native_fwd_rpaths_copy (vl_api_gpe_native_fwd_rpath_t * dst,
415 {
416  fib_route_path_t *e;
417  fib_table_t *table;
418  u32 i = 0;
419 
420  vec_foreach (e, src)
421  {
422  clib_memset (&dst[i], 0, sizeof (*dst));
424  dst[i].fib_index = table->ft_table_id;
425  dst[i].nh_sw_if_index = e->frp_sw_if_index;
426  ip_address_encode (&e->frp_addr, IP46_TYPE_ANY, &dst[i].nh_addr);
427  i++;
428  }
429 }
430 
431 static void
432 gpe_native_fwd_rpath_t_host_to_net (vl_api_gpe_native_fwd_rpath_t * e)
433 {
434  e->fib_index = clib_host_to_net_u32 (e->fib_index);
435  e->nh_sw_if_index = clib_host_to_net_u32 (e->nh_sw_if_index);
436 }
437 
438 static void
441 {
442  u32 i;
443  vl_api_gpe_native_fwd_rpath_t *e;
444 
445  for (i = 0; i < mp->count; i++)
446  {
447  e = &mp->entries[i];
449  }
450  mp->count = clib_host_to_net_u32 (mp->count);
451 }
452 
453 static void
455  * mp)
456 {
459  u32 size = 0;
460  int rv = 0;
461 
462  u8 rpath_index = mp->is_ip4 ? 1 : 0;
463 
464  size = vec_len (lgm->native_fwd_rpath[rpath_index])
465  * sizeof (vl_api_gpe_native_fwd_rpath_t);
466 
467  /* *INDENT-OFF* */
468  REPLY_MACRO4 (VL_API_GPE_NATIVE_FWD_RPATHS_GET_REPLY, size,
469  {
470  rmp->count = vec_len (lgm->native_fwd_rpath[rpath_index]);
472  lgm->native_fwd_rpath[rpath_index]);
474  });
475  /* *INDENT-ON* */
476 }
477 
478 /*
479  * lisp_api_hookup
480  * Add vpe's API message handlers to the table.
481  * vlib has already mapped shared memory and
482  * added the client registration handlers.
483  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
484  */
485 #include <lisp/lisp-gpe/lisp_gpe.api.c>
486 
487 static clib_error_t *
489 {
490  /*
491  * Set up the (msg_name, crc, message-id) table
492  */
494 
495  return NULL;
496 }
497 
499 
500 /*
501  * fd.io coding-style-patch-verification: ON
502  *
503  * Local Variables:
504  * eval: (c-set-style "gnu")
505  * End:
506  */
ip_address
Definition: ip_types.h:79
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
gpe_native_fwd_rpaths_copy
static void gpe_native_fwd_rpaths_copy(vl_api_gpe_native_fwd_rpath_t *dst, fib_route_path_t *src)
Definition: lisp_gpe_api.c:413
lisp_gpe_adjacency_t_::remote_rloc
ip_address_t remote_rloc
remote RLOC.
Definition: lisp_gpe_adjacency.h:53
vl_api_gpe_fwd_entry_vnis_get_reply_t::count
u32 count
Definition: lisp_gpe.api:102
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
weight
u8 weight
Definition: fib_types.api:120
api.h
gpe_fwd_entry_path_dump_t_net_to_host
static void gpe_fwd_entry_path_dump_t_net_to_host(vl_api_gpe_fwd_entry_path_dump_t *mp)
Definition: lisp_gpe_api.c:78
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
hash_free
#define hash_free(h)
Definition: hash.h:310
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
ip_prefix_encode2
void ip_prefix_encode2(const ip_prefix_t *in, vl_api_prefix_t *out)
Definition: ip_types_api.c:297
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
vl_api_gpe_enable_disable_t
enable or disable gpe protocol
Definition: lisp_gpe.api:70
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_gpe_fwd_entries_get_t_handler
static void vl_api_gpe_fwd_entries_get_t_handler(vl_api_gpe_fwd_entries_get_t *mp)
Definition: lisp_gpe_api.c:230
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
vl_api_gpe_add_del_native_fwd_rpath_t::nh_sw_if_index
vl_api_interface_index_t nh_sw_if_index
Definition: lisp_gpe.api:196
gpe_fwd_entries_copy
static void gpe_fwd_entries_copy(vl_api_gpe_fwd_entry_t *dst, lisp_api_gpe_fwd_entry_t *src)
Definition: lisp_gpe_api.c:136
vl_api_gpe_add_del_fwd_entry_t::action
u8 action
Definition: lisp_gpe.api:53
gpe_native_fwd_rpath_t_host_to_net
static void gpe_native_fwd_rpath_t_host_to_net(vl_api_gpe_native_fwd_rpath_t *e)
Definition: lisp_gpe_api.c:432
REPLY_MACRO4
#define REPLY_MACRO4(t, n, body)
Definition: api_helper_macros.h:173
path
vl_api_fib_path_t path
Definition: mfib_types.api:44
vl_api_gpe_fwd_entry_vnis_get_reply_t::vnis
u32 vnis[count]
Definition: lisp_gpe.api:103
vni
u32 vni
Definition: flow_types.api:160
fib_table.h
fib_route_path_t_::frp_addr
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:516
hash_elts
static uword hash_elts(void *v)
Definition: hash.h:118
vl_api_gpe_native_fwd_rpaths_get_reply_t::count
u32 count
Definition: lisp_gpe.api:229
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
fib_route_path_t_::frp_sw_if_index
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:545
lisp_api_gpe_fwd_entry_t::action
u8 action
Definition: lisp_gpe.h:289
lisp_api_gpe_fwd_entry_t::dp_table
u32 dp_table
Definition: lisp_gpe.h:287
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
vl_api_gpe_add_del_iface_t
add or delete gpe_iface
Definition: lisp_gpe.api:82
fib_route_path_t_::frp_proto
dpo_proto_t frp_proto
The protocol of the address below.
Definition: fib_types.h:505
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
vl_api_gpe_set_encap_mode_t::is_vxlan
bool is_vxlan
Definition: lisp_gpe.api:154
vl_api_gpe_fwd_entry_path_details_t
Definition: lisp_gpe.api:138
vl_api_gpe_set_encap_mode_t_handler
static void vl_api_gpe_set_encap_mode_t_handler(vl_api_gpe_set_encap_mode_t *mp)
Definition: lisp_gpe_api.c:353
vl_api_gpe_add_del_native_fwd_rpath_t
Add native fwd rpath.
Definition: lisp_gpe.api:190
EID_TYPE_API_PREFIX
@ EID_TYPE_API_PREFIX
Definition: lisp_types.api:39
vl_api_gpe_fwd_entry_path_dump_t::context
u32 context
Definition: lisp_gpe.api:134
lisp_gpe.h
LISP-GPE definitions.
lisp_api_set_locator
static void lisp_api_set_locator(vl_api_gpe_locator_t *loc, const ip_address_t *addr, u8 weight)
Definition: lisp_gpe_api.c:84
unformat_lisp_eid_api
int unformat_lisp_eid_api(gid_address_t *dst, u32 vni, const vl_api_eid_t *eid)
Definition: lisp_types_api.c:24
ip_address_encode2
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
Definition: ip_types_api.c:228
vl_api_gpe_native_fwd_rpaths_get_t_handler
static void vl_api_gpe_native_fwd_rpaths_get_t_handler(vl_api_gpe_native_fwd_rpaths_get_t *mp)
Definition: lisp_gpe_api.c:454
vl_api_gpe_fwd_entry_path_details_t::rmt_loc
vl_api_gpe_locator_t rmt_loc
Definition: lisp_gpe.api:142
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
vnet_lisp_gpe_get_main
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
Definition: lisp_gpe.h:184
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_gpe_add_del_fwd_entry_reply_t::fwd_entry_index
u32 fwd_entry_index
Definition: lisp_gpe.api:62
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
vl_api_gpe_set_encap_mode_t
Set GPE encapsulation mode.
Definition: lisp_gpe.api:150
gpe_add_del_fwd_entry_t_net_to_host
static void gpe_add_del_fwd_entry_t_net_to_host(vl_api_gpe_add_del_fwd_entry_t *mp)
Definition: lisp_gpe_api.c:255
fib_table_t_::ft_table_id
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
vl_api_gpe_fwd_entry_path_details_t::lcl_loc
vl_api_gpe_locator_t lcl_loc
Definition: lisp_gpe.api:141
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
fid_addr_type
#define fid_addr_type(_a)
Definition: lisp_types.h:87
FID_ADDR_IP_PREF
@ FID_ADDR_IP_PREF
Definition: lisp_types.h:63
vl_api_gpe_enable_disable_t_handler
static void vl_api_gpe_enable_disable_t_handler(vl_api_gpe_enable_disable_t *mp)
Definition: lisp_gpe_api.c:306
FID_ADDR_MAC
@ FID_ADDR_MAC
Definition: lisp_types.h:64
lisp_gpe_tenant.h
vl_api_gpe_fwd_entry_path_details_t::context
u32 context
Definition: lisp_gpe.api:140
lisp_gpe_tenant_l2_iface_unlock
void lisp_gpe_tenant_l2_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
Definition: lisp_gpe_tenant.c:215
lisp_gpe_tenant_l3_iface_unlock
void lisp_gpe_tenant_l3_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
Definition: lisp_gpe_tenant.c:139
vnet_lisp_gpe_get_fwd_entry_vnis
u32 * vnet_lisp_gpe_get_fwd_entry_vnis(void)
Definition: lisp_gpe_fwd_entry.c:1518
lisp_gpe_main
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.c:30
interface.h
dp_table
u32 dp_table
Definition: lisp_gpe.api:116
vl_api_gpe_fwd_entry_path_dump_t::client_index
u32 client_index
Definition: lisp_gpe.api:133
lisp_gpe_tunnel_get
const lisp_gpe_tunnel_t * lisp_gpe_tunnel_get(index_t lgti)
Definition: lisp_gpe_tunnel.c:210
vl_api_gpe_get_encap_mode_reply_t
Reply for set_encap_mode.
Definition: lisp_gpe.api:173
lisp_gpe_main::native_fwd_rpath
fib_route_path_t * native_fwd_rpath[2]
Native fwd data structures.
Definition: lisp_gpe.h:168
lisp_api_gpe_fwd_entry_t::fwd_entry_index
u32 fwd_entry_index
Definition: lisp_gpe.h:286
vl_api_gpe_add_del_native_fwd_rpath_t::table_id
u32 table_id
Definition: lisp_gpe.api:195
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
src
vl_api_address_t src
Definition: gre.api:54
vl_api_gpe_get_encap_mode_reply_t::encap_mode
u8 encap_mode
Definition: lisp_gpe.api:178
ip4_address_t
Definition: ip4_packet.h:50
vnet_gpe_native_fwd_rpath_args_t
Definition: lisp_gpe.h:278
vl_api_gpe_native_fwd_rpaths_get_reply_t
Definition: lisp_gpe.api:225
vl_api_gpe_enable_disable_t::is_enable
bool is_enable[default=true]
Definition: lisp_gpe.api:74
lisp_gpe_tunnel.h
Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
vnet_lisp_gpe_fwd_entries_get_by_vni
lisp_api_gpe_fwd_entry_t * vnet_lisp_gpe_fwd_entries_get_by_vni(u32 vni)
Definition: lisp_gpe_fwd_entry.c:1535
vl_api_gpe_add_del_fwd_entry_t::is_add
bool is_add[default=true]
Definition: lisp_gpe.api:48
locator_pair
Definition: lisp_types.h:326
ip_address_decode2
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
Definition: ip_types_api.c:178
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
vl_api_gpe_fwd_entry_vnis_get_t
Definition: lisp_gpe.api:92
gpe_fwd_entries_get_t_net_to_host
static void gpe_fwd_entries_get_t_net_to_host(vl_api_gpe_fwd_entries_get_t *mp)
Definition: lisp_gpe_api.c:176
vl_api_gpe_native_fwd_rpaths_get_t::is_ip4
bool is_ip4
Definition: lisp_gpe.api:208
vl_api_gpe_add_del_native_fwd_rpath_t::nh_addr
vl_api_address_t nh_addr
Definition: lisp_gpe.api:197
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
size
u32 size
Definition: vhost_user.h:125
vl_api_gpe_fwd_entry_path_dump_t_handler
static void vl_api_gpe_fwd_entry_path_dump_t_handler(vl_api_gpe_fwd_entry_path_dump_t *mp)
Definition: lisp_gpe_api.c:93
gpe_native_fwd_rpaths_get_reply_t_host_to_net
static void gpe_native_fwd_rpaths_get_reply_t_host_to_net(vl_api_gpe_native_fwd_rpaths_get_reply_t *mp)
Definition: lisp_gpe_api.c:440
lisp_gpe_adjacency_get
const lisp_gpe_adjacency_t * lisp_gpe_adjacency_get(index_t lai)
Definition: lisp_gpe_adjacency.c:465
lisp_gpe_fwd_entry_t_::paths
lisp_fwd_path_t * paths
When the type is 'normal' The RLOC pair that form the route's paths.
Definition: lisp_gpe_fwd_entry.h:194
vl_api_gpe_get_encap_mode_t_handler
static void vl_api_gpe_get_encap_mode_t_handler(vl_api_gpe_get_encap_mode_t *mp)
Definition: lisp_gpe_api.c:363
lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.h:119
lisp_fwd_path_t_
A path on which to forward lisp traffic.
Definition: lisp_gpe_fwd_entry.h:28
dpo_proto_to_fib
fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto)
Definition: fib_types.c:359
mac_address_encode
void mac_address_encode(const mac_address_t *in, u8 *out)
Definition: ethernet_types_api.c:26
format_fns.h
vnet_lisp_gpe_enable_disable_args_t
Definition: lisp_gpe.h:211
fib_table_get
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
Definition: fib_table.c:29
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
u32
unsigned int u32
Definition: types.h:88
lisp_gpe_tunnel_t_::key
lisp_gpe_tunnel_key_t * key
RLOC pair and rloc fib_index.
Definition: lisp_gpe_tunnel.h:53
vl_api_gpe_add_del_iface_t::is_l2
bool is_l2
Definition: lisp_gpe.api:87
vl_api_gpe_fwd_entry_vnis_get_t_handler
static void vl_api_gpe_fwd_entry_vnis_get_t_handler(vl_api_gpe_fwd_entry_vnis_get_t *mp)
Definition: lisp_gpe_api.c:205
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
vl_api_gpe_add_del_native_fwd_rpath_t::is_add
bool is_add[default=true]
Definition: lisp_gpe.api:194
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
ethernet_types_api.h
vl_api_gpe_add_del_fwd_entry_t::lcl_eid
vl_api_eid_t lcl_eid
Definition: lisp_gpe.api:50
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
hash_pair_t::key
uword key
Definition: hash.h:162
lisp_gpe_adjacency_t_
A LISP GPE Adjacency.
Definition: lisp_gpe_adjacency.h:43
fid_addr_ippref
#define fid_addr_ippref(_a)
Definition: lisp_types.h:82
lisp_gpe_fwd_entry_t_
A LISP Forwarding Entry.
Definition: lisp_gpe_fwd_entry.h:75
lisp_gpe_tunnel_key_t_::lcl
ip_address_t lcl
Definition: lisp_gpe_tunnel.h:38
lisp_api_gpe_fwd_entry_t::vni
u32 vni
Definition: lisp_gpe.h:288
vl_api_gpe_fwd_entries_get_t::vni
u32 vni
Definition: lisp_gpe.api:110
vl_api_gpe_add_del_fwd_entry_t::locs
vl_api_gpe_locator_t locs[loc_num]
Definition: lisp_gpe.api:55
vl_api_gpe_fwd_entries_get_t
Definition: lisp_gpe.api:106
vl_api_gpe_add_del_fwd_entry_t_handler
static void vl_api_gpe_add_del_fwd_entry_t_handler(vl_api_gpe_add_del_fwd_entry_t *mp)
Definition: lisp_gpe_api.c:263
vl_api_gpe_native_fwd_rpaths_get_t
get GPE native fwd rpath
Definition: lisp_gpe.api:204
vl_api_gpe_add_del_fwd_entry_t::rmt_eid
vl_api_eid_t rmt_eid
Definition: lisp_gpe.api:49
mac_address_t_
Definition: mac_address.h:21
vl_api_gpe_add_del_fwd_entry_t
add or delete GPE tunnel
Definition: lisp_gpe.api:44
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(gpe_api_hookup)
vl_api_gpe_add_del_fwd_entry_t::vni
u32 vni
Definition: lisp_gpe.api:51
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_gpe_add_del_fwd_entry_reply_t
Definition: lisp_gpe.api:58
lisp_api_gpe_fwd_entry_t::leid
dp_address_t leid
Definition: lisp_gpe.h:290
unformat_gpe_loc_pairs
static locator_pair_t * unformat_gpe_loc_pairs(void *locs, u32 rloc_num)
Definition: lisp_gpe_api.c:49
ip_address_encode
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
Definition: ip_types_api.c:206
vl_api_gpe_fwd_entries_get_reply_t
Definition: lisp_gpe.api:123
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
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
a
a
Definition: bitmap.h:525
LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE
@ LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE
Definition: lisp_gpe_fwd_entry.h:56
lisp_gpe_tenant_l3_iface_add_or_lock
u32 lisp_gpe_tenant_l3_iface_add_or_lock(u32 vni, u32 table_id, u8 with_default_route)
Add/create and lock a new or find and lock the existing L3 interface for the tenant.
Definition: lisp_gpe_tenant.c:110
lisp_gpe_tunnel_t_
A LISP GPE Tunnel.
Definition: lisp_gpe_tunnel.h:48
vl_api_gpe_fwd_entries_get_reply_t::entries
vl_api_gpe_fwd_entry_t entries[count]
Definition: lisp_gpe.api:128
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
i
int i
Definition: flowhash_template.h:376
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
lisp_api_gpe_fwd_entry_t
Definition: lisp_gpe.h:284
vl_api_gpe_fwd_entries_get_reply_t::count
u32 count
Definition: lisp_gpe.api:127
gpe_api_hookup
static clib_error_t * gpe_api_hookup(vlib_main_t *vm)
Definition: lisp_gpe_api.c:488
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
lisp_gpe_tenant_l2_iface_add_or_lock
u32 lisp_gpe_tenant_l2_iface_add_or_lock(u32 vni, u32 bd_id)
Add/create and lock a new or find and lock the existing L2 interface for the tenant.
Definition: lisp_gpe_tenant.c:182
lisp_gpe_adjacency_t_::tunnel_index
u32 tunnel_index
The index of the LISP GPE tunnel that provides the transport in the underlay.
Definition: lisp_gpe_adjacency.h:80
lisp_gpe_fwd_entry.h
LISP-GPE definitions.
vl_api_gpe_add_del_iface_t::dp_table
u32 dp_table
Definition: lisp_gpe.api:88
rv
int __clib_unused rv
Definition: application.c:491
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
vl_api_gpe_add_del_iface_t::is_add
bool is_add[default=true]
Definition: lisp_gpe.api:86
vl_api_gpe_fwd_entry_vnis_get_reply_t
Definition: lisp_gpe.api:98
vnet.h
api_errno.h
vl_api_gpe_get_encap_mode_t
get GPE encapsulation mode
Definition: lisp_gpe.api:162
lisp_api_gpe_fwd_entry_t::reid
dp_address_t reid
Definition: lisp_gpe.h:291
fid_addr_mac
#define fid_addr_mac(_a)
Definition: lisp_types.h:85
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
vl_api_gpe_add_del_native_fwd_rpath_t_handler
static void vl_api_gpe_add_del_native_fwd_rpath_t_handler(vl_api_gpe_add_del_native_fwd_rpath_t *mp)
Definition: lisp_gpe_api.c:378
gpe_fwd_entries_get_reply_t_host_to_net
static void gpe_fwd_entries_get_reply_t_host_to_net(vl_api_gpe_fwd_entries_get_reply_t *mp)
Definition: lisp_gpe_api.c:191
gpe_entry_t_host_to_net
static void gpe_entry_t_host_to_net(vl_api_gpe_fwd_entry_t *e)
Definition: lisp_gpe_api.c:182
ip_types_api.h
lisp_gpe_fwd_entry_t_::type
lisp_gpe_fwd_entry_type_t type
The forwarding entry type.
Definition: lisp_gpe_fwd_entry.h:96
vl_api_gpe_native_fwd_rpaths_get_reply_t::entries
vl_api_gpe_native_fwd_rpath_t entries[count]
Definition: lisp_gpe.api:230
vl_api_gpe_add_del_fwd_entry_t::loc_num
u32 loc_num
Definition: lisp_gpe.api:54
vl_api_gpe_fwd_entry_path_dump_t
Definition: lisp_gpe.api:131
vl_api_gpe_add_del_iface_t_handler
static void vl_api_gpe_add_del_iface_t_handler(vl_api_gpe_add_del_iface_t *mp)
Definition: lisp_gpe_api.c:319
EID_TYPE_API_MAC
@ EID_TYPE_API_MAC
Definition: lisp_types.api:40
vl_api_gpe_fwd_entry_path_dump_t::fwd_entry_index
u32 fwd_entry_index
Definition: lisp_gpe.api:135
gpe_base_msg_id
static u32 gpe_base_msg_id
Base message ID fot the plugin.
Definition: lisp_gpe_api.c:43
hash_pair_t
Definition: hash.h:159
vl_api_gpe_add_del_fwd_entry_t::dp_table
u32 dp_table
Definition: lisp_gpe.api:52
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_gpe_add_del_iface_t::vni
u32 vni
Definition: lisp_gpe.api:89