FD.io VPP  v18.07.1-19-g511ce25
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  memset (&loc, 0, sizeof (loc));
106  gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
107 
108  loc.priority = r->priority;
109  loc.weight = r->weight;
110 
111  vec_add1 (locs, loc);
112  }
113  return locs;
114 }
115 
116 static void
118  mp)
119 {
121  int rv = 0;
123  locator_t locator;
124  vl_api_local_locator_t *ls_loc;
125  u32 ls_index = ~0, locator_num;
126  u8 *locator_name = NULL;
127  int i;
128 
129  memset (a, 0, sizeof (a[0]));
130 
131  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
132  locator_name = format (0, "%s", mp->locator_set_name);
133  vec_terminate_c_string (locator_name);
134 
135  a->name = locator_name;
136  a->is_add = mp->is_add;
137  a->local = 1;
138  locator_num = clib_net_to_host_u32 (mp->locator_num);
139 
140  memset (&locator, 0, sizeof (locator));
141  for (i = 0; i < locator_num; i++)
142  {
143  ls_loc = &mp->locators[i];
144  VALIDATE_SW_IF_INDEX (ls_loc);
145 
146  locator.sw_if_index = htonl (ls_loc->sw_if_index);
147  locator.priority = ls_loc->priority;
148  locator.weight = ls_loc->weight;
149  locator.local = 1;
150  vec_add1 (a->locators, locator);
151  }
152 
153  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
154 
156 
157  vec_free (locator_name);
158  vec_free (a->locators);
159 
160  /* *INDENT-OFF* */
161  REPLY_MACRO2 (VL_API_LISP_ADD_DEL_LOCATOR_SET_REPLY,
162  ({
163  rmp->ls_index = clib_host_to_net_u32 (ls_index);
164  }));
165  /* *INDENT-ON* */
166 }
167 
168 static void
170 {
171  vl_api_lisp_add_del_locator_reply_t *rmp;
172  int rv = 0;
173  locator_t locator, *locators = NULL;
175  u32 ls_index = ~0;
176  u8 *locator_name = NULL;
177 
178  memset (&locator, 0, sizeof (locator));
179  memset (a, 0, sizeof (a[0]));
180 
181  locator.sw_if_index = ntohl (mp->sw_if_index);
182  locator.priority = mp->priority;
183  locator.weight = mp->weight;
184  locator.local = 1;
185  vec_add1 (locators, locator);
186 
187  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
188  locator_name = format (0, "%s", mp->locator_set_name);
189  vec_terminate_c_string (locator_name);
190 
191  a->name = locator_name;
192  a->locators = locators;
193  a->is_add = mp->is_add;
194  a->local = 1;
195 
196  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
197 
198  vec_free (locators);
199  vec_free (locator_name);
200 
201  REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCATOR_REPLY);
202 }
203 
204 static int
205 unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
206  u8 len)
207 {
208  switch (type)
209  {
210  case 0: /* ipv4 */
212  gid_address_ip_set (dst, src, IP4);
213  gid_address_ippref_len (dst) = len;
215  break;
216  case 1: /* ipv6 */
218  gid_address_ip_set (dst, src, IP6);
219  gid_address_ippref_len (dst) = len;
221  break;
222  case 2: /* l2 mac */
224  clib_memcpy (&gid_address_mac (dst), src, 6);
225  break;
226  default:
227  /* unknown type */
228  return VNET_API_ERROR_INVALID_VALUE;
229  }
230 
231  gid_address_vni (dst) = vni;
232 
233  return 0;
234 }
235 
236 static void
238 {
239  vl_api_lisp_add_del_local_eid_reply_t *rmp;
241  int rv = 0;
242  gid_address_t _eid, *eid = &_eid;
243  uword *p = NULL;
244  u32 locator_set_index = ~0, map_index = ~0;
246  u8 *name = NULL, *key = NULL;
247  memset (a, 0, sizeof (a[0]));
248  memset (eid, 0, sizeof (eid[0]));
249 
250  rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
251  mp->eid_type, mp->eid, mp->prefix_len);
252  if (rv)
253  goto out;
254 
255  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
256  name = format (0, "%s", mp->locator_set_name);
257  vec_terminate_c_string (name);
258  p = hash_get_mem (lcm->locator_set_index_by_name, name);
259  if (!p)
260  {
261  rv = VNET_API_ERROR_INVALID_VALUE;
262  goto out;
263  }
264  locator_set_index = p[0];
265 
266  if (*mp->key)
267  key = format (0, "%s", mp->key);
268 
269  /* XXX treat batch configuration */
270  a->is_add = mp->is_add;
271  gid_address_copy (&a->eid, eid);
272  a->locator_set_index = locator_set_index;
273  a->local = 1;
274  a->key = key;
275  a->key_id = clib_net_to_host_u16 (mp->key_id);
276 
277  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
278 
279 out:
280  vec_free (name);
281  vec_free (key);
282  gid_address_free (&a->eid);
283 
284  REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY);
285 }
286 
287 static void
290 {
291  vl_api_lisp_eid_table_add_del_map_reply_t *rmp;
292  int rv = 0;
293  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
294  clib_net_to_host_u32 (mp->dp_table),
295  mp->is_l2, mp->is_add);
296 REPLY_MACRO (VL_API_LISP_EID_TABLE_ADD_DEL_MAP_REPLY)}
297 
298 static void
300  * mp)
301 {
302  vl_api_lisp_add_del_map_server_reply_t *rmp;
303  int rv = 0;
304  ip_address_t addr;
305 
306  memset (&addr, 0, sizeof (addr));
307 
308  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
309  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
310 
311  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY);
312 }
313 
314 static void
316  * mp)
317 {
318  vl_api_lisp_add_del_map_resolver_reply_t *rmp;
319  int rv = 0;
321 
322  memset (a, 0, sizeof (a[0]));
323 
324  a->is_add = mp->is_add;
325  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
326 
328 
329  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_RESOLVER_REPLY);
330 }
331 
332 static void
335 {
336  vl_api_lisp_map_register_enable_disable_reply_t *rmp;
337  int rv = 0;
338 
340  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
341 }
342 
343 static void
346 {
347  vl_api_lisp_rloc_probe_enable_disable_reply_t *rmp;
348  int rv = 0;
349 
351  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
352 }
353 
354 static void
356 {
357  vl_api_lisp_enable_disable_reply_t *rmp;
358  int rv = 0;
359 
361  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
362 }
363 
364 static void
367 {
368  int rv = 0;
370 
371  /* *INDENT-OFF* */
372  REPLY_MACRO2(VL_API_SHOW_LISP_MAP_REQUEST_MODE_REPLY,
373  ({
375  }));
376  /* *INDENT-ON* */
377 }
378 
379 static void
381 {
382  vl_api_lisp_map_request_mode_reply_t *rmp;
383  int rv = 0;
384 
386 
387  REPLY_MACRO (VL_API_LISP_MAP_REQUEST_MODE_REPLY);
388 }
389 
390 static void
392  * mp)
393 {
394  vl_api_lisp_pitr_set_locator_set_reply_t *rmp;
395  int rv = 0;
396  u8 *ls_name = 0;
397 
398  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
399  ls_name = format (0, "%s", mp->ls_name);
400  vec_terminate_c_string (ls_name);
401  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
402  vec_free (ls_name);
403 
404  REPLY_MACRO (VL_API_LISP_PITR_SET_LOCATOR_SET_REPLY);
405 }
406 
407 static void
409 {
410  vl_api_lisp_use_petr_reply_t *rmp;
411  int rv = 0;
412  ip_address_t addr;
413 
414  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
415  rv = vnet_lisp_use_petr (&addr, mp->is_add);
416 
417  REPLY_MACRO (VL_API_LISP_USE_PETR_REPLY);
418 }
419 
420 static void
422 {
425  mapping_t *m;
426  locator_set_t *ls = 0;
427  int rv = 0;
428  locator_t *loc = 0;
429  u8 status = 0;
431 
432  memset (&addr, 0, sizeof (addr));
433  status = lcm->flags & LISP_FLAG_USE_PETR;
434  if (status)
435  {
437  if (~0 != m->locator_set_index)
438  {
439  ls =
441  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
442  gid_address_copy (&addr, &loc->address);
443  }
444  }
445 
446  /* *INDENT-OFF* */
447  REPLY_MACRO2 (VL_API_SHOW_LISP_USE_PETR_REPLY,
448  {
449  rmp->status = status;
450  ip_address_t *ip = &gid_address_ip (&addr);
451  switch (ip_addr_version (ip))
452  {
453  case IP4:
454  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
455  sizeof (ip_addr_v4 (ip)));
456  break;
457 
458  case IP6:
459  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
460  sizeof (ip_addr_v6 (ip)));
461  break;
462 
463  default:
464  ASSERT (0);
465  }
466  rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
467  });
468  /* *INDENT-ON* */
469 }
470 
471 static void
474 {
475  vl_api_lisp_add_del_map_request_itr_rlocs_reply_t *rmp;
476  int rv = 0;
477  u8 *locator_set_name = NULL;
479 
480  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
481  locator_set_name = format (0, "%s", mp->locator_set_name);
482  vec_terminate_c_string (locator_set_name);
483 
484  a->is_add = mp->is_add;
485  a->locator_set_name = locator_set_name;
486 
488 
489  vec_free (locator_set_name);
490 
491  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
492 }
493 
494 static void
497 {
498  locator_t *rlocs = 0;
499  vl_api_lisp_add_del_remote_mapping_reply_t *rmp;
500  int rv = 0;
501  gid_address_t _eid, *eid = &_eid;
502  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
503 
504  memset (eid, 0, sizeof (eid[0]));
505 
506  rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
507  mp->eid_type, mp->eid, mp->eid_len);
508  if (rv)
509  goto send_reply;
510 
511  rlocs = unformat_lisp_locs (mp->rlocs, rloc_num);
512 
513  if (!mp->is_add)
514  {
516  memset (a, 0, sizeof (*a));
517  gid_address_copy (&a->reid, eid);
518  a->is_add = 0;
520  if (rv)
521  {
522  goto out;
523  }
524  }
525 
526  /* NOTE: for now this works as a static remote mapping, i.e.,
527  * not authoritative and ttl infinite. */
528  if (mp->is_add)
529  {
530  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
531  memset (m_args, 0, sizeof (m_args[0]));
532  gid_address_copy (&m_args->eid, eid);
533  m_args->action = mp->action;
534  m_args->is_static = 1;
535  m_args->ttl = ~0;
536  m_args->authoritative = 0;
537  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
538  }
539  else
540  {
541  rv = vnet_lisp_del_mapping (eid, NULL);
542  }
543 
544  if (mp->del_all)
546 
547 out:
548  vec_free (rlocs);
549 send_reply:
550  REPLY_MACRO (VL_API_LISP_ADD_DEL_REMOTE_MAPPING_REPLY);
551 }
552 
553 static void
555 {
556  vl_api_lisp_add_del_adjacency_reply_t *rmp;
558 
559  int rv = 0;
560  memset (a, 0, sizeof (a[0]));
561 
562  rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
563  mp->eid_type, mp->leid, mp->leid_len);
564  rv |= unformat_lisp_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
565  mp->eid_type, mp->reid, mp->reid_len);
566 
567  if (rv)
568  goto send_reply;
569 
570  a->is_add = mp->is_add;
572 
573 send_reply:
574  REPLY_MACRO (VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
575 }
576 
577 static void
579  locator_t * loc, vl_api_registration_t * reg,
580  u32 context)
581 {
583 
584  rmp = vl_msg_api_alloc (sizeof (*rmp));
585  memset (rmp, 0, sizeof (*rmp));
586  rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
587  rmp->context = context;
588 
589  rmp->local = loc->local;
590  if (loc->local)
591  {
592  rmp->sw_if_index = ntohl (loc->sw_if_index);
593  }
594  else
595  {
596  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
598  }
599  rmp->priority = loc->priority;
600  rmp->weight = loc->weight;
601 
602  vl_api_send_msg (reg, (u8 *) rmp);
603 }
604 
605 static void
607 {
608  u8 *ls_name = 0;
609  vl_api_registration_t *reg = 0;
611  locator_set_t *lsit = 0;
612  locator_t *loc = 0;
613  u32 ls_index = ~0, *locit = 0;
614  uword *p = 0;
615 
617  if (!reg)
618  return;
619 
620  if (mp->is_index_set)
621  ls_index = htonl (mp->ls_index);
622  else
623  {
624  /* make sure we get a proper C-string */
625  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
626  ls_name = format (0, "%s", mp->ls_name);
627  vec_terminate_c_string (ls_name);
628  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
629  if (!p)
630  goto out;
631  ls_index = p[0];
632  }
633 
634  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
635  return;
636 
637  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
638 
639  vec_foreach (locit, lsit->locator_indices)
640  {
641  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
642  send_lisp_locator_details (lcm, loc, reg, mp->context);
643  };
644 out:
645  vec_free (ls_name);
646 }
647 
648 static void
650  locator_set_t * lsit,
651  vl_api_registration_t * reg, u32 context,
652  u32 ls_index)
653 {
655  u8 *str = 0;
656 
657  rmp = vl_msg_api_alloc (sizeof (*rmp));
658  memset (rmp, 0, sizeof (*rmp));
659  rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
660  rmp->context = context;
661 
662  rmp->ls_index = htonl (ls_index);
663  if (lsit->local)
664  {
665  ASSERT (lsit->name != NULL);
666  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
667  vec_len (lsit->name));
668  }
669  else
670  {
671  str = format (0, "<remote-%d>", ls_index);
672  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
673  vec_free (str);
674  }
675 
676  vl_api_send_msg (reg, (u8 *) rmp);
677 }
678 
679 static void
681 {
684  locator_set_t *lsit = NULL;
685  u8 filter;
686 
688  if (!reg)
689  return;
690 
691  filter = mp->filter;
692  /* *INDENT-OFF* */
693  pool_foreach (lsit, lcm->locator_set_pool,
694  ({
695  if (filter && !((1 == filter && lsit->local) ||
696  (2 == filter && !lsit->local)))
697  {
698  continue;
699  }
700  send_lisp_locator_set_details (lcm, lsit, reg, mp->context,
701  lsit - lcm->locator_set_pool);
702  }));
703  /* *INDENT-ON* */
704 }
705 
706 static void
707 lisp_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
708 {
709  ASSERT (prefix_length);
710  ip_prefix_t *ippref = &fid_addr_ippref (src);
711 
712  switch (fid_addr_type (src))
713  {
714  case FID_ADDR_IP_PREF:
715  if (ip_prefix_version (ippref) == IP4)
716  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
717  else
718  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
719  prefix_length[0] = ip_prefix_len (ippref);
720  break;
721 
722  case FID_ADDR_MAC:
723  prefix_length[0] = 0;
724  clib_memcpy (dst, fid_addr_mac (src), 6);
725  break;
726 
727  default:
728  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
729  break;
730  }
731 }
732 
733 static u8
735 {
736  ip_prefix_t *ippref;
737 
738  switch (fid_addr_type (fid))
739  {
740  case FID_ADDR_IP_PREF:
741  ippref = &fid_addr_ippref (fid);
742  if (ip_prefix_version (ippref) == IP4)
743  return 0;
744  else if (ip_prefix_version (ippref) == IP6)
745  return 1;
746  else
747  return ~0;
748 
749  case FID_ADDR_MAC:
750  return 2;
751  case FID_ADDR_NSH:
752  return 3;
753  }
754 
755  return ~0;
756 }
757 
758 static void
760  vl_api_registration_t * reg, u32 context,
761  u8 filter)
762 {
763  fid_address_t *fid;
765  locator_set_t *ls = 0;
767  gid_address_t *gid = NULL;
768  u8 *mac = 0;
769  ip_prefix_t *ip_prefix = NULL;
770 
771  switch (filter)
772  {
773  case 0: /* all mappings */
774  break;
775 
776  case 1: /* local only */
777  if (!mapit->local)
778  return;
779  break;
780  case 2: /* remote only */
781  if (mapit->local)
782  return;
783  break;
784  default:
785  clib_warning ("Filter error, unknown filter: %d", filter);
786  return;
787  }
788 
789  /* don't send PITR generated mapping */
790  if (mapit->pitr_set)
791  return;
792 
793  gid = &mapit->eid;
794  ip_prefix = &gid_address_ippref (gid);
795  mac = gid_address_mac (gid);
796 
797  rmp = vl_msg_api_alloc (sizeof (*rmp));
798  memset (rmp, 0, sizeof (*rmp));
799  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
800 
802  if (vec_len (ls->locator_indices) == 0)
803  rmp->locator_set_index = ~0;
804  else
805  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
806 
807  rmp->is_local = mapit->local;
808  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
809  rmp->action = mapit->action;
810  rmp->authoritative = mapit->authoritative;
811 
812  switch (gid_address_type (gid))
813  {
814  case GID_ADDR_SRC_DST:
815  rmp->is_src_dst = 1;
816  fid = &gid_address_sd_src (gid);
817  rmp->eid_type = fid_type_to_api_type (fid);
819  &rmp->seid_prefix_len);
821  &rmp->eid_prefix_len);
822  break;
823  case GID_ADDR_IP_PREFIX:
824  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
825  if (ip_prefix_version (ip_prefix) == IP4)
826  {
827  rmp->eid_type = 0; /* ipv4 type */
828  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
829  sizeof (ip_prefix_v4 (ip_prefix)));
830  }
831  else
832  {
833  rmp->eid_type = 1; /* ipv6 type */
834  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
835  sizeof (ip_prefix_v6 (ip_prefix)));
836  }
837  break;
838  case GID_ADDR_MAC:
839  rmp->eid_type = 2; /* l2 mac type */
840  clib_memcpy (rmp->eid, mac, 6);
841  break;
842  default:
843  ASSERT (0);
844  }
845  rmp->context = context;
846  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
847  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
848  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
849  vl_api_send_msg (reg, (u8 *) rmp);
850 }
851 
852 static void
854 {
855  u32 mi;
858  mapping_t *mapit = NULL;
859  gid_address_t _eid, *eid = &_eid;
860 
862  if (!reg)
863  return;
864 
865  if (mp->eid_set)
866  {
867  memset (eid, 0, sizeof (*eid));
868 
869  unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
870  mp->eid_type, mp->eid, mp->prefix_length);
871 
873  if ((u32) ~ 0 == mi)
874  return;
875 
876  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
877  send_lisp_eid_table_details (mapit, reg, mp->context,
878  0 /* ignore filter */ );
879  }
880  else
881  {
882  /* *INDENT-OFF* */
883  pool_foreach (mapit, lcm->mapping_pool,
884  ({
885  send_lisp_eid_table_details(mapit, reg, mp->context,
886  mp->filter);
887  }));
888  /* *INDENT-ON* */
889  }
890 }
891 
892 static void
894  u32 context)
895 {
897 
898  rmp = vl_msg_api_alloc (sizeof (*rmp));
899  memset (rmp, 0, sizeof (*rmp));
900  rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
901 
902  switch (ip_addr_version (ip))
903  {
904  case IP4:
905  rmp->is_ipv6 = 0;
906  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
907  sizeof (ip_addr_v4 (ip)));
908  break;
909 
910  case IP6:
911  rmp->is_ipv6 = 1;
912  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
913  sizeof (ip_addr_v6 (ip)));
914  break;
915 
916  default:
917  ASSERT (0);
918  }
919  rmp->context = context;
920 
921  vl_api_send_msg (reg, (u8 *) rmp);
922 }
923 
924 static void
926 {
929  lisp_msmr_t *mr;
930 
932  if (!reg)
933  return;
934 
935  vec_foreach (mr, lcm->map_servers)
936  {
938  }
939 }
940 
941 static void
943  vl_api_registration_t * reg, u32 context)
944 {
946 
947  rmp = vl_msg_api_alloc (sizeof (*rmp));
948  memset (rmp, 0, sizeof (*rmp));
949  rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS);
950 
951  switch (ip_addr_version (ip))
952  {
953  case IP4:
954  rmp->is_ipv6 = 0;
955  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
956  sizeof (ip_addr_v4 (ip)));
957  break;
958 
959  case IP6:
960  rmp->is_ipv6 = 1;
961  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
962  sizeof (ip_addr_v6 (ip)));
963  break;
964 
965  default:
966  ASSERT (0);
967  }
968  rmp->context = context;
969 
970  vl_api_send_msg (reg, (u8 *) rmp);
971 }
972 
973 static void
975 {
978  lisp_msmr_t *mr;
979 
981  if (!reg)
982  return;
983 
984  vec_foreach (mr, lcm->map_resolvers)
985  {
987  }
988 }
989 
990 static void
992  u32 context)
993 {
995 
996  rmp = vl_msg_api_alloc (sizeof (*rmp));
997  memset (rmp, 0, sizeof (*rmp));
998  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
999 
1000  rmp->vni = clib_host_to_net_u32 (p->key);
1001  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1002  rmp->context = context;
1003  vl_api_send_msg (reg, (u8 *) rmp);
1004 }
1005 
1006 static void
1008  mp)
1009 {
1010  vl_api_registration_t *reg;
1012  hash_pair_t *p;
1013  uword *vni_table = 0;
1014 
1016  if (!reg)
1017  return;
1018 
1019  if (mp->is_l2)
1020  {
1021  vni_table = lcm->bd_id_by_vni;
1022  }
1023  else
1024  {
1025  vni_table = lcm->table_id_by_vni;
1026  }
1027 
1028  /* *INDENT-OFF* */
1029  hash_foreach_pair (p, vni_table,
1030  ({
1031  send_eid_table_map_pair (p, reg, mp->context);
1032  }));
1033  /* *INDENT-ON* */
1034 }
1035 
1036 static void
1038 {
1040 
1041  rmp = vl_msg_api_alloc (sizeof (*rmp));
1042  memset (rmp, 0, sizeof (*rmp));
1043  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
1044  rmp->context = context;
1045  rmp->vni = clib_host_to_net_u32 (vni);
1046  vl_api_send_msg (reg, (u8 *) rmp);
1047 }
1048 
1049 static void
1051 {
1052  lisp_adjacency_t *adj;
1054  u32 i, n = vec_len (adjs);
1055 
1056  for (i = 0; i < n; i++)
1057  {
1058  adj = vec_elt_at_index (adjs, i);
1059  memset (&a, 0, sizeof (a));
1060 
1061  switch (gid_address_type (&adj->reid))
1062  {
1063  case GID_ADDR_IP_PREFIX:
1066  if (gid_address_ip_version (&adj->reid) == IP4)
1067  {
1068  a.eid_type = 0; /* ipv4 type */
1069  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1070  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1071  }
1072  else
1073  {
1074  a.eid_type = 1; /* ipv6 type */
1075  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1076  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1077  }
1078  break;
1079  case GID_ADDR_MAC:
1080  a.eid_type = 2; /* l2 mac type */
1081  mac_copy (a.reid, gid_address_mac (&adj->reid));
1082  mac_copy (a.leid, gid_address_mac (&adj->leid));
1083  break;
1084  default:
1085  ASSERT (0);
1086  }
1087  dst[i] = a;
1088  }
1089 }
1090 
1091 static void
1094 {
1096  int rv = 0;
1097 
1098  /* *INDENT-OFF* */
1099  REPLY_MACRO2 (VL_API_SHOW_LISP_RLOC_PROBE_STATE_REPLY,
1100  {
1102  });
1103  /* *INDENT-ON* */
1104 }
1105 
1106 static void
1109 {
1111  int rv = 0;
1112 
1113  /* *INDENT-OFF* */
1114  REPLY_MACRO2 (VL_API_SHOW_LISP_MAP_REGISTER_STATE_REPLY,
1115  {
1117  });
1118  /* *INDENT-ON* */
1119 }
1120 
1121 static void
1123 {
1125  lisp_adjacency_t *adjs = 0;
1126  int rv = 0;
1127  u32 size = ~0;
1128  u32 vni = clib_net_to_host_u32 (mp->vni);
1129 
1130  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1131  size = vec_len (adjs) * sizeof (vl_api_lisp_adjacency_t);
1132 
1133  /* *INDENT-OFF* */
1134  REPLY_MACRO4 (VL_API_LISP_ADJACENCIES_GET_REPLY, size,
1135  {
1136  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1137  lisp_adjacency_copy (rmp->adjacencies, adjs);
1138  });
1139  /* *INDENT-ON* */
1140 
1141  vec_free (adjs);
1142 }
1143 
1144 static void
1146  mp)
1147 {
1148  hash_pair_t *p;
1149  u32 *vnis = 0;
1150  vl_api_registration_t *reg = 0;
1152 
1154  if (!reg)
1155  return;
1156 
1157  /* *INDENT-OFF* */
1159  ({
1160  hash_set (vnis, p->key, 0);
1161  }));
1162 
1164  ({
1165  hash_set (vnis, p->key, 0);
1166  }));
1167 
1168  hash_foreach_pair (p, vnis,
1169  ({
1170  send_eid_table_vni (p->key, reg, mp->context);
1171  }));
1172  /* *INDENT-ON* */
1173 
1174  hash_free (vnis);
1175 }
1176 
1177 static void
1179 {
1181  int rv = 0;
1182 
1183  /* *INDENT-OFF* */
1184  REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
1185  ({
1188  }));
1189  /* *INDENT-ON* */
1190 }
1191 
1192 static void
1195 {
1198  locator_set_t *loc_set = 0;
1199  u8 *tmp_str = 0;
1200  int rv = 0;
1201 
1202  if (~0 == lcm->mreq_itr_rlocs)
1203  {
1204  tmp_str = format (0, " ");
1205  }
1206  else
1207  {
1208  loc_set =
1210  tmp_str = format (0, "%s", loc_set->name);
1211  }
1212 
1213  /* *INDENT-OFF* */
1214  REPLY_MACRO2(VL_API_LISP_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1215  ({
1216  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1217  ARRAY_LEN(rmp->locator_set_name) - 1);
1218  }));
1219  /* *INDENT-ON* */
1220 
1221  vec_free (tmp_str);
1222 }
1223 
1224 static void
1226 {
1229  mapping_t *m;
1230  locator_set_t *ls = 0;
1231  u8 *tmp_str = 0;
1232  int rv = 0;
1233 
1234  u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE)
1235  && lcm->pitr_map_index != ~0;
1236 
1237  if (!is_enabled)
1238  {
1239  tmp_str = format (0, "N/A");
1240  }
1241  else
1242  {
1244  if (~0 != m->locator_set_index)
1245  {
1246  ls =
1248  tmp_str = format (0, "%s", ls->name);
1249  }
1250  else
1251  {
1252  tmp_str = format (0, "N/A");
1253  }
1254  }
1255  vec_add1 (tmp_str, 0);
1256 
1257  /* *INDENT-OFF* */
1258  REPLY_MACRO2(VL_API_SHOW_LISP_PITR_REPLY,
1259  ({
1260  rmp->status = lcm->flags & LISP_FLAG_PITR_MODE;
1261  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1262  ARRAY_LEN(rmp->locator_set_name) - 1);
1263  }));
1264  /* *INDENT-ON* */
1265 }
1266 
1267 /*
1268  * lisp_api_hookup
1269  * Add vpe's API message handlers to the table.
1270  * vlib has alread mapped shared memory and
1271  * added the client registration handlers.
1272  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1273  */
1274 #define vl_msg_name_crc_list
1275 #include <vnet/vnet_all_api_h.h>
1276 #undef vl_msg_name_crc_list
1277 
1278 static void
1280 {
1281 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1282  foreach_vl_msg_name_crc_lisp;
1283 #undef _
1284 }
1285 
1286 static clib_error_t *
1288 {
1289  api_main_t *am = &api_main;
1290 
1291 #define _(N,n) \
1292  vl_msg_api_set_handlers(VL_API_##N, #n, \
1293  vl_api_##n##_t_handler, \
1294  vl_noop_handler, \
1295  vl_api_##n##_t_endian, \
1296  vl_api_##n##_t_print, \
1297  sizeof(vl_api_##n##_t), 1);
1299 #undef _
1300 
1301  /*
1302  * Set up the (msg_name, crc, message-id) table
1303  */
1305 
1306  return 0;
1307 }
1308 
1310 
1311 /*
1312  * fd.io coding-style-patch-verification: ON
1313  *
1314  * Local Variables:
1315  * eval: (c-set-style "gnu")
1316  * End:
1317  */
#define ip_prefix_v4(_a)
Definition: lisp_types.h:74
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:759
vl_api_local_locator_t locators[locator_num]
Definition: lisp.api:40
#define gid_address_ip_version(_a)
Definition: lisp_types.h:265
static void send_eid_table_map_pair(hash_pair_t *p, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:991
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:261
static u8 fid_type_to_api_type(fid_address_t *fid)
Definition: lisp_api.c:734
a
Definition: bitmap.h:538
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
Definition: lisp_gpe.c:184
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:1194
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:644
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)
#define NULL
Definition: clib.h:55
static void lisp_adjacency_copy(vl_api_lisp_adjacency_t *dst, lisp_adjacency_t *adjs)
Definition: lisp_api.c:1050
locator_t * locator_pool
Definition: control.h:177
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:34
static void send_lisp_map_resolver_details(ip_address_t *ip, vl_api_registration_t *reg, u32 context)
Definition: lisp_api.c:942
u8 vnet_lisp_get_map_request_mode(void)
Definition: control.c:57
#define ip_prefix_len(_a)
Definition: lisp_types.h:73
static void vl_api_lisp_add_del_map_server_t_handler(vl_api_lisp_add_del_map_server_t *mp)
Definition: lisp_api.c:299
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Definition: vec.h:1016
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:523
LISP locator_set status.
Definition: lisp.api:453
int i
Request for lisp_eid_table_map_details.
Definition: lisp.api:611
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
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:391
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:578
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:289
static void vl_api_lisp_add_del_locator_set_t_handler(vl_api_lisp_add_del_locator_set_t *mp)
Definition: lisp_api.c:117
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:1279
static void vl_api_lisp_locator_dump_t_handler(vl_api_lisp_locator_dump_t *mp)
Definition: lisp_api.c:606
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: lisp_types.c:908
void * vl_msg_api_alloc(int nbytes)
vhost_vring_addr_t addr
Definition: vhost_user.h:116
#define ip_prefix_version(_a)
Definition: lisp_types.h:72
LISP adjacency.
Definition: lisp.api:562
unsigned char u8
Definition: types.h:56
#define fid_addr_mac(_a)
Definition: lisp_types.h:134
u8 vnet_lisp_map_register_state_get(void)
Definition: control.c:424
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1559
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:1488
Request for map resolver summary status.
Definition: lisp.api:655
static void vl_api_lisp_map_register_enable_disable_t_handler(vl_api_lisp_map_register_enable_disable_t *mp)
Definition: lisp_api.c:334
uword value[0]
Definition: hash.h:165
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:443
static void vl_api_lisp_rloc_probe_enable_disable_t_handler(vl_api_lisp_rloc_probe_enable_disable_t *mp)
Definition: lisp_api.c:345
static void vl_api_lisp_add_del_remote_mapping_t_handler(vl_api_lisp_add_del_remote_mapping_t *mp)
Definition: lisp_api.c:496
u8 * key
Definition: lisp_types.h:373
#define gid_address_sd_src(_a)
Definition: lisp_types.h:278
static void vl_api_show_lisp_map_register_state_t_handler(vl_api_show_lisp_map_register_state_t *mp)
Definition: lisp_api.c:1108
#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:1122
Get LISP map request itr rlocs status.
Definition: lisp.api:709
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:1079
unsigned int u32
Definition: types.h:88
uword * bd_id_by_vni
Definition: control.h:243
#define ip_addr_v4(_a)
Definition: lisp_types.h:54
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:301
u32 petr_map_index
Proxy ETR map index used for &#39;use-petr&#39;.
Definition: control.h:254
#define ip_addr_version(_a)
Definition: lisp_types.h:56
static void vl_api_lisp_use_petr_t_handler(vl_api_lisp_use_petr_t *mp)
Definition: lisp_api.c:408
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:2260
static void vl_api_show_lisp_pitr_t_handler(vl_api_show_lisp_pitr_t *mp)
Definition: lisp_api.c:1225
Get state of LISP map-register.
Definition: lisp.api:256
Get state of LISP RLOC probing.
Definition: lisp.api:210
void ip_address_copy_addr(void *dst, const ip_address_t *src)
Definition: lisp_types.c:902
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1631
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:464
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:431
uword size
#define gid_address_mac(_a)
Definition: lisp_types.h:267
set LISP map-request mode.
Definition: lisp.api:281
#define ip_prefix_v6(_a)
Definition: lisp_types.h:75
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:884
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:850
u8 authoritative
Definition: lisp_types.h:363
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:925
static void vl_api_lisp_add_del_adjacency_t_handler(vl_api_lisp_add_del_adjacency_t *mp)
Definition: lisp_api.c:554
void ip_prefix_normalize(ip_prefix_t *a)
Definition: lisp_types.c:988
#define ip_addr_v6(_a)
Definition: lisp_types.h:55
#define gid_address_ippref(_a)
Definition: lisp_types.h:262
LISP PETR status, enable or disable.
Definition: lisp.api:197
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:201
lisp_adjacency_t * vnet_lisp_adjacencies_get_by_vni(u32 vni)
Returns vector of adjacencies.
Definition: control.c:627
An API client registration, only in vpp/vlib.
Definition: api_common.h:44
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:324
Request for lisp-gpe protocol status.
Definition: lisp.api:686
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
Definition: control.c:2392
enable or disable LISP feature
Definition: lisp.api:144
vlib_main_t * vm
Definition: buffer.c:294
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:1560
static void vl_api_show_lisp_status_t_handler(vl_api_show_lisp_status_t *mp)
Definition: lisp_api.c:1178
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:339
#define gid_address_ippref_len(_a)
Definition: lisp_types.h:263
#define clib_warning(format, args...)
Definition: error.h:59
u32 locator_set_index
Definition: lisp_types.h:356
#define clib_memcpy(a, b, c)
Definition: string.h:75
static void vl_api_lisp_locator_set_dump_t_handler(vl_api_lisp_locator_set_dump_t *mp)
Definition: lisp_api.c:680
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:2194
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:271
#define ARRAY_LEN(x)
Definition: clib.h:59
lisp_key_type_t key_id
Definition: lisp_types.h:374
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:56
Request for map lisp locator status.
Definition: lisp.api:421
#define fid_addr_ippref(_a)
Definition: lisp_types.h:131
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2322
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:1287
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:681
#define ASSERT(truth)
#define fid_addr_type(_a)
Definition: lisp_types.h:136
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:1437
Request for locator_set summary status.
Definition: lisp.api:469
#define gid_address_sd_dst(_a)
Definition: lisp_types.h:279
static void vl_api_show_lisp_use_petr_t_handler(vl_api_show_lisp_use_petr_t *mp)
Definition: lisp_api.c:421
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:893
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:739
static void vl_api_lisp_map_resolver_dump_t_handler(vl_api_lisp_map_resolver_dump_t *mp)
Definition: lisp_api.c:974
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:2185
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:707
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:473
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:237
int vnet_lisp_add_del_locator_set(vnet_lisp_add_del_locator_set_args_t *a, u32 *ls_result)
Definition: control.c:2045
#define gid_address_ip(_a)
Definition: lisp_types.h:264
Status of lisp, enable or disable.
Definition: lisp.api:697
#define gid_address_vni(_a)
Definition: lisp_types.h:271
Request for map server summary status.
Definition: lisp.api:676
static void vl_api_lisp_eid_table_dump_t_handler(vl_api_lisp_eid_table_dump_t *mp)
Definition: lisp_api.c:853
static void vl_api_show_lisp_map_request_mode_t_handler(vl_api_show_lisp_map_request_mode_t *mp)
Definition: lisp_api.c:366
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:1037
#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:649
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:1388
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:1941
mapping_t * mapping_pool
Definition: control.h:171
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:1279
static void vl_api_lisp_map_request_mode_t_handler(vl_api_lisp_map_request_mode_t *mp)
Definition: lisp_api.c:380
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
Definition: lisp_types.c:1495
Definition: lisp_types.h:37
gid_address_t eid
Definition: lisp_types.h:351
gid_address_t reid
Definition: control.h:74
gid_address_t address
Definition: lisp_types.h:325
#define hash_get_mem(h, key)
Definition: hash.h:269
void mac_copy(void *dst, void *src)
Definition: lisp_types.c:1051
LISP map server details.
Definition: lisp.api:665
static void vl_api_lisp_enable_disable_t_handler(vl_api_lisp_enable_disable_t *mp)
Definition: lisp_api.c:355
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:2329
static void vl_api_lisp_eid_table_vni_dump_t_handler(vl_api_lisp_eid_table_vni_dump_t *mp)
Definition: lisp_api.c:1145
#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:717
static void vl_api_lisp_add_del_locator_t_handler(vl_api_lisp_add_del_locator_t *mp)
Definition: lisp_api.c:169
Request for LISP map-request mode.
Definition: lisp.api:292
Definition: lisp_types.h:38
static int unformat_lisp_eid_api(gid_address_t *dst, u32 vni, u8 type, void *src, u8 len)
Definition: lisp_api.c:205
static void vl_api_show_lisp_rloc_probe_state_t_handler(vl_api_show_lisp_rloc_probe_state_t *mp)
Definition: lisp_api.c:1093
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1698
api_main_t api_main
Definition: api_shared.c:35
reply to lisp_eid_table_vni_dump
Definition: lisp.api:633
u32 mreq_itr_rlocs
Definition: control.h:236
u32 * locator_indices
Definition: lisp_types.h:345
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:1007
Request for lisp pitr status.
Definition: lisp.api:728
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:315