FD.io VPP  v17.10-9-gd594711
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  locator_name = format (0, "%s", mp->locator_set_name);
132 
133  a->name = locator_name;
134  a->is_add = mp->is_add;
135  a->local = 1;
136  locator_num = clib_net_to_host_u32 (mp->locator_num);
137 
138  memset (&locator, 0, sizeof (locator));
139  for (i = 0; i < locator_num; i++)
140  {
141  ls_loc = &mp->locators[i];
142  VALIDATE_SW_IF_INDEX (ls_loc);
143 
144  locator.sw_if_index = htonl (ls_loc->sw_if_index);
145  locator.priority = ls_loc->priority;
146  locator.weight = ls_loc->weight;
147  locator.local = 1;
148  vec_add1 (a->locators, locator);
149  }
150 
151  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
152 
154 
155  vec_free (locator_name);
156  vec_free (a->locators);
157 
158  /* *INDENT-OFF* */
159  REPLY_MACRO2 (VL_API_LISP_ADD_DEL_LOCATOR_SET_REPLY,
160  ({
161  rmp->ls_index = clib_host_to_net_u32 (ls_index);
162  }));
163  /* *INDENT-ON* */
164 }
165 
166 static void
168 {
169  vl_api_lisp_add_del_locator_reply_t *rmp;
170  int rv = 0;
171  locator_t locator, *locators = NULL;
173  u32 ls_index = ~0;
174  u8 *locator_name = NULL;
175 
176  memset (&locator, 0, sizeof (locator));
177  memset (a, 0, sizeof (a[0]));
178 
179  locator.sw_if_index = ntohl (mp->sw_if_index);
180  locator.priority = mp->priority;
181  locator.weight = mp->weight;
182  locator.local = 1;
183  vec_add1 (locators, locator);
184 
185  locator_name = format (0, "%s", mp->locator_set_name);
186 
187  a->name = locator_name;
188  a->locators = locators;
189  a->is_add = mp->is_add;
190  a->local = 1;
191 
192  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
193 
194  vec_free (locators);
195  vec_free (locator_name);
196 
197  REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCATOR_REPLY);
198 }
199 
200 static int
201 unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
202  u8 len)
203 {
204  switch (type)
205  {
206  case 0: /* ipv4 */
208  gid_address_ip_set (dst, src, IP4);
209  gid_address_ippref_len (dst) = len;
211  break;
212  case 1: /* ipv6 */
214  gid_address_ip_set (dst, src, IP6);
215  gid_address_ippref_len (dst) = len;
217  break;
218  case 2: /* l2 mac */
220  clib_memcpy (&gid_address_mac (dst), src, 6);
221  break;
222  default:
223  /* unknown type */
224  return VNET_API_ERROR_INVALID_VALUE;
225  }
226 
227  gid_address_vni (dst) = vni;
228 
229  return 0;
230 }
231 
232 static void
234 {
235  vl_api_lisp_add_del_local_eid_reply_t *rmp;
237  int rv = 0;
238  gid_address_t _eid, *eid = &_eid;
239  uword *p = NULL;
240  u32 locator_set_index = ~0, map_index = ~0;
242  u8 *name = NULL, *key = NULL;
243  memset (a, 0, sizeof (a[0]));
244  memset (eid, 0, sizeof (eid[0]));
245 
246  rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
247  mp->eid_type, mp->eid, mp->prefix_len);
248  if (rv)
249  goto out;
250 
251  name = format (0, "%s", mp->locator_set_name);
252  p = hash_get_mem (lcm->locator_set_index_by_name, name);
253  if (!p)
254  {
255  rv = VNET_API_ERROR_INVALID_VALUE;
256  goto out;
257  }
258  locator_set_index = p[0];
259 
260  if (*mp->key)
261  key = format (0, "%s", mp->key);
262 
263  /* XXX treat batch configuration */
264  a->is_add = mp->is_add;
265  gid_address_copy (&a->eid, eid);
266  a->locator_set_index = locator_set_index;
267  a->local = 1;
268  a->key = key;
269  a->key_id = clib_net_to_host_u16 (mp->key_id);
270 
271  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
272 
273 out:
274  vec_free (name);
275  vec_free (key);
276  gid_address_free (&a->eid);
277 
278  REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY);
279 }
280 
281 static void
284 {
285  vl_api_lisp_eid_table_add_del_map_reply_t *rmp;
286  int rv = 0;
287  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
288  clib_net_to_host_u32 (mp->dp_table),
289  mp->is_l2, mp->is_add);
290 REPLY_MACRO (VL_API_LISP_EID_TABLE_ADD_DEL_MAP_REPLY)}
291 
292 static void
294  * mp)
295 {
296  vl_api_lisp_add_del_map_server_reply_t *rmp;
297  int rv = 0;
298  ip_address_t addr;
299 
300  memset (&addr, 0, sizeof (addr));
301 
302  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
303  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
304 
305  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY);
306 }
307 
308 static void
310  * mp)
311 {
312  vl_api_lisp_add_del_map_resolver_reply_t *rmp;
313  int rv = 0;
315 
316  memset (a, 0, sizeof (a[0]));
317 
318  a->is_add = mp->is_add;
319  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
320 
322 
323  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_RESOLVER_REPLY);
324 }
325 
326 static void
329 {
330  vl_api_lisp_map_register_enable_disable_reply_t *rmp;
331  int rv = 0;
332 
334  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
335 }
336 
337 static void
340 {
341  vl_api_lisp_rloc_probe_enable_disable_reply_t *rmp;
342  int rv = 0;
343 
345  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
346 }
347 
348 static void
350 {
351  vl_api_lisp_enable_disable_reply_t *rmp;
352  int rv = 0;
353 
355  REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
356 }
357 
358 static void
361 {
362  int rv = 0;
364 
365  /* *INDENT-OFF* */
366  REPLY_MACRO2(VL_API_SHOW_LISP_MAP_REQUEST_MODE_REPLY,
367  ({
369  }));
370  /* *INDENT-ON* */
371 }
372 
373 static void
375 {
376  vl_api_lisp_map_request_mode_reply_t *rmp;
377  int rv = 0;
378 
380 
381  REPLY_MACRO (VL_API_LISP_MAP_REQUEST_MODE_REPLY);
382 }
383 
384 static void
386  * mp)
387 {
388  vl_api_lisp_pitr_set_locator_set_reply_t *rmp;
389  int rv = 0;
390  u8 *ls_name = 0;
391 
392  ls_name = format (0, "%s", mp->ls_name);
393  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
394  vec_free (ls_name);
395 
396  REPLY_MACRO (VL_API_LISP_PITR_SET_LOCATOR_SET_REPLY);
397 }
398 
399 static void
401 {
402  vl_api_lisp_use_petr_reply_t *rmp;
403  int rv = 0;
404  ip_address_t addr;
405 
406  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
407  rv = vnet_lisp_use_petr (&addr, mp->is_add);
408 
409  REPLY_MACRO (VL_API_LISP_USE_PETR_REPLY);
410 }
411 
412 static void
414 {
418  mapping_t *m;
419  locator_set_t *ls = 0;
420  int rv = 0;
421  locator_t *loc = 0;
422  u8 status = 0;
424 
426  if (q == 0)
427  {
428  return;
429  }
430 
431  memset (&addr, 0, sizeof (addr));
432  status = lcm->flags & LISP_FLAG_USE_PETR;
433  if (status)
434  {
436  if (~0 != m->locator_set_index)
437  {
438  ls =
440  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
441  gid_address_copy (&addr, &loc->address);
442  }
443  }
444 
445  /* *INDENT-OFF* */
446  REPLY_MACRO2 (VL_API_SHOW_LISP_USE_PETR_REPLY,
447  {
448  rmp->status = status;
449  ip_address_t *ip = &gid_address_ip (&addr);
450  switch (ip_addr_version (ip))
451  {
452  case IP4:
453  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
454  sizeof (ip_addr_v4 (ip)));
455  break;
456 
457  case IP6:
458  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
459  sizeof (ip_addr_v6 (ip)));
460  break;
461 
462  default:
463  ASSERT (0);
464  }
465  rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
466  });
467  /* *INDENT-ON* */
468 }
469 
470 static void
473 {
474  vl_api_lisp_add_del_map_request_itr_rlocs_reply_t *rmp;
475  int rv = 0;
476  u8 *locator_set_name = NULL;
478 
479  locator_set_name = format (0, "%s", mp->locator_set_name);
480 
481  a->is_add = mp->is_add;
482  a->locator_set_name = locator_set_name;
483 
485 
486  vec_free (locator_set_name);
487 
488  REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
489 }
490 
491 static void
494 {
495  locator_t *rlocs = 0;
496  vl_api_lisp_add_del_remote_mapping_reply_t *rmp;
497  int rv = 0;
498  gid_address_t _eid, *eid = &_eid;
499  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
500 
501  memset (eid, 0, sizeof (eid[0]));
502 
503  rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
504  mp->eid_type, mp->eid, mp->eid_len);
505  if (rv)
506  goto send_reply;
507 
508  rlocs = unformat_lisp_locs (mp->rlocs, rloc_num);
509 
510  if (!mp->is_add)
511  {
513  gid_address_copy (&a->reid, eid);
514  a->is_add = 0;
516  if (rv)
517  {
518  goto out;
519  }
520  }
521 
522  /* NOTE: for now this works as a static remote mapping, i.e.,
523  * not authoritative and ttl infinite. */
524  if (mp->is_add)
525  {
526  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
527  memset (m_args, 0, sizeof (m_args[0]));
528  gid_address_copy (&m_args->eid, eid);
529  m_args->action = mp->action;
530  m_args->is_static = 1;
531  m_args->ttl = ~0;
532  m_args->authoritative = 0;
533  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
534  }
535  else
536  rv = vnet_lisp_del_mapping (eid, NULL);
537 
538  if (mp->del_all)
540 
541 out:
542  vec_free (rlocs);
543 send_reply:
544  REPLY_MACRO (VL_API_LISP_ADD_DEL_REMOTE_MAPPING_REPLY);
545 }
546 
547 static void
549 {
550  vl_api_lisp_add_del_adjacency_reply_t *rmp;
552 
553  int rv = 0;
554  memset (a, 0, sizeof (a[0]));
555 
556  rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
557  mp->eid_type, mp->leid, mp->leid_len);
558  rv |= unformat_lisp_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
559  mp->eid_type, mp->reid, mp->reid_len);
560 
561  if (rv)
562  goto send_reply;
563 
564  a->is_add = mp->is_add;
566 
567 send_reply:
568  REPLY_MACRO (VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
569 }
570 
571 static void
573  locator_t * loc,
574  unix_shared_memory_queue_t * q, u32 context)
575 {
577 
578  rmp = vl_msg_api_alloc (sizeof (*rmp));
579  memset (rmp, 0, sizeof (*rmp));
580  rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
581  rmp->context = context;
582 
583  rmp->local = loc->local;
584  if (loc->local)
585  {
586  rmp->sw_if_index = ntohl (loc->sw_if_index);
587  }
588  else
589  {
590  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
592  }
593  rmp->priority = loc->priority;
594  rmp->weight = loc->weight;
595 
596  vl_msg_api_send_shmem (q, (u8 *) & rmp);
597 }
598 
599 static void
601 {
602  u8 *ls_name = 0;
605  locator_set_t *lsit = 0;
606  locator_t *loc = 0;
607  u32 ls_index = ~0, *locit = 0;
608  uword *p = 0;
609 
611  if (q == 0)
612  {
613  return;
614  }
615 
616  if (mp->is_index_set)
617  ls_index = htonl (mp->ls_index);
618  else
619  {
620  /* make sure we get a proper C-string */
621  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
622  ls_name = format (0, "%s", mp->ls_name);
623  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
624  if (!p)
625  goto out;
626  ls_index = p[0];
627  }
628 
629  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
630  return;
631 
632  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
633 
634  vec_foreach (locit, lsit->locator_indices)
635  {
636  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
637  send_lisp_locator_details (lcm, loc, q, mp->context);
638  };
639 out:
640  vec_free (ls_name);
641 }
642 
643 static void
645  locator_set_t * lsit,
647  u32 context, u32 ls_index)
648 {
650  u8 *str = 0;
651 
652  rmp = vl_msg_api_alloc (sizeof (*rmp));
653  memset (rmp, 0, sizeof (*rmp));
654  rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
655  rmp->context = context;
656 
657  rmp->ls_index = htonl (ls_index);
658  if (lsit->local)
659  {
660  ASSERT (lsit->name != NULL);
661  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
662  vec_len (lsit->name));
663  }
664  else
665  {
666  str = format (0, "<remote-%d>", ls_index);
667  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
668  vec_free (str);
669  }
670 
671  vl_msg_api_send_shmem (q, (u8 *) & rmp);
672 }
673 
674 static void
676 {
679  locator_set_t *lsit = NULL;
680  u8 filter;
681 
683  if (q == 0)
684  {
685  return;
686  }
687 
688  filter = mp->filter;
689  /* *INDENT-OFF* */
690  pool_foreach (lsit, lcm->locator_set_pool,
691  ({
692  if (filter && !((1 == filter && lsit->local) ||
693  (2 == filter && !lsit->local)))
694  {
695  continue;
696  }
697  send_lisp_locator_set_details (lcm, lsit, q, mp->context,
698  lsit - lcm->locator_set_pool);
699  }));
700  /* *INDENT-ON* */
701 }
702 
703 static void
704 lisp_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
705 {
706  ASSERT (prefix_length);
707  ip_prefix_t *ippref = &fid_addr_ippref (src);
708 
709  switch (fid_addr_type (src))
710  {
711  case FID_ADDR_IP_PREF:
712  if (ip_prefix_version (ippref) == IP4)
713  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
714  else
715  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
716  prefix_length[0] = ip_prefix_len (ippref);
717  break;
718 
719  case FID_ADDR_MAC:
720  prefix_length[0] = 0;
721  clib_memcpy (dst, fid_addr_mac (src), 6);
722  break;
723 
724  default:
725  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
726  break;
727  }
728 }
729 
730 static u8
732 {
733  ip_prefix_t *ippref;
734 
735  switch (fid_addr_type (fid))
736  {
737  case FID_ADDR_IP_PREF:
738  ippref = &fid_addr_ippref (fid);
739  if (ip_prefix_version (ippref) == IP4)
740  return 0;
741  else if (ip_prefix_version (ippref) == IP6)
742  return 1;
743  else
744  return ~0;
745 
746  case FID_ADDR_MAC:
747  return 2;
748  case FID_ADDR_NSH:
749  return 3;
750  }
751 
752  return ~0;
753 }
754 
755 static void
758  u32 context, u8 filter)
759 {
760  fid_address_t *fid;
762  locator_set_t *ls = 0;
764  gid_address_t *gid = NULL;
765  u8 *mac = 0;
766  ip_prefix_t *ip_prefix = NULL;
767 
768  switch (filter)
769  {
770  case 0: /* all mappings */
771  break;
772 
773  case 1: /* local only */
774  if (!mapit->local)
775  return;
776  break;
777  case 2: /* remote only */
778  if (mapit->local)
779  return;
780  break;
781  default:
782  clib_warning ("Filter error, unknown filter: %d", filter);
783  return;
784  }
785 
786  /* don't send PITR generated mapping */
787  if (mapit->pitr_set)
788  return;
789 
790  gid = &mapit->eid;
791  ip_prefix = &gid_address_ippref (gid);
792  mac = gid_address_mac (gid);
793 
794  rmp = vl_msg_api_alloc (sizeof (*rmp));
795  memset (rmp, 0, sizeof (*rmp));
796  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
797 
799  if (vec_len (ls->locator_indices) == 0)
800  rmp->locator_set_index = ~0;
801  else
802  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
803 
804  rmp->is_local = mapit->local;
805  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
806  rmp->action = mapit->action;
807  rmp->authoritative = mapit->authoritative;
808 
809  switch (gid_address_type (gid))
810  {
811  case GID_ADDR_SRC_DST:
812  rmp->is_src_dst = 1;
813  fid = &gid_address_sd_src (gid);
814  rmp->eid_type = fid_type_to_api_type (fid);
816  &rmp->seid_prefix_len);
818  &rmp->eid_prefix_len);
819  break;
820  case GID_ADDR_IP_PREFIX:
821  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
822  if (ip_prefix_version (ip_prefix) == IP4)
823  {
824  rmp->eid_type = 0; /* ipv4 type */
825  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
826  sizeof (ip_prefix_v4 (ip_prefix)));
827  }
828  else
829  {
830  rmp->eid_type = 1; /* ipv6 type */
831  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
832  sizeof (ip_prefix_v6 (ip_prefix)));
833  }
834  break;
835  case GID_ADDR_MAC:
836  rmp->eid_type = 2; /* l2 mac type */
837  clib_memcpy (rmp->eid, mac, 6);
838  break;
839  default:
840  ASSERT (0);
841  }
842  rmp->context = context;
843  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
844  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
845  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
846  vl_msg_api_send_shmem (q, (u8 *) & rmp);
847 }
848 
849 static void
851 {
852  u32 mi;
855  mapping_t *mapit = NULL;
856  gid_address_t _eid, *eid = &_eid;
857 
859  if (q == 0)
860  {
861  return;
862  }
863 
864  if (mp->eid_set)
865  {
866  memset (eid, 0, sizeof (*eid));
867 
868  unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
869  mp->eid_type, mp->eid, mp->prefix_length);
870 
872  if ((u32) ~ 0 == mi)
873  return;
874 
875  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
876  send_lisp_eid_table_details (mapit, q, mp->context,
877  0 /* ignore filter */ );
878  }
879  else
880  {
881  /* *INDENT-OFF* */
882  pool_foreach (mapit, lcm->mapping_pool,
883  ({
884  send_lisp_eid_table_details(mapit, q, mp->context,
885  mp->filter);
886  }));
887  /* *INDENT-ON* */
888  }
889 }
890 
891 static void
892 send_lisp_map_server_details (ip_address_t * ip,
893  unix_shared_memory_queue_t * q, u32 context)
894 {
896 
897  rmp = vl_msg_api_alloc (sizeof (*rmp));
898  memset (rmp, 0, sizeof (*rmp));
899  rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
900 
901  switch (ip_addr_version (ip))
902  {
903  case IP4:
904  rmp->is_ipv6 = 0;
905  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
906  sizeof (ip_addr_v4 (ip)));
907  break;
908 
909  case IP6:
910  rmp->is_ipv6 = 1;
911  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
912  sizeof (ip_addr_v6 (ip)));
913  break;
914 
915  default:
916  ASSERT (0);
917  }
918  rmp->context = context;
919 
920  vl_msg_api_send_shmem (q, (u8 *) & rmp);
921 }
922 
923 static void
925 {
928  lisp_msmr_t *mr;
929 
931  if (q == 0)
932  {
933  return;
934  }
935 
936  vec_foreach (mr, lcm->map_servers)
937  {
939  }
940 }
941 
942 static void
944  unix_shared_memory_queue_t * q, u32 context)
945 {
947 
948  rmp = vl_msg_api_alloc (sizeof (*rmp));
949  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 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 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_msg_api_send_shmem (q, (u8 *) & rmp);
972 }
973 
974 static void
976 {
979  lisp_msmr_t *mr;
980 
982  if (q == 0)
983  {
984  return;
985  }
986 
987  vec_foreach (mr, lcm->map_resolvers)
988  {
990  }
991 }
992 
993 static void
995  unix_shared_memory_queue_t * q, u32 context)
996 {
998 
999  rmp = vl_msg_api_alloc (sizeof (*rmp));
1000  memset (rmp, 0, sizeof (*rmp));
1001  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
1002 
1003  rmp->vni = clib_host_to_net_u32 (p->key);
1004  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1005  rmp->context = context;
1006  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1007 }
1008 
1009 static void
1011  mp)
1012 {
1015  hash_pair_t *p;
1016  uword *vni_table = 0;
1017 
1019  if (q == 0)
1020  {
1021  return;
1022  }
1023 
1024  if (mp->is_l2)
1025  {
1026  vni_table = lcm->bd_id_by_vni;
1027  }
1028  else
1029  {
1030  vni_table = lcm->table_id_by_vni;
1031  }
1032 
1033  /* *INDENT-OFF* */
1034  hash_foreach_pair (p, vni_table,
1035  ({
1036  send_eid_table_map_pair (p, q, mp->context);
1037  }));
1038  /* *INDENT-ON* */
1039 }
1040 
1041 static void
1043 {
1045 
1046  rmp = vl_msg_api_alloc (sizeof (*rmp));
1047  memset (rmp, 0, sizeof (*rmp));
1048  rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
1049  rmp->context = context;
1050  rmp->vni = clib_host_to_net_u32 (vni);
1051  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1052 }
1053 
1054 static void
1056 {
1057  lisp_adjacency_t *adj;
1059  u32 i, n = vec_len (adjs);
1060 
1061  for (i = 0; i < n; i++)
1062  {
1063  adj = vec_elt_at_index (adjs, i);
1064  memset (&a, 0, sizeof (a));
1065 
1066  switch (gid_address_type (&adj->reid))
1067  {
1068  case GID_ADDR_IP_PREFIX:
1071  if (gid_address_ip_version (&adj->reid) == IP4)
1072  {
1073  a.eid_type = 0; /* ipv4 type */
1074  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1075  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1076  }
1077  else
1078  {
1079  a.eid_type = 1; /* ipv6 type */
1080  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1081  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1082  }
1083  break;
1084  case GID_ADDR_MAC:
1085  a.eid_type = 2; /* l2 mac type */
1086  mac_copy (a.reid, gid_address_mac (&adj->reid));
1087  mac_copy (a.leid, gid_address_mac (&adj->leid));
1088  break;
1089  default:
1090  ASSERT (0);
1091  }
1092  dst[i] = a;
1093  }
1094 }
1095 
1096 static void
1099 {
1101  int rv = 0;
1102 
1103  /* *INDENT-OFF* */
1104  REPLY_MACRO2 (VL_API_SHOW_LISP_RLOC_PROBE_STATE_REPLY,
1105  {
1107  });
1108  /* *INDENT-ON* */
1109 }
1110 
1111 static void
1114 {
1116  int rv = 0;
1117 
1118  /* *INDENT-OFF* */
1119  REPLY_MACRO2 (VL_API_SHOW_LISP_MAP_REGISTER_STATE_REPLY,
1120  {
1122  });
1123  /* *INDENT-ON* */
1124 }
1125 
1126 static void
1128 {
1130  lisp_adjacency_t *adjs = 0;
1131  int rv = 0;
1132  u32 size = ~0;
1133  u32 vni = clib_net_to_host_u32 (mp->vni);
1134 
1135  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1136  size = vec_len (adjs) * sizeof (vl_api_lisp_adjacency_t);
1137 
1138  /* *INDENT-OFF* */
1139  REPLY_MACRO4 (VL_API_LISP_ADJACENCIES_GET_REPLY, size,
1140  {
1141  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1142  lisp_adjacency_copy (rmp->adjacencies, adjs);
1143  });
1144  /* *INDENT-ON* */
1145 
1146  vec_free (adjs);
1147 }
1148 
1149 static void
1151  mp)
1152 {
1153  hash_pair_t *p;
1154  u32 *vnis = 0;
1157 
1159  if (q == 0)
1160  {
1161  return;
1162  }
1163 
1164  /* *INDENT-OFF* */
1166  ({
1167  hash_set (vnis, p->key, 0);
1168  }));
1169 
1171  ({
1172  hash_set (vnis, p->key, 0);
1173  }));
1174 
1175  hash_foreach_pair (p, vnis,
1176  ({
1177  send_eid_table_vni (p->key, q, mp->context);
1178  }));
1179  /* *INDENT-ON* */
1180 
1181  hash_free (vnis);
1182 }
1183 
1184 static void
1186 {
1189  int rv = 0;
1190 
1192  if (q == 0)
1193  {
1194  return;
1195  }
1196 
1197  /* *INDENT-OFF* */
1198  REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
1199  ({
1202  }));
1203  /* *INDENT-ON* */
1204 }
1205 
1206 static void
1209 {
1213  locator_set_t *loc_set = 0;
1214  u8 *tmp_str = 0;
1215  int rv = 0;
1216 
1218  if (q == 0)
1219  {
1220  return;
1221  }
1222 
1223  if (~0 == lcm->mreq_itr_rlocs)
1224  {
1225  tmp_str = format (0, " ");
1226  }
1227  else
1228  {
1229  loc_set =
1231  tmp_str = format (0, "%s", loc_set->name);
1232  }
1233 
1234  /* *INDENT-OFF* */
1235  REPLY_MACRO2(VL_API_LISP_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1236  ({
1237  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1238  ARRAY_LEN(rmp->locator_set_name) - 1);
1239  }));
1240  /* *INDENT-ON* */
1241 
1242  vec_free (tmp_str);
1243 }
1244 
1245 static void
1247 {
1251  mapping_t *m;
1252  locator_set_t *ls = 0;
1253  u8 *tmp_str = 0;
1254  int rv = 0;
1255 
1257  if (q == 0)
1258  {
1259  return;
1260  }
1261 
1262  if (!lcm->lisp_pitr)
1263  {
1264  tmp_str = format (0, "N/A");
1265  }
1266  else
1267  {
1269  if (~0 != m->locator_set_index)
1270  {
1271  ls =
1273  tmp_str = format (0, "%s", ls->name);
1274  }
1275  else
1276  {
1277  tmp_str = format (0, "N/A");
1278  }
1279  }
1280  vec_add1 (tmp_str, 0);
1281 
1282  /* *INDENT-OFF* */
1283  REPLY_MACRO2(VL_API_SHOW_LISP_PITR_REPLY,
1284  ({
1285  rmp->status = lcm->lisp_pitr;
1286  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1287  ARRAY_LEN(rmp->locator_set_name) - 1);
1288  }));
1289  /* *INDENT-ON* */
1290 }
1291 
1292 /*
1293  * lisp_api_hookup
1294  * Add vpe's API message handlers to the table.
1295  * vlib has alread mapped shared memory and
1296  * added the client registration handlers.
1297  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1298  */
1299 #define vl_msg_name_crc_list
1300 #include <vnet/vnet_all_api_h.h>
1301 #undef vl_msg_name_crc_list
1302 
1303 static void
1305 {
1306 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1307  foreach_vl_msg_name_crc_lisp;
1308 #undef _
1309 }
1310 
1311 static clib_error_t *
1313 {
1314  api_main_t *am = &api_main;
1315 
1316 #define _(N,n) \
1317  vl_msg_api_set_handlers(VL_API_##N, #n, \
1318  vl_api_##n##_t_handler, \
1319  vl_noop_handler, \
1320  vl_api_##n##_t_endian, \
1321  vl_api_##n##_t_print, \
1322  sizeof(vl_api_##n##_t), 1);
1324 #undef _
1325 
1326  /*
1327  * Set up the (msg_name, crc, message-id) table
1328  */
1330 
1331  return 0;
1332 }
1333 
1335 
1336 /*
1337  * fd.io coding-style-patch-verification: ON
1338  *
1339  * Local Variables:
1340  * eval: (c-set-style "gnu")
1341  * End:
1342  */
#define ip_prefix_v4(_a)
Definition: lisp_types.h:74
Reply for show_lisp_map_register_state.
Definition: lisp.api:264
vl_api_local_locator_t locators[locator_num]
Definition: lisp.api:38
#define gid_address_ip_version(_a)
Definition: lisp_types.h:265
u32 pitr_map_index
Definition: control.h:247
gid_address_t leid
Definition: control.h:73
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
LISP locator_set status.
Definition: lisp.api:435
enable/disable LISP RLOC probing
Definition: lisp.api:231
#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:731
a
Definition: bitmap.h:516
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:1208
lisp_msmr_t * map_resolvers
Definition: control.h:217
VLIB_API_INIT_FUNCTION(lisp_api_hookup)
configure or disable LISP PITR node
Definition: lisp.api:155
Reply for locator_set add/del.
Definition: lisp.api:46
#define REPLY_MACRO4(t, n, body)
LISP map resolver status.
Definition: lisp.api:642
vl_api_lisp_adjacency_t adjacencies[count]
Definition: lisp.api:578
uword * table_id_by_vni
Definition: control.h:236
#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:1055
locator_t * locator_pool
Definition: control.h:174
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:293
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:518
LISP locator_set status.
Definition: lisp.api:451
Request for lisp_eid_table_map_details.
Definition: lisp.api:609
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
configure or disable use of PETR
Definition: lisp.api:170
static void vl_api_lisp_pitr_set_locator_set_t_handler(vl_api_lisp_pitr_set_locator_set_t *mp)
Definition: lisp_api.c:385
Request for LISP PETR status.
Definition: lisp.api:183
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:283
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:1268
static void vl_api_lisp_locator_dump_t_handler(vl_api_lisp_locator_dump_t *mp)
Definition: lisp_api.c:600
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: lisp_types.c:908
#define ip_prefix_version(_a)
Definition: lisp_types.h:72
LISP adjacency.
Definition: lisp.api:560
#define fid_addr_mac(_a)
Definition: lisp_types.h:134
u8 vnet_lisp_map_register_state_get(void)
Definition: control.c:422
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1538
Reply for show_lisp_map_request_mode.
Definition: lisp.api:301
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:1477
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:328
uword value[0]
Definition: hash.h:164
static void send_lisp_map_server_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: lisp_api.c:892
lisp_msmr_t * map_servers
Definition: control.h:220
add or delete LISP adjacency adjacency
Definition: lisp.api:363
#define foreach_vpe_api_msg
Definition: lisp_api.c:61
static void send_eid_table_vni(u32 vni, unix_shared_memory_queue_t *q, u32 context)
Definition: lisp_api.c:1042
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:437
static void vl_api_lisp_rloc_probe_enable_disable_t_handler(vl_api_lisp_rloc_probe_enable_disable_t *mp)
Definition: lisp_api.c:339
static void vl_api_lisp_add_del_remote_mapping_t_handler(vl_api_lisp_add_del_remote_mapping_t *mp)
Definition: lisp_api.c:493
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:1113
#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:1127
Get LISP map request itr rlocs status.
Definition: lisp.api:707
Reply for show_lisp_rloc_probe_state.
Definition: lisp.api:219
add or delete map request itr rlocs
Definition: lisp.api:382
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:1069
uword * bd_id_by_vni
Definition: control.h:240
#define ip_addr_v4(_a)
Definition: lisp_types.h:54
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:300
void * vl_msg_api_alloc(int nbytes)
u32 petr_map_index
Proxy ETR map index.
Definition: control.h:250
#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:400
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:2155
static void vl_api_show_lisp_pitr_t_handler(vl_api_show_lisp_pitr_t *mp)
Definition: lisp_api.c:1246
Get state of LISP map-register.
Definition: lisp.api:254
Get state of LISP RLOC probing.
Definition: lisp.api:208
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:1610
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:458
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:429
static void send_lisp_locator_set_details(lisp_cp_main_t *lcm, locator_set_t *lsit, unix_shared_memory_queue_t *q, u32 context, u32 ls_index)
Definition: lisp_api.c:644
#define gid_address_mac(_a)
Definition: lisp_types.h:267
set LISP map-request mode.
Definition: lisp.api:279
static void send_lisp_map_resolver_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: lisp_api.c:943
#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:874
Request for LISP adjacencies.
Definition: lisp.api:586
#define hash_free(h)
Definition: hash.h:286
void gid_address_free(gid_address_t *a)
Definition: lisp_types.c:850
static void send_lisp_locator_details(lisp_cp_main_t *lcm, locator_t *loc, unix_shared_memory_queue_t *q, u32 context)
Definition: lisp_api.c:572
u8 authoritative
Definition: lisp_types.h:363
add or delete lisp eid-table
Definition: lisp.api:91
LISP adjacency reply.
Definition: lisp.api:573
#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:924
static void vl_api_lisp_add_del_adjacency_t_handler(vl_api_lisp_add_del_adjacency_t *mp)
Definition: lisp_api.c:548
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:195
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:182
lisp_adjacency_t * vnet_lisp_adjacencies_get_by_vni(u32 vni)
Returns vector of adjacencies.
Definition: control.c:617
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:324
Request for lisp-gpe protocol status.
Definition: lisp.api:684
api_main_t api_main
Definition: api_shared.c:35
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
Definition: control.c:2276
enable or disable LISP feature
Definition: lisp.api:142
vlib_main_t * vm
Definition: buffer.c:283
Shows relationship between vni and vrf/bd.
Definition: lisp.api:597
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:1185
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
#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:69
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void vl_api_lisp_locator_set_dump_t_handler(vl_api_lisp_locator_set_dump_t *mp)
Definition: lisp_api.c:675
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:2146
add or delete map-resolver
Definition: lisp.api:128
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:267
#define ARRAY_LEN(x)
Definition: clib.h:59
lisp_key_type_t key_id
Definition: lisp_types.h:374
Request for map lisp locator status.
Definition: lisp.api:419
#define fid_addr_ippref(_a)
Definition: lisp_types.h:131
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2206
static void send_lisp_eid_table_details(mapping_t *mapit, unix_shared_memory_queue_t *q, u32 context, u8 filter)
Definition: lisp_api.c:756
struct _gid_address_t gid_address_t
Dump lisp eid-table.
Definition: lisp.api:500
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static clib_error_t * lisp_api_hookup(vlib_main_t *vm)
Definition: lisp_api.c:1312
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:671
#define ASSERT(truth)
#define fid_addr_type(_a)
Definition: lisp_types.h:136
unsigned int u32
Definition: types.h:88
Request for eid table summary status.
Definition: lisp.api:538
enable/disable LISP map-register
Definition: lisp.api:243
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1426
Request for locator_set summary status.
Definition: lisp.api:467
#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:413
Reply for lisp_add_del_map_request_itr_rlocs.
Definition: lisp.api:402
gid_dictionary_t mapping_index_by_gid
Definition: control.h:165
u64 size
Definition: vhost-user.h:76
locator_set_t * locator_set_pool
Definition: control.h:177
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:2137
add or delete locator_set
Definition: lisp.api:31
vl_api_remote_locator_t rlocs[rloc_num]
Definition: lisp.api:348
static void lisp_fid_put_api(u8 *dst, fid_address_t *src, u8 *prefix_length)
Definition: lisp_api.c:704
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:472
u64 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
u64 uword
Definition: types.h:112
static void vl_api_lisp_add_del_local_eid_t_handler(vl_api_lisp_add_del_local_eid_t *mp)
Definition: lisp_api.c:233
int vnet_lisp_add_del_locator_set(vnet_lisp_add_del_locator_set_args_t *a, u32 *ls_result)
Definition: control.c:1997
#define gid_address_ip(_a)
Definition: lisp_types.h:264
Status of lisp, enable or disable.
Definition: lisp.api:695
#define gid_address_vni(_a)
Definition: lisp_types.h:271
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:850
static void vl_api_show_lisp_map_request_mode_t_handler(vl_api_show_lisp_map_request_mode_t *mp)
Definition: lisp_api.c:360
static locator_t * unformat_lisp_locs(vl_api_remote_locator_t *rmt_locs, u32 rloc_num)
Definition: lisp_api.c:95
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
Definition: hash.h:349
add or delete locator for locator_set
Definition: lisp.api:62
int vnet_lisp_del_mapping(gid_address_t *eid, u32 *res_map_index)
Removes a mapping.
Definition: control.c:1377
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:1893
mapping_t * mapping_pool
Definition: control.h:168
uword * locator_set_index_by_name
Definition: control.h:183
add or delete remote static mapping
Definition: lisp.api:333
static void setup_message_id_table(api_main_t *am)
Definition: lisp_api.c:1304
static void vl_api_lisp_map_request_mode_t_handler(vl_api_lisp_map_request_mode_t *mp)
Definition: lisp_api.c:374
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:268
void mac_copy(void *dst, void *src)
Definition: lisp_types.c:1051
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:349
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:2213
static void vl_api_lisp_eid_table_vni_dump_t_handler(vl_api_lisp_eid_table_vni_dump_t *mp)
Definition: lisp_api.c:1150
#define vec_foreach(var, vec)
Vector iterator.
Dumps all VNIs used in mappings.
Definition: lisp.api:620
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:167
Request for LISP map-request mode.
Definition: lisp.api:290
vhost_vring_addr_t addr
Definition: vhost-user.h:83
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:201
static void send_eid_table_map_pair(hash_pair_t *p, unix_shared_memory_queue_t *q, u32 context)
Definition: lisp_api.c:994
static void vl_api_show_lisp_rloc_probe_state_t_handler(vl_api_show_lisp_rloc_probe_state_t *mp)
Definition: lisp_api.c:1098
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1682
reply to lisp_eid_table_vni_dump
Definition: lisp.api:631
u32 mreq_itr_rlocs
Definition: control.h:233
u32 * locator_indices
Definition: lisp_types.h:345
uword key
Definition: hash.h:161
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:1010
Request for lisp pitr status.
Definition: lisp.api:726
Add/delete map server.
Definition: lisp.api:112
#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:309
struct _unix_shared_memory_queue unix_shared_memory_queue_t