FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
lisp_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * lisp_api.c - lisp 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 <vnet/lisp-cp/control.h>
26 #include <vnet/lisp-gpe/lisp_gpe.h>
27 
28 #include <vnet/vnet_msg_enum.h>
29 
30 #define vl_api_remote_locator_t_endian vl_noop_handler
31 #define vl_api_remote_locator_t_print vl_noop_handler
32 #define vl_api_local_locator_t_endian vl_noop_handler
33 #define vl_api_local_locator_t_print vl_noop_handler
34 
35 #define vl_api_lisp_add_del_locator_set_t_endian vl_noop_handler
36 #define vl_api_lisp_add_del_locator_set_t_print vl_noop_handler
37 #define vl_api_lisp_add_del_remote_mapping_t_endian vl_noop_handler
38 #define vl_api_lisp_add_del_remote_mapping_t_print vl_noop_handler
39 
40 #define vl_api_one_add_del_locator_set_t_endian vl_noop_handler
41 #define vl_api_one_add_del_locator_set_t_print vl_noop_handler
42 #define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler
43 #define vl_api_one_add_del_remote_mapping_t_print vl_noop_handler
44 
45 #define vl_typedefs /* define message structures */
46 #include <vnet/vnet_all_api_h.h>
47 #undef vl_typedefs
48 
49 #define vl_endianfun /* define message structures */
50 #include <vnet/vnet_all_api_h.h>
51 #undef vl_endianfun
52 
53 /* instantiate all the print functions we know about */
54 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
55 #define vl_printfun
56 #include <vnet/vnet_all_api_h.h>
57 #undef vl_printfun
58 
60 
61 #define foreach_vpe_api_msg \
62 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
63 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
64 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
65 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
66 _(LISP_ADD_DEL_MAP_SERVER, lisp_add_del_map_server) \
67 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
68 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
69 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
70 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
71 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
72 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
73 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
74 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
75 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
76 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
77 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
78 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
79 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
80 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
81 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
82 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
83 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
84 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
85 _(SHOW_LISP_STATUS, show_lisp_status) \
86 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
87  lisp_add_del_map_request_itr_rlocs) \
88 _(LISP_GET_MAP_REQUEST_ITR_RLOCS, lisp_get_map_request_itr_rlocs) \
89 _(SHOW_LISP_PITR, show_lisp_pitr) \
90 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
91 _(LISP_USE_PETR, lisp_use_petr) \
92 _(SHOW_LISP_USE_PETR, show_lisp_use_petr) \
93 
94 static locator_t *
96 {
97  u32 i;
98  locator_t *locs = 0, loc;
100 
101  for (i = 0; i < rloc_num; i++)
102  {
103  /* remote locators */
104  r = &rmt_locs[i];
105  clib_memset (&loc, 0, sizeof (loc));
106  gid_address_ip_set (&loc.address, &r->addr,
107  r->is_ip4 ? AF_IP4 : AF_IP6);
108 
109  loc.priority = r->priority;
110  loc.weight = r->weight;
111 
112  vec_add1 (locs, loc);
113  }
114  return locs;
115 }
116 
117 static void
119  mp)
120 {
122  int rv = 0;
124  locator_t locator;
125  vl_api_local_locator_t *ls_loc;
126  u32 ls_index = ~0, locator_num;
127  u8 *locator_name = NULL;
128  int i;
129 
130  clib_memset (a, 0, sizeof (a[0]));
131 
132  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
133  locator_name = format (0, "%s", mp->locator_set_name);
134  vec_terminate_c_string (locator_name);
135 
136  a->name = locator_name;
137  a->is_add = mp->is_add;
138  a->local = 1;
139  locator_num = clib_net_to_host_u32 (mp->locator_num);
140 
141  clib_memset (&locator, 0, sizeof (locator));
142  for (i = 0; i < locator_num; i++)
143  {
144  ls_loc = &mp->locators[i];
145  VALIDATE_SW_IF_INDEX (ls_loc);
146 
147  locator.sw_if_index = htonl (ls_loc->sw_if_index);
148  locator.priority = ls_loc->priority;
149  locator.weight = ls_loc->weight;
150  locator.local = 1;
151  vec_add1 (a->locators, locator);
152  }
153 
154  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
155 
157 
158  vec_free (locator_name);
159  vec_free (a->locators);
160 
161  /* *INDENT-OFF* */
162  REPLY_MACRO2 (VL_API_LISP_ADD_DEL_LOCATOR_SET_REPLY,
163  ({
164  rmp->ls_index = clib_host_to_net_u32 (ls_index);
165  }));
166  /* *INDENT-ON* */
167 }
168 
169 static void
171 {
172  vl_api_lisp_add_del_locator_reply_t *rmp;
173  int rv = 0;
174  locator_t locator, *locators = NULL;
176  u32 ls_index = ~0;
177  u8 *locator_name = NULL;
178 
179  clib_memset (&locator, 0, sizeof (locator));
180  clib_memset (a, 0, sizeof (a[0]));
181 
182  locator.sw_if_index = ntohl (mp->sw_if_index);
183  locator.priority = mp->priority;
184  locator.weight = mp->weight;
185  locator.local = 1;
186  vec_add1 (locators, locator);
187 
188  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
189  locator_name = format (0, "%s", mp->locator_set_name);
190  vec_terminate_c_string (locator_name);
191 
192  a->name = locator_name;
193  a->locators = locators;
194  a->is_add = mp->is_add;
195  a->local = 1;
196 
197  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
198 
199  vec_free (locators);
200  vec_free (locator_name);
201 
202  REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCATOR_REPLY);
203 }
204 
205 static int
207  u8 len)
208 {
209  switch (type)
210  {
211  case 0: /* ipv4 */
213  gid_address_ip_set (dst, src, AF_IP4);
214  gid_address_ippref_len (dst) = len;
216  break;
217  case 1: /* ipv6 */
219  gid_address_ip_set (dst, src, AF_IP6);
220  gid_address_ippref_len (dst) = len;
222  break;
223  case 2: /* l2 mac */
225  clib_memcpy (&gid_address_mac (dst), src, 6);
226  break;
227  default:
228  /* unknown type */
229  return VNET_API_ERROR_INVALID_VALUE;
230  }
231 
232  gid_address_vni (dst) = vni;
233 
234  return 0;
235 }
236 
237 static void
239 {
240  vl_api_lisp_add_del_local_eid_reply_t *rmp;
242  int rv = 0;
243  gid_address_t _eid, *eid = &_eid;
244  uword *p = NULL;
245  u32 locator_set_index = ~0, map_index = ~0;
247  u8 *name = NULL, *key = NULL;
248  clib_memset (a, 0, sizeof (a[0]));
249  clib_memset (eid, 0, sizeof (eid[0]));
250 
251  rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
252  mp->eid_type, mp->eid, mp->prefix_len);
253  if (rv)
254  goto out;
255 
256  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
257  name = format (0, "%s", mp->locator_set_name);
258  vec_terminate_c_string (name);
259  p = hash_get_mem (lcm->locator_set_index_by_name, name);
260  if (!p)
261  {
262  rv = VNET_API_ERROR_INVALID_VALUE;
263  goto out;
264  }
265  locator_set_index = p[0];
266 
267  if (*mp->key)
268  key = format (0, "%s", mp->key);
269 
270  /* XXX treat batch configuration */
271  a->is_add = mp->is_add;
272  gid_address_copy (&a->eid, eid);
273  a->locator_set_index = locator_set_index;
274  a->local = 1;
275  a->key = key;
276  a->key_id = clib_net_to_host_u16 (mp->key_id);
277 
278  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
279 
280 out:
281  vec_free (name);
282  vec_free (key);
283  gid_address_free (&a->eid);
284 
285  REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY);
286 }
287 
288 static void
291 {
292  vl_api_lisp_eid_table_add_del_map_reply_t *rmp;
293  int rv = 0;
294  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
295  clib_net_to_host_u32 (mp->dp_table),
296  mp->is_l2, mp->is_add);
297 REPLY_MACRO (VL_API_LISP_EID_TABLE_ADD_DEL_MAP_REPLY)}
298 
299 static void
301  * mp)
302 {
303  vl_api_lisp_add_del_map_server_reply_t *rmp;
304  int rv = 0;
306 
307  clib_memset (&addr, 0, sizeof (addr));
308 
309  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? AF_IP6 : AF_IP4);
310  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
311 
312  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY);
313 }
314 
315 static void
317  * mp)
318 {
319  vl_api_lisp_add_del_map_resolver_reply_t *rmp;
320  int rv = 0;
322 
323  clib_memset (a, 0, sizeof (a[0]));
324 
325  a->is_add = mp->is_add;
327 
329 
330  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_RESOLVER_REPLY);
331 }
332 
333 static void
336 {
337  vl_api_lisp_map_register_enable_disable_reply_t *rmp;
338  int rv = 0;
339 
341  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
342 }
343 
344 static void
347 {
348  vl_api_lisp_rloc_probe_enable_disable_reply_t *rmp;
349  int rv = 0;
350 
352  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
353 }
354 
355 static void
357 {
358  vl_api_lisp_enable_disable_reply_t *rmp;
359  int rv = 0;
360 
362  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
363 }
364 
365 static void
368 {
369  int rv = 0;
371 
372  /* *INDENT-OFF* */
373  REPLY_MACRO2(VL_API_SHOW_LISP_MAP_REQUEST_MODE_REPLY,
374  ({
376  }));
377  /* *INDENT-ON* */
378 }
379 
380 static void
382 {
383  vl_api_lisp_map_request_mode_reply_t *rmp;
384  int rv = 0;
385 
387 
388  REPLY_MACRO (VL_API_LISP_MAP_REQUEST_MODE_REPLY);
389 }
390 
391 static void
393  * mp)
394 {
395  vl_api_lisp_pitr_set_locator_set_reply_t *rmp;
396  int rv = 0;
397  u8 *ls_name = 0;
398 
399  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
400  ls_name = format (0, "%s", mp->ls_name);
401  vec_terminate_c_string (ls_name);
402  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
403  vec_free (ls_name);
404 
405  REPLY_MACRO (VL_API_LISP_PITR_SET_LOCATOR_SET_REPLY);
406 }
407 
408 static void
410 {
411  vl_api_lisp_use_petr_reply_t *rmp;
412  int rv = 0;
414 
415  ip_address_set (&addr, &mp->address, mp->is_ip4 ? AF_IP4 : AF_IP6);
416  rv = vnet_lisp_use_petr (&addr, mp->is_add);
417 
418  REPLY_MACRO (VL_API_LISP_USE_PETR_REPLY);
419 }
420 
421 static void
423 {
426  mapping_t *m;
427  locator_set_t *ls = 0;
428  int rv = 0;
429  locator_t *loc = 0;
430  u8 status = 0;
432 
433  clib_memset (&addr, 0, sizeof (addr));
434  status = lcm->flags & LISP_FLAG_USE_PETR;
435  if (status)
436  {
438  if (~0 != m->locator_set_index)
439  {
440  ls =
442  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
443  gid_address_copy (&addr, &loc->address);
444  }
445  }
446 
447  /* *INDENT-OFF* */
448  REPLY_MACRO2 (VL_API_SHOW_LISP_USE_PETR_REPLY,
449  {
450  rmp->status = status;
451  ip_address_t *ip = &gid_address_ip (&addr);
452  switch (ip_addr_version (ip))
453  {
454  case AF_IP4:
455  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
456  sizeof (ip_addr_v4 (ip)));
457  break;
458 
459  case AF_IP6:
460  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
461  sizeof (ip_addr_v6 (ip)));
462  break;
463 
464  default:
465  ASSERT (0);
466  }
467  rmp->is_ip4 = (gid_address_ip_version (&addr) == AF_IP4);
468  });
469  /* *INDENT-ON* */
470 }
471 
472 static void
475 {
476  vl_api_lisp_add_del_map_request_itr_rlocs_reply_t *rmp;
477  int rv = 0;
478  u8 *locator_set_name = NULL;
480 
481  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
482  locator_set_name = format (0, "%s", mp->locator_set_name);
483  vec_terminate_c_string (locator_set_name);
484 
485  a->is_add = mp->is_add;
486  a->locator_set_name = locator_set_name;
487 
489 
490  vec_free (locator_set_name);
491 
492  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
493 }
494 
495 static void
498 {
499  locator_t *rlocs = 0;
500  vl_api_lisp_add_del_remote_mapping_reply_t *rmp;
501  int rv = 0;
502  gid_address_t _eid, *eid = &_eid;
503  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
504 
505  clib_memset (eid, 0, sizeof (eid[0]));
506 
507  rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
508  mp->eid_type, mp->eid, mp->eid_len);
509  if (rv)
510  goto send_reply;
511 
512  rlocs = unformat_lisp_locs (mp->rlocs, rloc_num);
513 
514  if (!mp->is_add)
515  {
517  clib_memset (a, 0, sizeof (*a));
518  gid_address_copy (&a->reid, eid);
519  a->is_add = 0;
521  if (rv)
522  {
523  goto out;
524  }
525  }
526 
527  /* NOTE: for now this works as a static remote mapping, i.e.,
528  * not authoritative and ttl infinite. */
529  if (mp->is_add)
530  {
531  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
532  clib_memset (m_args, 0, sizeof (m_args[0]));
533  gid_address_copy (&m_args->eid, eid);
534  m_args->action = mp->action;
535  m_args->is_static = 1;
536  m_args->ttl = ~0;
537  m_args->authoritative = 0;
538  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
539  }
540  else
541  {
542  rv = vnet_lisp_del_mapping (eid, NULL);
543  }
544 
545  if (mp->del_all)
547 
548 out:
549  vec_free (rlocs);
550 send_reply:
551  REPLY_MACRO (VL_API_LISP_ADD_DEL_REMOTE_MAPPING_REPLY);
552 }
553 
554 static void
556 {
557  vl_api_lisp_add_del_adjacency_reply_t *rmp;
559 
560  int rv = 0;
561  clib_memset (a, 0, sizeof (a[0]));
562 
563  rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
564  mp->eid_type, mp->leid, mp->leid_len);
565  rv |= unformat_lisp_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
566  mp->eid_type, mp->reid, mp->reid_len);
567 
568  if (rv)
569  goto send_reply;
570 
571  a->is_add = mp->is_add;
573 
574 send_reply:
575  REPLY_MACRO (VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
576 }
577 
578 static void
580  locator_t * loc, vl_api_registration_t * reg,
581  u32 context)
582 {
584 
585  rmp = vl_msg_api_alloc (sizeof (*rmp));
586  clib_memset (rmp, 0, sizeof (*rmp));
587  rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
588  rmp->context = context;
589 
590  rmp->local = loc->local;
591  if (loc->local)
592  {
593  rmp->sw_if_index = ntohl (loc->sw_if_index);
594  }
595  else
596  {
597  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
599  }
600  rmp->priority = loc->priority;
601  rmp->weight = loc->weight;
602 
603  vl_api_send_msg (reg, (u8 *) rmp);
604 }
605 
606 static void
608 {
609  u8 *ls_name = 0;
610  vl_api_registration_t *reg = 0;
612  locator_set_t *lsit = 0;
613  locator_t *loc = 0;
614  u32 ls_index = ~0, *locit = 0;
615  uword *p = 0;
616 
618  if (!reg)
619  return;
620 
621  if (mp->is_index_set)
622  ls_index = htonl (mp->ls_index);
623  else
624  {
625  /* make sure we get a proper C-string */
626  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
627  ls_name = format (0, "%s", mp->ls_name);
628  vec_terminate_c_string (ls_name);
629  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
630  if (!p)
631  goto out;
632  ls_index = p[0];
633  }
634 
635  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
636  return;
637 
638  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
639 
640  vec_foreach (locit, lsit->locator_indices)
641  {
642  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
643  send_lisp_locator_details (lcm, loc, reg, mp->context);
644  };
645 out:
646  vec_free (ls_name);
647 }
648 
649 static void
651  locator_set_t * lsit,
653  u32 ls_index)
654 {
656  u8 *str = 0;
657 
658  rmp = vl_msg_api_alloc (sizeof (*rmp));
659  clib_memset (rmp, 0, sizeof (*rmp));
660  rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
661  rmp->context = context;
662 
663  rmp->ls_index = htonl (ls_index);
664  if (lsit->local)
665  {
666  ASSERT (lsit->name != NULL);
667  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
668  vec_len (lsit->name));
669  }
670  else
671  {
672  str = format (0, "<remote-%d>", ls_index);
673  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
674  vec_free (str);
675  }
676 
677  vl_api_send_msg (reg, (u8 *) rmp);
678 }
679 
680 static void
682 {
685  locator_set_t *lsit = NULL;
686  u8 filter;
687 
689  if (!reg)
690  return;
691 
692  filter = mp->filter;
693  /* *INDENT-OFF* */
694  pool_foreach (lsit, lcm->locator_set_pool,
695  ({
696  if (filter && !((1 == filter && lsit->local) ||
697  (2 == filter && !lsit->local)))
698  {
699  continue;
700  }
701  send_lisp_locator_set_details (lcm, lsit, reg, mp->context,
702  lsit - lcm->locator_set_pool);
703  }));
704  /* *INDENT-ON* */
705 }
706 
707 static void
708 lisp_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
709 {
710  ASSERT (prefix_length);
711  ip_prefix_t *ippref = &fid_addr_ippref (src);
712 
713  switch (fid_addr_type (src))
714  {
715  case FID_ADDR_IP_PREF:
716  if (ip_prefix_version (ippref) == AF_IP4)
717  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
718  else
719  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
720  prefix_length[0] = ip_prefix_len (ippref);
721  break;
722 
723  case FID_ADDR_MAC:
724  prefix_length[0] = 0;
725  clib_memcpy (dst, fid_addr_mac (src), 6);
726  break;
727 
728  default:
729  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
730  break;
731  }
732 }
733 
734 static u8
736 {
737  ip_prefix_t *ippref;
738 
739  switch (fid_addr_type (fid))
740  {
741  case FID_ADDR_IP_PREF:
742  ippref = &fid_addr_ippref (fid);
743  if (ip_prefix_version (ippref) == AF_IP4)
744  return 0;
745  else if (ip_prefix_version (ippref) == AF_IP6)
746  return 1;
747  else
748  return ~0;
749 
750  case FID_ADDR_MAC:
751  return 2;
752  case FID_ADDR_NSH:
753  return 3;
754  }
755 
756  return ~0;
757 }
758 
759 static void
762  u8 filter)
763 {
764  fid_address_t *fid;
766  locator_set_t *ls = 0;
768  gid_address_t *gid = NULL;
769  u8 *mac = 0;
770  ip_prefix_t *ip_prefix = NULL;
771 
772  switch (filter)
773  {
774  case 0: /* all mappings */
775  break;
776 
777  case 1: /* local only */
778  if (!mapit->local)
779  return;
780  break;
781  case 2: /* remote only */
782  if (mapit->local)
783  return;
784  break;
785  default:
786  clib_warning ("Filter error, unknown filter: %d", filter);
787  return;
788  }
789 
790  /* don't send PITR generated mapping */
791  if (mapit->pitr_set)
792  return;
793 
794  gid = &mapit->eid;
795  ip_prefix = &gid_address_ippref (gid);
796  mac = gid_address_mac (gid);
797 
798  rmp = vl_msg_api_alloc (sizeof (*rmp));
799  clib_memset (rmp, 0, sizeof (*rmp));
800  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
801 
803  if (vec_len (ls->locator_indices) == 0)
804  rmp->locator_set_index = ~0;
805  else
806  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
807 
808  rmp->is_local = mapit->local;
809  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
810  rmp->action = mapit->action;
811  rmp->authoritative = mapit->authoritative;
812 
813  switch (gid_address_type (gid))
814  {
815  case GID_ADDR_SRC_DST:
816  rmp->is_src_dst = 1;
817  fid = &gid_address_sd_src (gid);
818  rmp->eid_type = fid_type_to_api_type (fid);
820  &rmp->seid_prefix_len);
822  &rmp->eid_prefix_len);
823  break;
824  case GID_ADDR_IP_PREFIX:
825  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
826  if (ip_prefix_version (ip_prefix) == AF_IP4)
827  {
828  rmp->eid_type = 0; /* ipv4 type */
829  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
830  sizeof (ip_prefix_v4 (ip_prefix)));
831  }
832  else
833  {
834  rmp->eid_type = 1; /* ipv6 type */
835  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
836  sizeof (ip_prefix_v6 (ip_prefix)));
837  }
838  break;
839  case GID_ADDR_MAC:
840  rmp->eid_type = 2; /* l2 mac type */
841  clib_memcpy (rmp->eid, mac, 6);
842  break;
843  default:
844  ASSERT (0);
845  }
846  rmp->context = context;
847  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
848  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
849  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
850  vl_api_send_msg (reg, (u8 *) rmp);
851 }
852 
853 static void
855 {
856  u32 mi;
859  mapping_t *mapit = NULL;
860  gid_address_t _eid, *eid = &_eid;
861 
863  if (!reg)
864  return;
865 
866  if (mp->eid_set)
867  {
868  clib_memset (eid, 0, sizeof (*eid));
869 
870  unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
871  mp->eid_type, mp->eid, mp->prefix_length);
872 
874  if ((u32) ~ 0 == mi)
875  return;
876 
877  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
878  send_lisp_eid_table_details (mapit, reg, mp->context,
879  0 /* ignore filter */ );
880  }
881  else
882  {
883  /* *INDENT-OFF* */
884  pool_foreach (mapit, lcm->mapping_pool,
885  ({
886  send_lisp_eid_table_details(mapit, reg, mp->context,
887  mp->filter);
888  }));
889  /* *INDENT-ON* */
890  }
891 }
892 
893 static void
895  u32 context)
896 {
898 
899  rmp = vl_msg_api_alloc (sizeof (*rmp));
900  clib_memset (rmp, 0, sizeof (*rmp));
901  rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
902 
903  switch (ip_addr_version (ip))
904  {
905  case AF_IP4:
906  rmp->is_ipv6 = 0;
907  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
908  sizeof (ip_addr_v4 (ip)));
909  break;
910 
911  case AF_IP6:
912  rmp->is_ipv6 = 1;
913  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
914  sizeof (ip_addr_v6 (ip)));
915  break;
916 
917  default:
918  ASSERT (0);
919  }
920  rmp->context = context;
921 
922  vl_api_send_msg (reg, (u8 *) rmp);
923 }
924 
925 static void
927 {
930  lisp_msmr_t *mr;
931 
933  if (!reg)
934  return;
935 
936  vec_foreach (mr, lcm->map_servers)
937  {
939  }
940 }
941 
942 static void
945 {
947 
948  rmp = vl_msg_api_alloc (sizeof (*rmp));
949  clib_memset (rmp, 0, sizeof (*rmp));
950  rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS);
951 
952  switch (ip_addr_version (ip))
953  {
954  case AF_IP4:
955  rmp->is_ipv6 = 0;
956  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
957  sizeof (ip_addr_v4 (ip)));
958  break;
959 
960  case AF_IP6:
961  rmp->is_ipv6 = 1;
962  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
963  sizeof (ip_addr_v6 (ip)));
964  break;
965 
966  default:
967  ASSERT (0);
968  }
969  rmp->context = context;
970 
971  vl_api_send_msg (reg, (u8 *) rmp);
972 }
973 
974 static void
976 {
979  lisp_msmr_t *mr;
980 
982  if (!reg)
983  return;
984 
985  vec_foreach (mr, lcm->map_resolvers)
986  {
988  }
989 }
990 
991 static void
993  u32 context)
994 {
996 
997  rmp = vl_msg_api_alloc (sizeof (*rmp));
998  clib_memset (rmp, 0, sizeof (*rmp));
999  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
1000 
1001  rmp->vni = clib_host_to_net_u32 (p->key);
1002  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1003  rmp->context = context;
1004  vl_api_send_msg (reg, (u8 *) rmp);
1005 }
1006 
1007 static void
1009  mp)
1010 {
1011  vl_api_registration_t *reg;
1013  hash_pair_t *p;
1014  uword *vni_table = 0;
1015 
1017  if (!reg)
1018  return;
1019 
1020  if (mp->is_l2)
1021  {
1022  vni_table = lcm->bd_id_by_vni;
1023  }
1024  else
1025  {
1026  vni_table = lcm->table_id_by_vni;
1027  }
1028 
1029  /* *INDENT-OFF* */
1030  hash_foreach_pair (p, vni_table,
1031  ({
1032  send_eid_table_map_pair (p, reg, mp->context);
1033  }));
1034  /* *INDENT-ON* */
1035 }
1036 
1037 static void
1039 {
1041 
1042  rmp = vl_msg_api_alloc (sizeof (*rmp));
1043  clib_memset (rmp, 0, sizeof (*rmp));
1044  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
1045  rmp->context = context;
1046  rmp->vni = clib_host_to_net_u32 (vni);
1047  vl_api_send_msg (reg, (u8 *) rmp);
1048 }
1049 
1050 static void
1052 {
1053  lisp_adjacency_t *adj;
1055  u32 i, n = vec_len (adjs);
1056 
1057  for (i = 0; i < n; i++)
1058  {
1059  adj = vec_elt_at_index (adjs, i);
1060  clib_memset (&a, 0, sizeof (a));
1061 
1062  switch (gid_address_type (&adj->reid))
1063  {
1064  case GID_ADDR_IP_PREFIX:
1067  if (gid_address_ip_version (&adj->reid) == AF_IP4)
1068  {
1069  a.eid_type = 0; /* ipv4 type */
1070  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1071  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1072  }
1073  else
1074  {
1075  a.eid_type = 1; /* ipv6 type */
1076  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1077  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1078  }
1079  break;
1080  case GID_ADDR_MAC:
1081  a.eid_type = 2; /* l2 mac type */
1082  mac_copy (a.reid, gid_address_mac (&adj->reid));
1083  mac_copy (a.leid, gid_address_mac (&adj->leid));
1084  break;
1085  default:
1086  ASSERT (0);
1087  }
1088  dst[i] = a;
1089  }
1090 }
1091 
1092 static void
1095 {
1097  int rv = 0;
1098 
1099  /* *INDENT-OFF* */
1100  REPLY_MACRO2 (VL_API_SHOW_LISP_RLOC_PROBE_STATE_REPLY,
1101  {
1103  });
1104  /* *INDENT-ON* */
1105 }
1106 
1107 static void
1110 {
1112  int rv = 0;
1113 
1114  /* *INDENT-OFF* */
1115  REPLY_MACRO2 (VL_API_SHOW_LISP_MAP_REGISTER_STATE_REPLY,
1116  {
1118  });
1119  /* *INDENT-ON* */
1120 }
1121 
1122 static void
1124 {
1126  lisp_adjacency_t *adjs = 0;
1127  int rv = 0;
1128  u32 size = ~0;
1129  u32 vni = clib_net_to_host_u32 (mp->vni);
1130 
1131  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1132  size = vec_len (adjs) * sizeof (vl_api_lisp_adjacency_t);
1133 
1134  /* *INDENT-OFF* */
1135  REPLY_MACRO4 (VL_API_LISP_ADJACENCIES_GET_REPLY, size,
1136  {
1137  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1138  lisp_adjacency_copy (rmp->adjacencies, adjs);
1139  });
1140  /* *INDENT-ON* */
1141 
1142  vec_free (adjs);
1143 }
1144 
1145 static void
1147  mp)
1148 {
1149  hash_pair_t *p;
1150  u32 *vnis = 0;
1151  vl_api_registration_t *reg = 0;
1153 
1155  if (!reg)
1156  return;
1157 
1158  /* *INDENT-OFF* */
1160  ({
1161  hash_set (vnis, p->key, 0);
1162  }));
1163 
1165  ({
1166  hash_set (vnis, p->key, 0);
1167  }));
1168 
1169  hash_foreach_pair (p, vnis,
1170  ({
1171  send_eid_table_vni (p->key, reg, mp->context);
1172  }));
1173  /* *INDENT-ON* */
1174 
1175  hash_free (vnis);
1176 }
1177 
1178 static void
1180 {
1181  vl_api_show_lisp_status_reply_t *rmp = NULL;
1182  int rv = 0;
1183 
1184  /* *INDENT-OFF* */
1185  REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
1186  ({
1189  }));
1190  /* *INDENT-ON* */
1191 }
1192 
1193 static void
1196 {
1199  locator_set_t *loc_set = 0;
1200  u8 *tmp_str = 0;
1201  int rv = 0;
1202 
1203  if (~0 == lcm->mreq_itr_rlocs)
1204  {
1205  tmp_str = format (0, " ");
1206  }
1207  else
1208  {
1209  loc_set =
1211  tmp_str = format (0, "%s", loc_set->name);
1212  }
1213 
1214  /* *INDENT-OFF* */
1215  REPLY_MACRO2(VL_API_LISP_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1216  ({
1217  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1218  ARRAY_LEN(rmp->locator_set_name) - 1);
1219  }));
1220  /* *INDENT-ON* */
1221 
1222  vec_free (tmp_str);
1223 }
1224 
1225 static void
1227 {
1228  vl_api_show_lisp_pitr_reply_t *rmp = NULL;
1230  mapping_t *m;
1231  locator_set_t *ls = 0;
1232  u8 *tmp_str = 0;
1233  int rv = 0;
1234 
1235  u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE)
1236  && lcm->pitr_map_index != ~0;
1237 
1238  if (!is_enabled)
1239  {
1240  tmp_str = format (0, "N/A");
1241  }
1242  else
1243  {
1245  if (~0 != m->locator_set_index)
1246  {
1247  ls =
1249  tmp_str = format (0, "%s", ls->name);
1250  }
1251  else
1252  {
1253  tmp_str = format (0, "N/A");
1254  }
1255  }
1256  vec_add1 (tmp_str, 0);
1257 
1258  /* *INDENT-OFF* */
1259  REPLY_MACRO2(VL_API_SHOW_LISP_PITR_REPLY,
1260  ({
1261  rmp->status = lcm->flags & LISP_FLAG_PITR_MODE;
1262  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1263  ARRAY_LEN(rmp->locator_set_name) - 1);
1264  }));
1265  /* *INDENT-ON* */
1266 }
1267 
1268 /*
1269  * lisp_api_hookup
1270  * Add vpe's API message handlers to the table.
1271  * vlib has already mapped shared memory and
1272  * added the client registration handlers.
1273  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1274  */
1275 #define vl_msg_name_crc_list
1276 #include <vnet/vnet_all_api_h.h>
1277 #undef vl_msg_name_crc_list
1278 
1279 static void
1281 {
1282 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1283  foreach_vl_msg_name_crc_lisp;
1284 #undef _
1285 }
1286 
1287 static clib_error_t *
1289 {
1290  api_main_t *am = &api_main;
1291 
1292 #define _(N,n) \
1293  vl_msg_api_set_handlers(VL_API_##N, #n, \
1294  vl_api_##n##_t_handler, \
1295  vl_noop_handler, \
1296  vl_api_##n##_t_endian, \
1297  vl_api_##n##_t_print, \
1298  sizeof(vl_api_##n##_t), 1);
1300 #undef _
1301 
1302  /*
1303  * Set up the (msg_name, crc, message-id) table
1304  */
1306 
1307  return 0;
1308 }
1309 
1311 
1312 /*
1313  * fd.io coding-style-patch-verification: ON
1314  *
1315  * Local Variables:
1316  * eval: (c-set-style "gnu")
1317  * End:
1318  */
Reply for show_lisp_map_register_state.
Definition: lisp.api:266
static void send_lisp_eid_table_details(mapping_t *mapit, vl_api_registration_t *reg, u32 context, u8 filter)
Definition: lisp_api.c:760
vl_api_local_locator_t locators[locator_num]
Definition: lisp.api:40
#define gid_address_ip_version(_a)
Definition: lisp_types.h:207
static void send_eid_table_map_pair(hash_pair_t *p, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:992
#define ip_addr_v6(_a)
Definition: ip_types.h:51
u32 pitr_map_index
Definition: control.h:250
gid_address_t leid
Definition: control.h:73
LISP locator_set status.
Definition: lisp.api:437
enable/disable LISP RLOC probing
Definition: lisp.api:233
#define gid_address_type(_a)
Definition: lisp_types.h:203
vl_api_mac_address_t mac
Definition: l2.api:490
static u8 fid_type_to_api_type(fid_address_t *fid)
Definition: lisp_api.c:735
a
Definition: bitmap.h:538
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
Definition: lisp_gpe.c:184
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: ip_types.c:152
static void vl_api_lisp_get_map_request_itr_rlocs_t_handler(vl_api_lisp_get_map_request_itr_rlocs_t *mp)
Definition: lisp_api.c:1195
lisp_msmr_t * map_resolvers
Definition: control.h:220
VLIB_API_INIT_FUNCTION(lisp_api_hookup)
configure or disable LISP PITR node
Definition: lisp.api:157
Reply for locator_set add/del.
Definition: lisp.api:48
#define REPLY_MACRO4(t, n, body)
LISP map resolver status.
Definition: lisp.api:642
vl_api_lisp_adjacency_t adjacencies[count]
Definition: lisp.api:580
uword * table_id_by_vni
Definition: control.h:239
#define REPLY_MACRO2(t, body)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void lisp_adjacency_copy(vl_api_lisp_adjacency_t *dst, lisp_adjacency_t *adjs)
Definition: lisp_api.c:1051
locator_t * locator_pool
Definition: control.h:177
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
static void send_lisp_map_resolver_details(ip_address_t *ip, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:943
u8 vnet_lisp_get_map_request_mode(void)
Definition: control.c:57
static void vl_api_lisp_add_del_map_server_t_handler(vl_api_lisp_add_del_map_server_t *mp)
Definition: lisp_api.c:300
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Definition: vec.h:1018
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
LISP locator_set status.
Definition: lisp.api:453
vl_api_address_t src
Definition: gre.api:51
int i
Request for lisp_eid_table_map_details.
Definition: lisp.api:611
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
configure or disable use of PETR
Definition: lisp.api:172
static void vl_api_lisp_pitr_set_locator_set_t_handler(vl_api_lisp_pitr_set_locator_set_t *mp)
Definition: lisp_api.c:392
Request for LISP PETR status.
Definition: lisp.api:185
static void send_lisp_locator_details(lisp_cp_main_t *lcm, locator_t *loc, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:579
static void vl_api_lisp_eid_table_add_del_map_t_handler(vl_api_lisp_eid_table_add_del_map_t *mp)
Definition: lisp_api.c:290
#define ip_prefix_v6(_a)
Definition: ip_types.h:78
static void vl_api_lisp_add_del_locator_set_t_handler(vl_api_lisp_add_del_locator_set_t *mp)
Definition: lisp_api.c:118
ip_address_t address
Definition: control.h:88
int vnet_lisp_add_mapping(vnet_lisp_add_del_mapping_args_t *a, locator_t *rlocs, u32 *res_map_index, u8 *is_updated)
Adds/updates mapping.
Definition: control.c:1265
static void vl_api_lisp_locator_dump_t_handler(vl_api_lisp_locator_dump_t *mp)
Definition: lisp_api.c:607
#define ip_prefix_v4(_a)
Definition: ip_types.h:77
#define ip_addr_version(_a)
Definition: ip_types.h:52
void * vl_msg_api_alloc(int nbytes)
vhost_vring_addr_t addr
Definition: vhost_user.h:147
LISP adjacency.
Definition: lisp.api:562
unsigned char u8
Definition: types.h:56
#define fid_addr_mac(_a)
Definition: lisp_types.h:85
u8 vnet_lisp_map_register_state_get(void)
Definition: control.c:409
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1545
Reply for show_lisp_map_request_mode.
Definition: lisp.api:303
int vnet_lisp_add_del_adjacency(vnet_lisp_add_del_adjacency_args_t *a)
Adds adjacency or removes forwarding entry associated to remote mapping.
Definition: control.c:1474
Request for map resolver summary status.
Definition: lisp.api:653
static void vl_api_lisp_map_register_enable_disable_t_handler(vl_api_lisp_map_register_enable_disable_t *mp)
Definition: lisp_api.c:335
uword value[0]
Definition: hash.h:165
#define clib_memcpy(d, s, n)
Definition: string.h:180
lisp_msmr_t * map_servers
Definition: control.h:223
add or delete LISP adjacency adjacency
Definition: lisp.api:365
#define foreach_vpe_api_msg
Definition: lisp_api.c:61
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:493
static void vl_api_lisp_rloc_probe_enable_disable_t_handler(vl_api_lisp_rloc_probe_enable_disable_t *mp)
Definition: lisp_api.c:346
static void vl_api_lisp_add_del_remote_mapping_t_handler(vl_api_lisp_add_del_remote_mapping_t *mp)
Definition: lisp_api.c:497
u8 * key
Definition: lisp_types.h:315
#define gid_address_sd_src(_a)
Definition: lisp_types.h:220
static void vl_api_show_lisp_map_register_state_t_handler(vl_api_show_lisp_map_register_state_t *mp)
Definition: lisp_api.c:1109
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void vl_api_lisp_adjacencies_get_t_handler(vl_api_lisp_adjacencies_get_t *mp)
Definition: lisp_api.c:1123
void ip_prefix_normalize(ip_prefix_t *a)
Definition: ip_types.c:232
Get LISP map request itr rlocs status.
Definition: lisp.api:707
Reply for show_lisp_rloc_probe_state.
Definition: lisp.api:221
add or delete map request itr rlocs
Definition: lisp.api:384
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:1065
unsigned int u32
Definition: types.h:88
uword * bd_id_by_vni
Definition: control.h:243
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:304
u32 petr_map_index
Proxy ETR map index used for &#39;use-petr&#39;.
Definition: control.h:254
void ip_address_copy_addr(void *dst, const ip_address_t *src)
Definition: ip_types.c:131
static void vl_api_lisp_use_petr_t_handler(vl_api_lisp_use_petr_t *mp)
Definition: lisp_api.c:409
vl_api_fib_path_type_t type
Definition: fib_types.api:123
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:2241
static void vl_api_show_lisp_pitr_t_handler(vl_api_show_lisp_pitr_t *mp)
Definition: lisp_api.c:1226
Get state of LISP map-register.
Definition: lisp.api:256
Get state of LISP RLOC probing.
Definition: lisp.api:210
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1617
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:416
uword size
#define gid_address_mac(_a)
Definition: lisp_types.h:209
set LISP map-request mode.
Definition: lisp.api:281
int vnet_lisp_add_del_local_mapping(vnet_lisp_add_del_mapping_args_t *a, u32 *map_index_result)
Add/update/delete mapping to/in/from map-cache.
Definition: control.c:870
Request for LISP adjacencies.
Definition: lisp.api:588
#define hash_free(h)
Definition: hash.h:310
void gid_address_free(gid_address_t *a)
Definition: lisp_types.c:733
u8 authoritative
Definition: lisp_types.h:305
add or delete lisp eid-table
Definition: lisp.api:93
LISP adjacency reply.
Definition: lisp.api:575
#define REPLY_MACRO(t)
static void vl_api_lisp_map_server_dump_t_handler(vl_api_lisp_map_server_dump_t *mp)
Definition: lisp_api.c:926
static void vl_api_lisp_add_del_adjacency_t_handler(vl_api_lisp_add_del_adjacency_t *mp)
Definition: lisp_api.c:555
vl_api_address_t dst
Definition: gre.api:52
u8 name[64]
Definition: memclnt.api:152
#define gid_address_ippref(_a)
Definition: lisp_types.h:204
LISP PETR status, enable or disable.
Definition: lisp.api:197
u8 len
Definition: ip_types.api:90
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:203
lisp_adjacency_t * vnet_lisp_adjacencies_get_by_vni(u32 vni)
Returns vector of adjacencies.
Definition: control.c:612
An API client registration, only in vpp/vlib.
Definition: api_common.h:46
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:266
Request for lisp-gpe protocol status.
Definition: lisp.api:684
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
Definition: control.c:2376
enable or disable LISP feature
Definition: lisp.api:144
vlib_main_t * vm
Definition: buffer.c:323
Shows relationship between vni and vrf/bd.
Definition: lisp.api:599
void gid_address_ip_set(gid_address_t *dst, void *src, u8 version)
Definition: lisp_types.c:1268
static void vl_api_show_lisp_status_t_handler(vl_api_show_lisp_status_t *mp)
Definition: lisp_api.c:1179
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:341
#define gid_address_ippref_len(_a)
Definition: lisp_types.h:205
#define clib_warning(format, args...)
Definition: error.h:59
u32 locator_set_index
Definition: lisp_types.h:298
static void vl_api_lisp_locator_set_dump_t_handler(vl_api_lisp_locator_set_dump_t *mp)
Definition: lisp_api.c:681
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:2175
add or delete map-resolver
Definition: lisp.api:130
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:283
#define ARRAY_LEN(x)
Definition: clib.h:63
lisp_key_type_t key_id
Definition: lisp_types.h:316
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:57
Request for map lisp locator status.
Definition: lisp.api:421
#define fid_addr_ippref(_a)
Definition: lisp_types.h:82
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2306
struct _gid_address_t gid_address_t
Dump lisp eid-table.
Definition: lisp.api:502
static clib_error_t * lisp_api_hookup(vlib_main_t *vm)
Definition: lisp_api.c:1288
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:666
#define ASSERT(truth)
#define fid_addr_type(_a)
Definition: lisp_types.h:87
#define ip_addr_v4(_a)
Definition: ip_types.h:50
Request for eid table summary status.
Definition: lisp.api:540
enable/disable LISP map-register
Definition: lisp.api:245
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1423
Request for locator_set summary status.
Definition: lisp.api:469
#define gid_address_sd_dst(_a)
Definition: lisp_types.h:221
static void vl_api_show_lisp_use_petr_t_handler(vl_api_show_lisp_use_petr_t *mp)
Definition: lisp_api.c:422
Reply for lisp_add_del_map_request_itr_rlocs.
Definition: lisp.api:404
static void send_lisp_map_server_details(ip_address_t *ip, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:894
gid_dictionary_t mapping_index_by_gid
Definition: control.h:168
locator_set_t * locator_set_pool
Definition: control.h:180
Status of lisp pitr, enable or disable.
Definition: lisp.api:737
static void vl_api_lisp_map_resolver_dump_t_handler(vl_api_lisp_map_resolver_dump_t *mp)
Definition: lisp_api.c:975
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:2166
add or delete locator_set
Definition: lisp.api:33
vl_api_remote_locator_t rlocs[rloc_num]
Definition: lisp.api:350
static void lisp_fid_put_api(u8 *dst, fid_address_t *src, u8 *prefix_length)
Definition: lisp_api.c:708
static void vl_api_lisp_add_del_map_request_itr_rlocs_t_handler(vl_api_lisp_add_del_map_request_itr_rlocs_t *mp)
Definition: lisp_api.c:474
u64 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
static void vl_api_lisp_add_del_local_eid_t_handler(vl_api_lisp_add_del_local_eid_t *mp)
Definition: lisp_api.c:238
int vnet_lisp_add_del_locator_set(vnet_lisp_add_del_locator_set_args_t *a, u32 *ls_result)
Definition: control.c:2031
#define gid_address_ip(_a)
Definition: lisp_types.h:206
Status of lisp, enable or disable.
Definition: lisp.api:695
#define gid_address_vni(_a)
Definition: lisp_types.h:213
Request for map server summary status.
Definition: lisp.api:674
static void vl_api_lisp_eid_table_dump_t_handler(vl_api_lisp_eid_table_dump_t *mp)
Definition: lisp_api.c:854
static void vl_api_show_lisp_map_request_mode_t_handler(vl_api_show_lisp_map_request_mode_t *mp)
Definition: lisp_api.c:367
vl_api_address_t ip
Definition: l2.api:489
static locator_t * unformat_lisp_locs(vl_api_remote_locator_t *rmt_locs, u32 rloc_num)
Definition: lisp_api.c:95
static void send_eid_table_vni(u32 vni, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:1038
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
Definition: hash.h:373
static void send_lisp_locator_set_details(lisp_cp_main_t *lcm, locator_set_t *lsit, vl_api_registration_t *reg, u32 context, u32 ls_index)
Definition: lisp_api.c:650
add or delete locator for locator_set
Definition: lisp.api:64
u64 uword
Definition: types.h:112
int vnet_lisp_del_mapping(gid_address_t *eid, u32 *res_map_index)
Removes a mapping.
Definition: control.c:1374
int vnet_lisp_add_del_locator(vnet_lisp_add_del_locator_set_args_t *a, locator_set_t *ls, u32 *ls_result)
Definition: control.c:1927
typedef key
Definition: ipsec.api:247
#define ip_prefix_len(_a)
Definition: ip_types.h:76
mapping_t * mapping_pool
Definition: control.h:171
u32 vni
Definition: vxlan_gbp.api:42
uword * locator_set_index_by_name
Definition: control.h:186
add or delete remote static mapping
Definition: lisp.api:335
static void setup_message_id_table(api_main_t *am)
Definition: lisp_api.c:1280
static void vl_api_lisp_map_request_mode_t_handler(vl_api_lisp_map_request_mode_t *mp)
Definition: lisp_api.c:381
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
Definition: lisp_types.c:1203
#define ip_prefix_version(_a)
Definition: ip_types.h:75
gid_address_t eid
Definition: lisp_types.h:293
gid_address_t reid
Definition: control.h:74
gid_address_t address
Definition: lisp_types.h:267
#define hash_get_mem(h, key)
Definition: hash.h:269
void mac_copy(void *dst, void *src)
Definition: lisp_types.c:783
LISP map server details.
Definition: lisp.api:663
static void vl_api_lisp_enable_disable_t_handler(vl_api_lisp_enable_disable_t *mp)
Definition: lisp_api.c:356
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:2313
static void vl_api_lisp_eid_table_vni_dump_t_handler(vl_api_lisp_eid_table_vni_dump_t *mp)
Definition: lisp_api.c:1146
#define vec_foreach(var, vec)
Vector iterator.
Dumps all VNIs used in mappings.
Definition: lisp.api:622
Request for map request itr rlocs summary status.
Definition: lisp.api:715
static void vl_api_lisp_add_del_locator_t_handler(vl_api_lisp_add_del_locator_t *mp)
Definition: lisp_api.c:170
Request for LISP map-request mode.
Definition: lisp.api:292
static int unformat_lisp_eid_api(gid_address_t *dst, u32 vni, u8 type, void *src, u8 len)
Definition: lisp_api.c:206
static void vl_api_show_lisp_rloc_probe_state_t_handler(vl_api_show_lisp_rloc_probe_state_t *mp)
Definition: lisp_api.c:1094
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1684
u32 context
Definition: gre.api:45
api_main_t api_main
Definition: api_shared.c:35
reply to lisp_eid_table_vni_dump
Definition: lisp.api:632
u32 mreq_itr_rlocs
Definition: control.h:236
u32 * locator_indices
Definition: lisp_types.h:287
uword key
Definition: hash.h:162
LISP-GPE definitions.
static void vl_api_lisp_eid_table_map_dump_t_handler(vl_api_lisp_eid_table_map_dump_t *mp)
Definition: lisp_api.c:1008
Request for lisp pitr status.
Definition: lisp.api:726
Add/delete map server.
Definition: lisp.api:114
#define VALIDATE_SW_IF_INDEX(mp)
static void vl_api_lisp_add_del_map_resolver_t_handler(vl_api_lisp_add_del_map_resolver_t *mp)
Definition: lisp_api.c:316