FD.io VPP  v17.10-9-gd594711
Vector Packet Processing
one_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * one_api.c - Overlay Network Engine API
4  *
5  * Copyright (c) 2016-2017 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_one_remote_locator_t_endian vl_noop_handler
31 #define vl_api_one_remote_locator_t_print vl_noop_handler
32 #define vl_api_one_local_locator_t_endian vl_noop_handler
33 #define vl_api_one_local_locator_t_print vl_noop_handler
34 
35 #define vl_api_one_add_del_locator_set_t_endian vl_noop_handler
36 #define vl_api_one_add_del_locator_set_t_print vl_noop_handler
37 #define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler
38 #define vl_api_one_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_api_one_l2_arp_entry_t_endian vl_noop_handler
46 #define vl_api_one_l2_arp_entry_t_print vl_noop_handler
47 #define vl_api_one_add_del_l2_arp_entry vl_noop_handler
48 #define vl_api_one_l2_arp_bd_get vl_noop_handler
49 
50 #define vl_api_one_ndp_entry_t_endian vl_noop_handler
51 #define vl_api_one_ndp_entry_t_print vl_noop_handler
52 #define vl_api_one_ndp_entries_get_reply_t_endian vl_noop_handler
53 #define vl_api_one_ndp_entries_get_reply_t_print vl_noop_handler
54 
55 #define vl_typedefs /* define message structures */
56 #include <vnet/vnet_all_api_h.h>
57 #undef vl_typedefs
58 
59 #define vl_endianfun /* define message structures */
60 #include <vnet/vnet_all_api_h.h>
61 #undef vl_endianfun
62 
63 /* instantiate all the print functions we know about */
64 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
65 #define vl_printfun
66 #include <vnet/vnet_all_api_h.h>
67 #undef vl_printfun
68 
70 
71 #define REPLY_DETAILS(t, body) \
72 do { \
73  unix_shared_memory_queue_t * q; \
74  rv = vl_msg_api_pd_handler (mp, rv); \
75  q = vl_api_client_index_to_input_queue (mp->client_index); \
76  if (!q) \
77  return; \
78  \
79  rmp = vl_msg_api_alloc (sizeof (*rmp)); \
80  rmp->_vl_msg_id = ntohs((t)); \
81  rmp->context = mp->context; \
82  do {body;} while (0); \
83  vl_msg_api_send_shmem (q, (u8 *)&rmp); \
84 } while(0);
85 
86 #define foreach_vpe_api_msg \
87 _(ONE_ADD_DEL_LOCATOR_SET, one_add_del_locator_set) \
88 _(ONE_ADD_DEL_LOCATOR, one_add_del_locator) \
89 _(ONE_ADD_DEL_LOCAL_EID, one_add_del_local_eid) \
90 _(ONE_ADD_DEL_MAP_RESOLVER, one_add_del_map_resolver) \
91 _(ONE_ADD_DEL_MAP_SERVER, one_add_del_map_server) \
92 _(ONE_ENABLE_DISABLE, one_enable_disable) \
93 _(ONE_RLOC_PROBE_ENABLE_DISABLE, one_rloc_probe_enable_disable) \
94 _(ONE_MAP_REGISTER_ENABLE_DISABLE, one_map_register_enable_disable) \
95 _(ONE_MAP_REGISTER_FALLBACK_THRESHOLD, \
96  one_map_register_fallback_threshold) \
97 _(ONE_ADD_DEL_REMOTE_MAPPING, one_add_del_remote_mapping) \
98 _(ONE_ADD_DEL_ADJACENCY, one_add_del_adjacency) \
99 _(ONE_PITR_SET_LOCATOR_SET, one_pitr_set_locator_set) \
100 _(ONE_NSH_SET_LOCATOR_SET, one_nsh_set_locator_set) \
101 _(ONE_MAP_REQUEST_MODE, one_map_request_mode) \
102 _(ONE_EID_TABLE_ADD_DEL_MAP, one_eid_table_add_del_map) \
103 _(ONE_LOCATOR_SET_DUMP, one_locator_set_dump) \
104 _(ONE_LOCATOR_DUMP, one_locator_dump) \
105 _(ONE_EID_TABLE_DUMP, one_eid_table_dump) \
106 _(ONE_MAP_RESOLVER_DUMP, one_map_resolver_dump) \
107 _(ONE_MAP_SERVER_DUMP, one_map_server_dump) \
108 _(ONE_EID_TABLE_MAP_DUMP, one_eid_table_map_dump) \
109 _(ONE_EID_TABLE_VNI_DUMP, one_eid_table_vni_dump) \
110 _(ONE_ADJACENCIES_GET, one_adjacencies_get) \
111 _(ONE_MAP_REGISTER_SET_TTL, one_map_register_set_ttl) \
112 _(SHOW_ONE_NSH_MAPPING, show_one_nsh_mapping) \
113 _(SHOW_ONE_RLOC_PROBE_STATE, show_one_rloc_probe_state) \
114 _(SHOW_ONE_MAP_REGISTER_STATE, show_one_map_register_state) \
115 _(SHOW_ONE_MAP_REGISTER_TTL, show_one_map_register_ttl) \
116 _(SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD, \
117  show_one_map_register_fallback_threshold) \
118 _(SHOW_ONE_STATUS, show_one_status) \
119 _(ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
120  one_add_del_map_request_itr_rlocs) \
121 _(ONE_GET_MAP_REQUEST_ITR_RLOCS, one_get_map_request_itr_rlocs) \
122 _(SHOW_ONE_PITR, show_one_pitr) \
123 _(SHOW_ONE_MAP_REQUEST_MODE, show_one_map_request_mode) \
124 _(ONE_USE_PETR, one_use_petr) \
125 _(SHOW_ONE_USE_PETR, show_one_use_petr) \
126 _(SHOW_ONE_STATS_ENABLE_DISABLE, show_one_stats_enable_disable) \
127 _(ONE_STATS_ENABLE_DISABLE, one_stats_enable_disable) \
128 _(ONE_STATS_DUMP, one_stats_dump) \
129 _(ONE_STATS_FLUSH, one_stats_flush) \
130 _(ONE_L2_ARP_BD_GET, one_l2_arp_bd_get) \
131 _(ONE_L2_ARP_ENTRIES_GET, one_l2_arp_entries_get) \
132 _(ONE_ADD_DEL_L2_ARP_ENTRY, one_add_del_l2_arp_entry) \
133 _(ONE_ADD_DEL_NDP_ENTRY, one_add_del_ndp_entry) \
134 _(ONE_NDP_BD_GET, one_ndp_bd_get) \
135 _(ONE_NDP_ENTRIES_GET, one_ndp_entries_get) \
136 _(ONE_SET_TRANSPORT_PROTOCOL, one_set_transport_protocol) \
137 _(ONE_GET_TRANSPORT_PROTOCOL, one_get_transport_protocol)
138 
139 static locator_t *
141 {
142  u32 i;
143  locator_t *locs = 0, loc;
145 
146  for (i = 0; i < rloc_num; i++)
147  {
148  /* remote locators */
149  r = &rmt_locs[i];
150  memset (&loc, 0, sizeof (loc));
151  gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
152 
153  loc.priority = r->priority;
154  loc.weight = r->weight;
155 
156  vec_add1 (locs, loc);
157  }
158  return locs;
159 }
160 
161 static void
163  mp)
164 {
165  vl_api_one_map_register_set_ttl_reply_t *rmp;
166  int rv = 0;
167 
168  mp->ttl = clib_net_to_host_u32 (mp->ttl);
170 
171  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_SET_TTL_REPLY);
172 }
173 
174 static void
177 {
179  int rv = 0;
180 
182  /* *INDENT-OFF* */
183  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_TTL_REPLY,
184  ({
185  rmp->ttl = clib_host_to_net_u32 (ttl);
186  }));
187  /* *INDENT-ON* */
188 }
189 
190 static void
192  mp)
193 {
195  int rv = 0;
197  locator_t locator;
199  u32 ls_index = ~0, locator_num;
200  u8 *locator_name = NULL;
201  int i;
202 
203  memset (a, 0, sizeof (a[0]));
204 
205  locator_name = format (0, "%s", mp->locator_set_name);
206 
207  a->name = locator_name;
208  a->is_add = mp->is_add;
209  a->local = 1;
210  locator_num = clib_net_to_host_u32 (mp->locator_num);
211 
212  memset (&locator, 0, sizeof (locator));
213  for (i = 0; i < locator_num; i++)
214  {
215  ls_loc = &mp->locators[i];
216  VALIDATE_SW_IF_INDEX (ls_loc);
217 
218  locator.sw_if_index = htonl (ls_loc->sw_if_index);
219  locator.priority = ls_loc->priority;
220  locator.weight = ls_loc->weight;
221  locator.local = 1;
222  vec_add1 (a->locators, locator);
223  }
224 
225  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
226 
228 
229  vec_free (locator_name);
230  vec_free (a->locators);
231 
232  /* *INDENT-OFF* */
233  REPLY_MACRO2 (VL_API_ONE_ADD_DEL_LOCATOR_SET_REPLY,
234  ({
235  rmp->ls_index = clib_host_to_net_u32 (ls_index);
236  }));
237  /* *INDENT-ON* */
238 }
239 
240 static void
242 {
243  vl_api_one_add_del_locator_reply_t *rmp;
244  int rv = 0;
245  locator_t locator, *locators = NULL;
247  u32 ls_index = ~0;
248  u8 *locator_name = NULL;
249 
250  memset (&locator, 0, sizeof (locator));
251  memset (a, 0, sizeof (a[0]));
252 
253  locator.sw_if_index = ntohl (mp->sw_if_index);
254  locator.priority = mp->priority;
255  locator.weight = mp->weight;
256  locator.local = 1;
257  vec_add1 (locators, locator);
258 
259  locator_name = format (0, "%s", mp->locator_set_name);
260 
261  a->name = locator_name;
262  a->locators = locators;
263  a->is_add = mp->is_add;
264  a->local = 1;
265 
266  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
267 
268  vec_free (locators);
269  vec_free (locator_name);
270 
271  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCATOR_REPLY);
272 }
273 
274 typedef struct
275 {
278 } __attribute__ ((__packed__)) lisp_nsh_api_t;
279 
280 static int
281 unformat_one_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
282  u8 len)
283 {
284  lisp_nsh_api_t *nsh;
285 
286  switch (type)
287  {
288  case 0: /* ipv4 */
290  gid_address_ip_set (dst, src, IP4);
291  gid_address_ippref_len (dst) = len;
293  break;
294  case 1: /* ipv6 */
296  gid_address_ip_set (dst, src, IP6);
297  gid_address_ippref_len (dst) = len;
299  break;
300  case 2: /* l2 mac */
302  clib_memcpy (&gid_address_mac (dst), src, 6);
303  break;
304  case 3: /* NSH */
306  nsh = src;
307  gid_address_nsh_spi (dst) = clib_net_to_host_u32 (nsh->spi);
308  gid_address_nsh_si (dst) = nsh->si;
309  break;
310  default:
311  /* unknown type */
312  return VNET_API_ERROR_INVALID_VALUE;
313  }
314 
315  gid_address_vni (dst) = vni;
316 
317  return 0;
318 }
319 
320 static void
322 {
323  vl_api_one_add_del_local_eid_reply_t *rmp;
325  int rv = 0;
326  gid_address_t _eid, *eid = &_eid;
327  uword *p = NULL;
328  u32 locator_set_index = ~0, map_index = ~0;
330  u8 *name = NULL, *key = NULL;
331  memset (a, 0, sizeof (a[0]));
332  memset (eid, 0, sizeof (eid[0]));
333 
334  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
335  mp->eid_type, mp->eid, mp->prefix_len);
336  if (rv)
337  goto out;
338 
339  if (gid_address_type (eid) == GID_ADDR_NSH)
340  {
341  rv = VNET_API_ERROR_INVALID_VALUE;
342  goto out;
343  }
344 
345  name = format (0, "%s", mp->locator_set_name);
346  p = hash_get_mem (lcm->locator_set_index_by_name, name);
347  if (!p)
348  {
349  rv = VNET_API_ERROR_INVALID_VALUE;
350  goto out;
351  }
352  locator_set_index = p[0];
353 
354  if (*mp->key)
355  key = format (0, "%s", mp->key);
356 
357  /* XXX treat batch configuration */
358  a->is_add = mp->is_add;
359  gid_address_copy (&a->eid, eid);
360  a->locator_set_index = locator_set_index;
361  a->local = 1;
362  a->key = key;
363  a->key_id = clib_net_to_host_u16 (mp->key_id);
364 
365  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
366 
367 out:
368  vec_free (name);
369  vec_free (key);
370  gid_address_free (&a->eid);
371 
372  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCAL_EID_REPLY);
373 }
374 
375 static void
378 {
379  vl_api_one_eid_table_add_del_map_reply_t *rmp;
380  int rv = 0;
381  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
382  clib_net_to_host_u32 (mp->dp_table),
383  mp->is_l2, mp->is_add);
384 REPLY_MACRO (VL_API_ONE_EID_TABLE_ADD_DEL_MAP_REPLY)}
385 
386 static void
388 {
389  vl_api_one_add_del_map_server_reply_t *rmp;
390  int rv = 0;
391  ip_address_t addr;
392 
393  memset (&addr, 0, sizeof (addr));
394 
395  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
396  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
397 
398  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
399 }
400 
401 static void
403  * mp)
404 {
405  vl_api_one_add_del_map_resolver_reply_t *rmp;
406  int rv = 0;
408 
409  memset (a, 0, sizeof (a[0]));
410 
411  a->is_add = mp->is_add;
412  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
413 
415 
416  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_RESOLVER_REPLY);
417 }
418 
419 static void
422 {
423  vl_api_one_map_register_enable_disable_reply_t *rmp;
424  int rv = 0;
425 
427  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
428 }
429 
430 static void
433 {
434  vl_api_one_rloc_probe_enable_disable_reply_t *rmp;
435  int rv = 0;
436 
438  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
439 }
440 
441 static void
443 {
444  vl_api_one_enable_disable_reply_t *rmp;
445  int rv = 0;
446 
448  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
449 }
450 
451 static void
454 {
455  int rv = 0;
457 
458  /* *INDENT-OFF* */
459  REPLY_MACRO2(VL_API_SHOW_ONE_MAP_REQUEST_MODE_REPLY,
460  ({
462  }));
463  /* *INDENT-ON* */
464 }
465 
466 static void
468 {
469  vl_api_one_map_request_mode_reply_t *rmp;
470  int rv = 0;
471 
473 
474  REPLY_MACRO (VL_API_ONE_MAP_REQUEST_MODE_REPLY);
475 }
476 
477 static void
479  * mp)
480 {
481  vl_api_one_nsh_set_locator_set_reply_t *rmp;
482  int rv = 0;
483  u8 *ls_name = 0;
484 
485  ls_name = format (0, "%s", mp->ls_name);
486  rv = vnet_lisp_nsh_set_locator_set (ls_name, mp->is_add);
487  vec_free (ls_name);
488 
489  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
490 }
491 
492 static void
494  * mp)
495 {
496  vl_api_one_pitr_set_locator_set_reply_t *rmp;
497  int rv = 0;
498  u8 *ls_name = 0;
499 
500  ls_name = format (0, "%s", mp->ls_name);
501  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
502  vec_free (ls_name);
503 
504  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
505 }
506 
507 static void
509 {
510  vl_api_one_use_petr_reply_t *rmp;
511  int rv = 0;
512  ip_address_t addr;
513 
514  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
515  rv = vnet_lisp_use_petr (&addr, mp->is_add);
516 
517  REPLY_MACRO (VL_API_ONE_USE_PETR_REPLY);
518 }
519 
520 static void
522 {
526  mapping_t *m;
527  locator_set_t *ls = 0;
528  int rv = 0;
529  locator_t *loc = 0;
530  u8 status = 0;
532 
534  if (q == 0)
535  {
536  return;
537  }
538 
539  memset (&addr, 0, sizeof (addr));
540  status = lcm->flags & LISP_FLAG_USE_PETR;
541  if (status)
542  {
544  if (~0 != m->locator_set_index)
545  {
546  ls =
548  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
549  gid_address_copy (&addr, &loc->address);
550  }
551  }
552 
553  /* *INDENT-OFF* */
554  REPLY_MACRO2 (VL_API_SHOW_ONE_USE_PETR_REPLY,
555  {
556  rmp->status = status;
557  ip_address_t *ip = &gid_address_ip (&addr);
558  switch (ip_addr_version (ip))
559  {
560  case IP4:
561  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
562  sizeof (ip_addr_v4 (ip)));
563  break;
564 
565  case IP6:
566  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
567  sizeof (ip_addr_v6 (ip)));
568  break;
569 
570  default:
571  ASSERT (0);
572  }
573  rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
574  });
575  /* *INDENT-ON* */
576 }
577 
578 static void
581 {
582  vl_api_one_add_del_map_request_itr_rlocs_reply_t *rmp;
583  int rv = 0;
584  u8 *locator_set_name = NULL;
586 
587  locator_set_name = format (0, "%s", mp->locator_set_name);
588 
589  a->is_add = mp->is_add;
590  a->locator_set_name = locator_set_name;
591 
593 
594  vec_free (locator_set_name);
595 
596  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
597 }
598 
599 static void
602 {
603  locator_t *rlocs = 0;
604  vl_api_one_add_del_remote_mapping_reply_t *rmp;
605  int rv = 0;
606  gid_address_t _eid, *eid = &_eid;
607  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
608 
609  memset (eid, 0, sizeof (eid[0]));
610 
611  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
612  mp->eid_type, mp->eid, mp->eid_len);
613  if (rv)
614  goto send_reply;
615 
616  rlocs = unformat_one_locs (mp->rlocs, rloc_num);
617 
618  if (!mp->is_add)
619  {
621  gid_address_copy (&a->reid, eid);
622  a->is_add = 0;
624  if (rv)
625  {
626  goto out;
627  }
628  }
629 
630  /* NOTE: for now this works as a static remote mapping, i.e.,
631  * not authoritative and ttl infinite. */
632  if (mp->is_add)
633  {
634  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
635  memset (m_args, 0, sizeof (m_args[0]));
636  gid_address_copy (&m_args->eid, eid);
637  m_args->action = mp->action;
638  m_args->is_static = 1;
639  m_args->ttl = ~0;
640  m_args->authoritative = 0;
641  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
642  }
643  else
644  rv = vnet_lisp_del_mapping (eid, NULL);
645 
646  if (mp->del_all)
648 
649 out:
650  vec_free (rlocs);
651 send_reply:
652  REPLY_MACRO (VL_API_ONE_ADD_DEL_REMOTE_MAPPING_REPLY);
653 }
654 
655 static void
657 {
658  vl_api_one_add_del_adjacency_reply_t *rmp;
660 
661  int rv = 0;
662  memset (a, 0, sizeof (a[0]));
663 
664  rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
665  mp->eid_type, mp->leid, mp->leid_len);
666  rv |= unformat_one_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
667  mp->eid_type, mp->reid, mp->reid_len);
668 
669  if (rv)
670  goto send_reply;
671 
672  a->is_add = mp->is_add;
674 
675 send_reply:
676  REPLY_MACRO (VL_API_ONE_ADD_DEL_ADJACENCY_REPLY);
677 }
678 
679 static void
681  locator_t * loc,
682  unix_shared_memory_queue_t * q, u32 context)
683 {
685 
686  rmp = vl_msg_api_alloc (sizeof (*rmp));
687  memset (rmp, 0, sizeof (*rmp));
688  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
689  rmp->context = context;
690 
691  rmp->local = loc->local;
692  if (loc->local)
693  {
694  rmp->sw_if_index = ntohl (loc->sw_if_index);
695  }
696  else
697  {
698  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
700  }
701  rmp->priority = loc->priority;
702  rmp->weight = loc->weight;
703 
704  vl_msg_api_send_shmem (q, (u8 *) & rmp);
705 }
706 
707 static void
709 {
710  u8 *ls_name = 0;
713  locator_set_t *lsit = 0;
714  locator_t *loc = 0;
715  u32 ls_index = ~0, *locit = 0;
716  uword *p = 0;
717 
719  if (q == 0)
720  {
721  return;
722  }
723 
724  if (mp->is_index_set)
725  ls_index = htonl (mp->ls_index);
726  else
727  {
728  /* make sure we get a proper C-string */
729  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
730  ls_name = format (0, "%s", mp->ls_name);
731  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
732  if (!p)
733  goto out;
734  ls_index = p[0];
735  }
736 
737  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
738  return;
739 
740  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
741 
742  vec_foreach (locit, lsit->locator_indices)
743  {
744  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
745  send_one_locator_details (lcm, loc, q, mp->context);
746  };
747 out:
748  vec_free (ls_name);
749 }
750 
751 static void
753  locator_set_t * lsit,
755  u32 context, u32 ls_index)
756 {
758  u8 *str = 0;
759 
760  rmp = vl_msg_api_alloc (sizeof (*rmp));
761  memset (rmp, 0, sizeof (*rmp));
762  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
763  rmp->context = context;
764 
765  rmp->ls_index = htonl (ls_index);
766  if (lsit->local)
767  {
768  ASSERT (lsit->name != NULL);
769  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
770  vec_len (lsit->name));
771  }
772  else
773  {
774  str = format (0, "<remote-%d>", ls_index);
775  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
776  vec_free (str);
777  }
778 
779  vl_msg_api_send_shmem (q, (u8 *) & rmp);
780 }
781 
782 static void
784 {
787  locator_set_t *lsit = NULL;
788  u8 filter;
789 
791  if (q == 0)
792  {
793  return;
794  }
795 
796  filter = mp->filter;
797  /* *INDENT-OFF* */
798  pool_foreach (lsit, lcm->locator_set_pool,
799  ({
800  if (filter && !((1 == filter && lsit->local) ||
801  (2 == filter && !lsit->local)))
802  {
803  continue;
804  }
805  send_one_locator_set_details (lcm, lsit, q, mp->context,
806  lsit - lcm->locator_set_pool);
807  }));
808  /* *INDENT-ON* */
809 }
810 
811 static void
812 one_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
813 {
814  ASSERT (prefix_length);
815  ip_prefix_t *ippref = &fid_addr_ippref (src);
816 
817  switch (fid_addr_type (src))
818  {
819  case FID_ADDR_IP_PREF:
820  if (ip_prefix_version (ippref) == IP4)
821  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
822  else
823  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
824  prefix_length[0] = ip_prefix_len (ippref);
825  break;
826 
827  case FID_ADDR_MAC:
828  prefix_length[0] = 0;
829  clib_memcpy (dst, fid_addr_mac (src), 6);
830  break;
831 
832  default:
833  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
834  break;
835  }
836 }
837 
838 static u8
840 {
841  ip_prefix_t *ippref;
842 
843  switch (fid_addr_type (fid))
844  {
845  case FID_ADDR_IP_PREF:
846  ippref = &fid_addr_ippref (fid);
847  if (ip_prefix_version (ippref) == IP4)
848  return 0;
849  else if (ip_prefix_version (ippref) == IP6)
850  return 1;
851  else
852  return ~0;
853 
854  case FID_ADDR_MAC:
855  return 2;
856  case FID_ADDR_NSH:
857  return 3;
858  }
859 
860  return ~0;
861 }
862 
863 static void
866  u32 context, u8 filter)
867 {
868  fid_address_t *fid;
870  locator_set_t *ls = 0;
872  gid_address_t *gid = NULL;
873  u8 *mac = 0;
874  ip_prefix_t *ip_prefix = NULL;
875 
876  if (mapit->pitr_set || mapit->nsh_set)
877  return;
878 
879  switch (filter)
880  {
881  case 0: /* all mappings */
882  break;
883 
884  case 1: /* local only */
885  if (!mapit->local)
886  return;
887  break;
888  case 2: /* remote only */
889  if (mapit->local)
890  return;
891  break;
892  default:
893  clib_warning ("Filter error, unknown filter: %d", filter);
894  return;
895  }
896 
897  gid = &mapit->eid;
898  ip_prefix = &gid_address_ippref (gid);
899  mac = gid_address_mac (gid);
900 
901  rmp = vl_msg_api_alloc (sizeof (*rmp));
902  memset (rmp, 0, sizeof (*rmp));
903  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
904 
906  if (vec_len (ls->locator_indices) == 0)
907  rmp->locator_set_index = ~0;
908  else
909  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
910 
911  rmp->is_local = mapit->local;
912  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
913  rmp->action = mapit->action;
914  rmp->authoritative = mapit->authoritative;
915 
916  switch (gid_address_type (gid))
917  {
918  case GID_ADDR_SRC_DST:
919  rmp->is_src_dst = 1;
920  fid = &gid_address_sd_src (gid);
921  rmp->eid_type = fid_type_to_api_type (fid);
923  &rmp->seid_prefix_len);
924  one_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
925  &rmp->eid_prefix_len);
926  break;
927  case GID_ADDR_IP_PREFIX:
928  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
929  if (ip_prefix_version (ip_prefix) == IP4)
930  {
931  rmp->eid_type = 0; /* ipv4 type */
932  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
933  sizeof (ip_prefix_v4 (ip_prefix)));
934  }
935  else
936  {
937  rmp->eid_type = 1; /* ipv6 type */
938  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
939  sizeof (ip_prefix_v6 (ip_prefix)));
940  }
941  break;
942  case GID_ADDR_MAC:
943  rmp->eid_type = 2; /* l2 mac type */
944  clib_memcpy (rmp->eid, mac, 6);
945  break;
946  case GID_ADDR_NSH:
947  rmp->eid_type = 3; /* NSH type */
948  lisp_nsh_api_t nsh;
949  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (gid));
950  nsh.si = gid_address_nsh_si (gid);
951  clib_memcpy (rmp->eid, &nsh, sizeof (nsh));
952  break;
953  default:
954  ASSERT (0);
955  }
956  rmp->context = context;
957  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
958  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
959  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
960  vl_msg_api_send_shmem (q, (u8 *) & rmp);
961 }
962 
963 static void
965 {
966  u32 mi;
969  mapping_t *mapit = NULL;
970  gid_address_t _eid, *eid = &_eid;
971 
973  if (q == 0)
974  {
975  return;
976  }
977 
978  if (mp->eid_set)
979  {
980  memset (eid, 0, sizeof (*eid));
981 
982  unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
983  mp->eid_type, mp->eid, mp->prefix_length);
984 
986  if ((u32) ~ 0 == mi)
987  return;
988 
989  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
990  send_one_eid_table_details (mapit, q, mp->context,
991  0 /* ignore filter */ );
992  }
993  else
994  {
995  /* *INDENT-OFF* */
996  pool_foreach (mapit, lcm->mapping_pool,
997  ({
998  send_one_eid_table_details(mapit, q, mp->context,
999  mp->filter);
1000  }));
1001  /* *INDENT-ON* */
1002  }
1003 }
1004 
1005 static void
1006 send_one_map_server_details (ip_address_t * ip,
1007  unix_shared_memory_queue_t * q, u32 context)
1008 {
1010 
1011  rmp = vl_msg_api_alloc (sizeof (*rmp));
1012  memset (rmp, 0, sizeof (*rmp));
1013  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
1014 
1015  switch (ip_addr_version (ip))
1016  {
1017  case IP4:
1018  rmp->is_ipv6 = 0;
1019  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
1020  sizeof (ip_addr_v4 (ip)));
1021  break;
1022 
1023  case IP6:
1024  rmp->is_ipv6 = 1;
1025  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
1026  sizeof (ip_addr_v6 (ip)));
1027  break;
1028 
1029  default:
1030  ASSERT (0);
1031  }
1032  rmp->context = context;
1033 
1034  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1035 }
1036 
1037 static void
1039 {
1042  lisp_msmr_t *mr;
1043 
1045  if (q == 0)
1046  {
1047  return;
1048  }
1049 
1050  vec_foreach (mr, lcm->map_servers)
1051  {
1053  }
1054 }
1055 
1056 static void
1058  unix_shared_memory_queue_t * q, u32 context)
1059 {
1061 
1062  rmp = vl_msg_api_alloc (sizeof (*rmp));
1063  memset (rmp, 0, sizeof (*rmp));
1064  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
1065 
1066  switch (ip_addr_version (ip))
1067  {
1068  case IP4:
1069  rmp->is_ipv6 = 0;
1070  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
1071  sizeof (ip_addr_v4 (ip)));
1072  break;
1073 
1074  case IP6:
1075  rmp->is_ipv6 = 1;
1076  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
1077  sizeof (ip_addr_v6 (ip)));
1078  break;
1079 
1080  default:
1081  ASSERT (0);
1082  }
1083  rmp->context = context;
1084 
1085  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1086 }
1087 
1088 static void
1090 {
1093  lisp_msmr_t *mr;
1094 
1096  if (q == 0)
1097  {
1098  return;
1099  }
1100 
1101  vec_foreach (mr, lcm->map_resolvers)
1102  {
1104  }
1105 }
1106 
1107 static void
1109  unix_shared_memory_queue_t * q, u32 context)
1110 {
1112 
1113  rmp = vl_msg_api_alloc (sizeof (*rmp));
1114  memset (rmp, 0, sizeof (*rmp));
1115  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
1116 
1117  rmp->vni = clib_host_to_net_u32 (p->key);
1118  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1119  rmp->context = context;
1120  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1121 }
1122 
1123 static void
1125 {
1128  hash_pair_t *p;
1129  uword *vni_table = 0;
1130 
1132  if (q == 0)
1133  {
1134  return;
1135  }
1136 
1137  if (mp->is_l2)
1138  {
1139  vni_table = lcm->bd_id_by_vni;
1140  }
1141  else
1142  {
1143  vni_table = lcm->table_id_by_vni;
1144  }
1145 
1146  /* *INDENT-OFF* */
1147  hash_foreach_pair (p, vni_table,
1148  ({
1149  send_eid_table_map_pair (p, q, mp->context);
1150  }));
1151  /* *INDENT-ON* */
1152 }
1153 
1154 static void
1156 {
1158 
1159  rmp = vl_msg_api_alloc (sizeof (*rmp));
1160  memset (rmp, 0, sizeof (*rmp));
1161  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
1162  rmp->context = context;
1163  rmp->vni = clib_host_to_net_u32 (vni);
1164  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1165 }
1166 
1167 static void
1169 {
1170  lisp_adjacency_t *adj;
1172  u32 i, n = vec_len (adjs);
1173  lisp_nsh_api_t nsh;
1174 
1175  for (i = 0; i < n; i++)
1176  {
1177  adj = vec_elt_at_index (adjs, i);
1178  memset (&a, 0, sizeof (a));
1179 
1180  switch (gid_address_type (&adj->reid))
1181  {
1182  case GID_ADDR_IP_PREFIX:
1185  if (gid_address_ip_version (&adj->reid) == IP4)
1186  {
1187  a.eid_type = 0; /* ipv4 type */
1188  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1189  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1190  }
1191  else
1192  {
1193  a.eid_type = 1; /* ipv6 type */
1194  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1195  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1196  }
1197  break;
1198  case GID_ADDR_MAC:
1199  a.eid_type = 2; /* l2 mac type */
1200  mac_copy (a.reid, gid_address_mac (&adj->reid));
1201  mac_copy (a.leid, gid_address_mac (&adj->leid));
1202  break;
1203  case GID_ADDR_NSH:
1204  a.eid_type = 3; /* NSH type */
1205  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (&adj->reid));
1206  nsh.si = gid_address_nsh_si (&adj->reid);
1207  clib_memcpy (a.reid, &nsh, sizeof (nsh));
1208 
1209  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (&adj->leid));
1210  nsh.si = gid_address_nsh_si (&adj->leid);
1211  clib_memcpy (a.leid, &nsh, sizeof (nsh));
1212  break;
1213  default:
1214  ASSERT (0);
1215  }
1216  dst[i] = a;
1217  }
1218 }
1219 
1220 static void
1223 {
1225  int rv = 0;
1226 
1227  /* *INDENT-OFF* */
1228  REPLY_MACRO2 (VL_API_SHOW_ONE_RLOC_PROBE_STATE_REPLY,
1229  {
1231  });
1232  /* *INDENT-ON* */
1233 }
1234 
1235 static void
1238 {
1240  int rv = 0;
1241 
1242  /* *INDENT-OFF* */
1243  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_STATE_REPLY,
1244  {
1246  });
1247  /* *INDENT-ON* */
1248 }
1249 
1250 static void
1252 {
1254  lisp_adjacency_t *adjs = 0;
1255  int rv = 0;
1256  u32 size = ~0;
1257  u32 vni = clib_net_to_host_u32 (mp->vni);
1258 
1259  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1260  size = vec_len (adjs) * sizeof (vl_api_one_adjacency_t);
1261 
1262  /* *INDENT-OFF* */
1263  REPLY_MACRO4 (VL_API_ONE_ADJACENCIES_GET_REPLY, size,
1264  {
1265  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1266  one_adjacency_copy (rmp->adjacencies, adjs);
1267  });
1268  /* *INDENT-ON* */
1269 
1270  vec_free (adjs);
1271 }
1272 
1273 static void
1275 {
1276  hash_pair_t *p;
1277  u32 *vnis = 0;
1280 
1282  if (q == 0)
1283  {
1284  return;
1285  }
1286 
1287  /* *INDENT-OFF* */
1289  ({
1290  hash_set (vnis, p->key, 0);
1291  }));
1292 
1294  ({
1295  hash_set (vnis, p->key, 0);
1296  }));
1297 
1298  hash_foreach_pair (p, vnis,
1299  ({
1300  send_eid_table_vni (p->key, q, mp->context);
1301  }));
1302  /* *INDENT-ON* */
1303 
1304  hash_free (vnis);
1305 }
1306 
1307 static void
1309 {
1312  int rv = 0;
1313 
1315  if (q == 0)
1316  {
1317  return;
1318  }
1319 
1320  /* *INDENT-OFF* */
1321  REPLY_MACRO2(VL_API_SHOW_ONE_STATUS_REPLY,
1322  ({
1325  }));
1326  /* *INDENT-ON* */
1327 }
1328 
1329 static void
1332 {
1336  locator_set_t *loc_set = 0;
1337  u8 *tmp_str = 0;
1338  int rv = 0;
1339 
1341  if (q == 0)
1342  {
1343  return;
1344  }
1345 
1346  if (~0 == lcm->mreq_itr_rlocs)
1347  {
1348  tmp_str = format (0, " ");
1349  }
1350  else
1351  {
1352  loc_set =
1354  tmp_str = format (0, "%s", loc_set->name);
1355  }
1356 
1357  /* *INDENT-OFF* */
1358  REPLY_MACRO2(VL_API_ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1359  ({
1360  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1361  ARRAY_LEN(rmp->locator_set_name) - 1);
1362  }));
1363  /* *INDENT-ON* */
1364 
1365  vec_free (tmp_str);
1366 }
1367 
1368 static void
1370 {
1374  mapping_t *m;
1375  locator_set_t *ls = 0;
1376  u8 *tmp_str = 0;
1377  u8 is_set = 0;
1378  int rv = 0;
1379 
1381  if (q == 0)
1382  {
1383  return;
1384  }
1385 
1386  if (lcm->nsh_map_index == (u32) ~ 0)
1387  {
1388  tmp_str = format (0, "N/A");
1389  }
1390  else
1391  {
1392  m = pool_elt_at_index (lcm->mapping_pool, lcm->nsh_map_index);
1393  if (~0 != m->locator_set_index)
1394  {
1395  ls =
1397  tmp_str = format (0, "%s", ls->name);
1398  is_set = 1;
1399  }
1400  else
1401  {
1402  tmp_str = format (0, "N/A");
1403  }
1404  }
1405  vec_add1 (tmp_str, 0);
1406 
1407  /* *INDENT-OFF* */
1408  REPLY_MACRO2(VL_API_SHOW_ONE_NSH_MAPPING_REPLY,
1409  ({
1410  rmp->is_set = is_set;
1411  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1412  ARRAY_LEN(rmp->locator_set_name) - 1);
1413  }));
1414  /* *INDENT-ON* */
1415 }
1416 
1417 static void
1419 {
1423  mapping_t *m;
1424  locator_set_t *ls = 0;
1425  u8 *tmp_str = 0;
1426  int rv = 0;
1427 
1429  if (q == 0)
1430  {
1431  return;
1432  }
1433 
1434  if (!lcm->lisp_pitr)
1435  {
1436  tmp_str = format (0, "N/A");
1437  }
1438  else
1439  {
1441  if (~0 != m->locator_set_index)
1442  {
1443  ls =
1445  tmp_str = format (0, "%s", ls->name);
1446  }
1447  else
1448  {
1449  tmp_str = format (0, "N/A");
1450  }
1451  }
1452  vec_add1 (tmp_str, 0);
1453 
1454  /* *INDENT-OFF* */
1455  REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
1456  ({
1457  rmp->status = lcm->lisp_pitr;
1458  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1459  ARRAY_LEN(rmp->locator_set_name) - 1);
1460  }));
1461  /* *INDENT-ON* */
1462 }
1463 
1464 static void
1467 {
1469  vnet_api_error_t rv = 0;
1470 
1471  /* *INDENT-OFF* */
1472  REPLY_MACRO2 (VL_API_SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,
1473  ({
1475  }));
1476  /* *INDENT-ON* */
1477 }
1478 
1479 static void
1482 {
1483  vl_api_one_enable_disable_reply_t *rmp = NULL;
1484 
1486  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
1487 }
1488 
1489 static void
1490 lisp_fid_addr_to_api (fid_address_t * fid, u8 * dst, u8 * api_eid_type,
1491  u8 * prefix_length)
1492 {
1493  switch (fid_addr_type (fid))
1494  {
1495  case FID_ADDR_IP_PREF:
1496  *prefix_length = fid_addr_prefix_length (fid);
1497  if (fid_addr_ip_version (fid) == IP4)
1498  {
1499  *api_eid_type = 0; /* ipv4 type */
1500  clib_memcpy (dst, &fid_addr_ippref (fid), 4);
1501  }
1502  else
1503  {
1504  *api_eid_type = 1; /* ipv6 type */
1505  clib_memcpy (dst, &fid_addr_ippref (fid), 16);
1506  }
1507  break;
1508  case FID_ADDR_MAC:
1509  *api_eid_type = 2; /* l2 mac type */
1510  mac_copy (dst, fid_addr_mac (fid));
1511  break;
1512  default:
1513  ASSERT (0);
1514  }
1515 }
1516 
1517 static void
1519 {
1520  vl_api_one_stats_flush_reply_t *rmp;
1521  u8 rv;
1522 
1523  rv = vnet_lisp_flush_stats ();
1524  REPLY_MACRO (VL_API_ONE_STATS_FLUSH_REPLY);
1525 }
1526 
1527 static void
1529 {
1531  lisp_api_stats_t *stats, *stat;
1532  u8 rv = 0;
1533 
1534  stats = vnet_lisp_get_stats ();
1535  vec_foreach (stat, stats)
1536  {
1537  /* *INDENT-OFF* */
1538  REPLY_DETAILS (VL_API_ONE_STATS_DETAILS,
1539  ({
1540  lisp_fid_addr_to_api (&stat->deid, rmp->deid, &rmp->eid_type,
1541  &rmp->deid_pref_len);
1542  lisp_fid_addr_to_api (&stat->seid, rmp->seid, &rmp->eid_type,
1543  &rmp->seid_pref_len);
1544  rmp->vni = clib_host_to_net_u32 (stat->vni);
1545 
1546  rmp->is_ip4 = ip_addr_version (&stat->rmt_rloc) == IP4 ? 1 : 0;
1547  ip_address_copy_addr (rmp->rloc, &stat->rmt_rloc);
1548  ip_address_copy_addr (rmp->lloc, &stat->loc_rloc);
1549 
1550  rmp->pkt_count = clib_host_to_net_u32 (stat->counters.packets);
1551  rmp->bytes = clib_host_to_net_u32 (stat->counters.bytes);
1552  }));
1553  /* *INDENT-ON* */
1554  }
1555 }
1556 
1557 static void
1560 {
1561  vl_api_one_add_del_l2_arp_entry_reply_t *rmp;
1562  int rv = 0;
1563  gid_address_t _arp, *arp = &_arp;
1564  memset (arp, 0, sizeof (*arp));
1565 
1567  gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
1568 
1569  /* vpp keeps ip4 addresses in network byte order */
1570  ip_address_set (&gid_address_arp_ndp_ip (arp), &mp->ip4, IP4);
1571 
1572  rv = vnet_lisp_add_del_l2_arp_ndp_entry (arp, mp->mac, mp->is_add);
1573 
1574  REPLY_MACRO (VL_API_ONE_ADD_DEL_L2_ARP_ENTRY_REPLY);
1575 }
1576 
1577 static void
1579 {
1580  vl_api_one_add_del_ndp_entry_reply_t *rmp;
1581  int rv = 0;
1582  gid_address_t _g, *g = &_g;
1583  memset (g, 0, sizeof (*g));
1584 
1586  gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd);
1588 
1589  rv = vnet_lisp_add_del_l2_arp_ndp_entry (g, mp->mac, mp->is_add);
1590 
1591  REPLY_MACRO (VL_API_ONE_ADD_DEL_NDP_ENTRY_REPLY);
1592 }
1593 
1594 static void
1596 {
1598  int rv = 0;
1599  u32 i = 0;
1600  hash_pair_t *p;
1601 
1602  u32 *bds = vnet_lisp_ndp_bds_get ();
1603  u32 size = hash_elts (bds) * sizeof (u32);
1604 
1605  /* *INDENT-OFF* */
1606  REPLY_MACRO4 (VL_API_ONE_NDP_BD_GET_REPLY, size,
1607  {
1608  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1609  hash_foreach_pair (p, bds,
1610  ({
1611  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1612  }));
1613  });
1614  /* *INDENT-ON* */
1615 
1616  hash_free (bds);
1617 }
1618 
1619 static void
1621 {
1623  int rv = 0;
1624  u32 i = 0;
1625  hash_pair_t *p;
1626 
1627  u32 *bds = vnet_lisp_l2_arp_bds_get ();
1628  u32 size = hash_elts (bds) * sizeof (u32);
1629 
1630  /* *INDENT-OFF* */
1631  REPLY_MACRO4 (VL_API_ONE_L2_ARP_BD_GET_REPLY, size,
1632  {
1633  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1634  hash_foreach_pair (p, bds,
1635  ({
1636  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1637  }));
1638  });
1639  /* *INDENT-ON* */
1640 
1641  hash_free (bds);
1642 }
1643 
1644 static void
1646 {
1648  lisp_api_l2_arp_entry_t *entries = 0, *e;
1649  u32 i = 0;
1650  int rv = 0;
1651 
1652  u32 bd = clib_net_to_host_u32 (mp->bd);
1653 
1654  entries = vnet_lisp_l2_arp_entries_get_by_bd (bd);
1655  u32 size = vec_len (entries) * sizeof (vl_api_one_l2_arp_entry_t);
1656 
1657  /* *INDENT-OFF* */
1658  REPLY_MACRO4 (VL_API_ONE_L2_ARP_ENTRIES_GET_REPLY, size,
1659  {
1660  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1661  vec_foreach (e, entries)
1662  {
1663  mac_copy (rmp->entries[i].mac, e->mac);
1664  rmp->entries[i].ip4 = e->ip4;
1665  i++;
1666  }
1667  });
1668  /* *INDENT-ON* */
1669 
1670  vec_free (entries);
1671 }
1672 
1673 static void
1676 {
1677  vl_api_one_map_register_fallback_threshold_reply_t *rmp;
1678  int rv = 0;
1679 
1680  mp->value = clib_net_to_host_u32 (mp->value);
1682  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY);
1683 }
1684 
1685 static void
1688 {
1690  int rv = 0;
1691 
1693 
1694  /* *INDENT-OFF* */
1695  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY,
1696  ({
1697  rmp->value = clib_host_to_net_u32 (value);
1698  }));
1699  /* *INDENT-ON* */
1700 }
1701 
1702 static void
1705 {
1706  vl_api_one_set_transport_protocol_reply_t *rmp;
1707  int rv = 0;
1708 
1710 
1711  REPLY_MACRO (VL_API_ONE_SET_TRANSPORT_PROTOCOL_REPLY);
1712 }
1713 
1714 static void
1717 {
1719  int rv = 0;
1720  u8 proto = (u8) vnet_lisp_get_transport_protocol ();
1721 
1722  /* *INDENT-OFF* */
1723  REPLY_MACRO2 (VL_API_ONE_GET_TRANSPORT_PROTOCOL_REPLY,
1724  ({
1725  rmp->protocol = proto;
1726  }));
1727  /* *INDENT-ON* */
1728 }
1729 
1730 static void
1732 {
1734  lisp_api_ndp_entry_t *entries = 0, *e;
1735  u32 i = 0;
1736  int rv = 0;
1737 
1738  u32 bd = clib_net_to_host_u32 (mp->bd);
1739 
1740  entries = vnet_lisp_ndp_entries_get_by_bd (bd);
1741  u32 size = vec_len (entries) * sizeof (vl_api_one_ndp_entry_t);
1742 
1743  /* *INDENT-OFF* */
1744  REPLY_MACRO4 (VL_API_ONE_NDP_ENTRIES_GET_REPLY, size,
1745  {
1746  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1747  vec_foreach (e, entries)
1748  {
1749  mac_copy (rmp->entries[i].mac, e->mac);
1750  clib_memcpy (rmp->entries[i].ip6, e->ip6, 16);
1751  i++;
1752  }
1753  });
1754  /* *INDENT-ON* */
1755 
1756  vec_free (entries);
1757 }
1758 
1759 /*
1760  * one_api_hookup
1761  * Add vpe's API message handlers to the table.
1762  * vlib has alread mapped shared memory and
1763  * added the client registration handlers.
1764  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1765  */
1766 #define vl_msg_name_crc_list
1767 #include <vnet/vnet_all_api_h.h>
1768 #undef vl_msg_name_crc_list
1769 
1770 static void
1772 {
1773 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1774  foreach_vl_msg_name_crc_one;
1775 #undef _
1776 }
1777 
1778 static clib_error_t *
1780 {
1781  api_main_t *am = &api_main;
1782 
1783 #define _(N,n) \
1784  vl_msg_api_set_handlers(VL_API_##N, #n, \
1785  vl_api_##n##_t_handler, \
1786  vl_noop_handler, \
1787  vl_api_##n##_t_endian, \
1788  vl_api_##n##_t_print, \
1789  sizeof(vl_api_##n##_t), 1);
1791 #undef _
1792 
1793  /*
1794  * Set up the (msg_name, crc, message-id) table
1795  */
1797 
1798  return 0;
1799 }
1800 
1802 
1803 /*
1804  * fd.io coding-style-patch-verification: ON
1805  *
1806  * Local Variables:
1807  * eval: (c-set-style "gnu")
1808  * End:
1809  */
#define ip_prefix_v4(_a)
Definition: lisp_types.h:74
static void one_fid_put_api(u8 *dst, fid_address_t *src, u8 *prefix_length)
Definition: one_api.c:812
static void vl_api_one_eid_table_dump_t_handler(vl_api_one_eid_table_dump_t *mp)
Definition: one_api.c:964
u8 mac[6]
Definition: one.api:418
vl_api_one_ndp_entry_t entries[count]
Definition: one.api:483
static void vl_api_one_eid_table_add_del_map_t_handler(vl_api_one_eid_table_add_del_map_t *mp)
Definition: one_api.c:377
Add/delete L2 ARP entries.
Definition: one.api:413
#define gid_address_ip_version(_a)
Definition: lisp_types.h:265
Get ONE map request itr rlocs status.
Definition: one.api:916
u32 pitr_map_index
Definition: control.h:247
vnet_api_error_t
Definition: api_errno.h:121
gid_address_t leid
Definition: control.h:73
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
#define gid_address_type(_a)
Definition: lisp_types.h:261
Status of ONE PITR, enable or disable.
Definition: one.api:969
enable or disable ONE feature
Definition: one.api:176
static void vl_api_one_rloc_probe_enable_disable_t_handler(vl_api_one_rloc_probe_enable_disable_t *mp)
Definition: one_api.c:432
a
Definition: bitmap.h:516
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
Definition: lisp_gpe.c:184
lisp_api_l2_arp_entry_t * vnet_lisp_l2_arp_entries_get_by_bd(u32 bd)
Definition: control.c:980
add or delete map request itr rlocs
Definition: one.api:590
Reply with list of bridge domains used by L2 ARP table.
Definition: one.api:551
lisp_msmr_t * map_resolvers
Definition: control.h:217
static void vl_api_one_stats_enable_disable_t_handler(vl_api_one_stats_enable_disable_t *mp)
Definition: one_api.c:1481
Definition: one.api:472
Get TTL for map register messages.
Definition: one.api:121
u32 vnet_lisp_set_transport_protocol(u8 protocol)
Definition: control.c:4729
configure or delete ONE NSH mapping
Definition: one.api:189
static void vl_api_one_add_del_local_eid_t_handler(vl_api_one_add_del_local_eid_t *mp)
Definition: one_api.c:321
#define REPLY_MACRO4(t, n, body)
static void vl_api_one_add_del_ndp_entry_t_handler(vl_api_one_add_del_ndp_entry_t *mp)
Definition: one_api.c:1578
uword * table_id_by_vni
Definition: control.h:236
add or delete locator_set
Definition: one.api:31
ONE adjacency.
Definition: one.api:769
static void vl_api_one_ndp_entries_get_t_handler(vl_api_one_ndp_entries_get_t *mp)
Definition: one_api.c:1731
static void vl_api_one_add_del_map_server_t_handler(vl_api_one_add_del_map_server_t *mp)
Definition: one_api.c:387
#define REPLY_MACRO2(t, body)
#define NULL
Definition: clib.h:55
Request for ONE status.
Definition: one.api:893
enable/disable ONE map-register
Definition: one.api:291
locator_t * locator_pool
Definition: control.h:174
dp_address_t seid
Definition: lisp_gpe.h:103
static void setup_message_id_table(api_main_t *am)
Definition: one_api.c:1771
u8 vnet_lisp_get_map_request_mode(void)
Definition: control.c:57
#define ip_prefix_len(_a)
Definition: lisp_types.h:73
reply to one_eid_table_vni_dump
Definition: one.api:840
ip_address_t loc_rloc
Definition: lisp_gpe.h:104
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:518
add or delete ONE eid-table
Definition: one.api:91
static void send_one_locator_details(lisp_cp_main_t *lcm, locator_t *loc, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:680
static void vl_api_one_locator_dump_t_handler(vl_api_one_locator_dump_t *mp)
Definition: one_api.c:708
Request for map server summary status.
Definition: one.api:883
#define foreach_vpe_api_msg
Definition: one_api.c:86
u32 nsh_map_index
Definition: control.h:256
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
static void vl_api_one_set_transport_protocol_t_handler(vl_api_one_set_transport_protocol_t *mp)
Definition: one_api.c:1704
static void vl_api_show_one_status_t_handler(vl_api_show_one_status_t *mp)
Definition: one_api.c:1308
ip_address_t address
Definition: control.h:88
vnet_api_error_t vnet_lisp_stats_enable_disable(u8 enable)
Definition: control.c:4693
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
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: lisp_types.c:908
u8 mac[6]
Definition: one.api:474
Reply for ONE NSH mapping.
Definition: one.api:946
static void vl_api_show_one_map_request_mode_t_handler(vl_api_show_one_map_request_mode_t *mp)
Definition: one_api.c:453
static clib_error_t * one_api_hookup(vlib_main_t *vm)
Definition: one_api.c:1779
#define ip_prefix_version(_a)
Definition: lisp_types.h:72
u8 vnet_lisp_stats_enable_disable_state(void)
Definition: control.c:4709
#define fid_addr_mac(_a)
Definition: lisp_types.h:134
u8 vnet_lisp_map_register_state_get(void)
Definition: control.c:422
static void send_one_map_server_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1006
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1538
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
configure or disable use of PETR
Definition: one.api:218
uword value[0]
Definition: hash.h:164
static void vl_api_one_get_transport_protocol_t_handler(vl_api_one_get_transport_protocol_t *mp)
Definition: one_api.c:1716
Request for L2 ARP entries from specified bridge domain.
Definition: one.api:428
Request for map request itr rlocs summary status.
Definition: one.api:924
ONE locator_set status.
Definition: one.api:638
lisp_msmr_t * map_servers
Definition: control.h:220
lisp_transport_protocol_t vnet_lisp_get_transport_protocol(void)
Definition: control.c:4742
u32 ip4
Definition: one.api:420
static void vl_api_one_adjacencies_get_t_handler(vl_api_one_adjacencies_get_t *mp)
Definition: one_api.c:1251
static void vl_api_one_l2_arp_bd_get_t_handler(vl_api_one_l2_arp_bd_get_t *mp)
Definition: one_api.c:1620
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:437
static void vl_api_one_get_map_request_itr_rlocs_t_handler(vl_api_one_get_map_request_itr_rlocs_t *mp)
Definition: one_api.c:1331
Request for ONE map-request mode.
Definition: one.api:338
u8 * key
Definition: lisp_types.h:373
Request for ONE adjacencies.
Definition: one.api:795
ip_address_t rmt_rloc
Definition: lisp_gpe.h:105
Request for one_eid_table_map_details.
Definition: one.api:818
int vnet_lisp_flush_stats(void)
u8 ip6[16]
Definition: one.api:462
#define gid_address_sd_src(_a)
Definition: lisp_types.h:278
static void vl_api_one_add_del_map_resolver_t_handler(vl_api_one_add_del_map_resolver_t *mp)
Definition: one_api.c:402
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 ip4
Definition: one.api:438
static void vl_api_one_map_register_set_ttl_t_handler(vl_api_one_map_register_set_ttl_t *mp)
Definition: one_api.c:162
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:1069
Dumps all VNIs used in mappings.
Definition: one.api:829
lisp_api_ndp_entry_t * vnet_lisp_ndp_entries_get_by_bd(u32 bd)
Definition: control.c:1015
static void vl_api_one_enable_disable_t_handler(vl_api_one_enable_disable_t *mp)
Definition: one_api.c:442
static void vl_api_one_add_del_adjacency_t_handler(vl_api_one_add_del_adjacency_t *mp)
Definition: one_api.c:656
static void vl_api_one_map_register_fallback_threshold_t_handler(vl_api_one_map_register_fallback_threshold_t *mp)
Definition: one_api.c:1675
uword * bd_id_by_vni
Definition: control.h:240
#define ip_addr_v4(_a)
Definition: lisp_types.h:54
static void vl_api_one_map_resolver_dump_t_handler(vl_api_one_map_resolver_dump_t *mp)
Definition: one_api.c:1089
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:300
static int unformat_one_eid_api(gid_address_t *dst, u32 vni, u8 type, void *src, u8 len)
Definition: one_api.c:281
add or delete ONE adjacency adjacency
Definition: one.api:571
u32 bd
Definition: one.api:419
void * vl_msg_api_alloc(int nbytes)
vl_api_one_local_locator_t locators[locator_num]
Definition: one.api:38
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_one_add_del_map_request_itr_rlocs_t_handler(vl_api_one_add_del_map_request_itr_rlocs_t *mp)
Definition: one_api.c:580
Reply with list of bridge domains used by neighbor discovery.
Definition: one.api:528
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:2155
static void vl_api_one_map_register_enable_disable_t_handler(vl_api_one_map_register_enable_disable_t *mp)
Definition: one_api.c:421
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
counter_t packets
packet counter
Definition: counter.h:141
#define gid_address_arp_ndp_ip(_a)
Definition: lisp_types.h:284
static void vl_api_one_eid_table_vni_dump_t_handler(vl_api_one_eid_table_vni_dump_t *mp)
Definition: one_api.c:1274
static void send_one_map_resolver_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1057
#define gid_address_mac(_a)
Definition: lisp_types.h:267
#define ip_prefix_v6(_a)
Definition: lisp_types.h:75
Set TTL for map register messages.
Definition: one.api:110
static u8 fid_type_to_api_type(fid_address_t *fid)
Definition: one_api.c:839
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 ONE PITR status.
Definition: one.api:958
#define hash_free(h)
Definition: hash.h:286
void gid_address_free(gid_address_t *a)
Definition: lisp_types.c:850
static void vl_api_one_add_del_remote_mapping_t_handler(vl_api_one_add_del_remote_mapping_t *mp)
Definition: one_api.c:601
u8 authoritative
Definition: lisp_types.h:363
Request for ONE PETR status.
Definition: one.api:231
lisp_api_stats_t * vnet_lisp_get_stats(void)
Definition: control.c:4393
#define REPLY_MACRO(t)
set ONE map-request mode.
Definition: one.api:327
Reply for show_one_rloc_probe_state.
Definition: one.api:267
add or delete map-resolver
Definition: one.api:162
void ip_prefix_normalize(ip_prefix_t *a)
Definition: lisp_types.c:988
VLIB_API_INIT_FUNCTION(one_api_hookup)
#define ip_addr_v6(_a)
Definition: lisp_types.h:55
#define gid_address_ippref(_a)
Definition: lisp_types.h:262
static void vl_api_show_one_map_register_fallback_threshold_t_handler(vl_api_show_one_map_register_fallback_threshold_t *mp)
Definition: one_api.c:1687
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:182
Definition: one.api:435
dp_address_t deid
Definition: lisp_gpe.h:102
lisp_adjacency_t * vnet_lisp_adjacencies_get_by_vni(u32 vni)
Returns vector of adjacencies.
Definition: control.c:617
static void vl_api_one_ndp_bd_get_t_handler(vl_api_one_ndp_bd_get_t *mp)
Definition: one_api.c:1595
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:324
ONE map server details.
Definition: one.api:872
Request for map one locator status.
Definition: one.api:622
u32 * vnet_lisp_ndp_bds_get(void)
Definition: control.c:943
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
Shows relationship between vni and vrf/bd.
Definition: one.api:806
vlib_counter_t counters
Definition: lisp_gpe.h:107
Dump ONE eid-table.
Definition: one.api:703
vl_api_one_remote_locator_t rlocs[rloc_num]
Definition: one.api:402
vlib_main_t * vm
Definition: buffer.c:283
static void vl_api_one_use_petr_t_handler(vl_api_one_use_petr_t *mp)
Definition: one_api.c:508
#define gid_address_arp_bd
Definition: lisp_types.h:288
void gid_address_ip_set(gid_address_t *dst, void *src, u8 version)
Definition: lisp_types.c:1560
Get state of ONE map-register.
Definition: one.api:302
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
Request for ONE NSH mapping.
Definition: one.api:935
#define gid_address_ippref_len(_a)
Definition: lisp_types.h:263
Request for list of bridge domains used by L2 ARP table.
Definition: one.api:540
ONE adjacency reply.
Definition: one.api:782
#define clib_warning(format, args...)
Definition: error.h:59
u32 locator_set_index
Definition: lisp_types.h:356
static void send_eid_table_vni(u32 vni, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1155
#define clib_memcpy(a, b, c)
Definition: string.h:69
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
vl_api_one_l2_arp_entry_t entries[count]
Definition: one.api:452
#define fid_addr_ip_version(_a)
Definition: lisp_types.h:133
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:2146
u32 vnet_lisp_map_register_fallback_threshold_get(void)
Definition: control.c:1667
Reply for show_one_map_request_mode.
Definition: one.api:349
#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
#define gid_address_nsh_si(_a)
Definition: lisp_types.h:270
static void vl_api_show_one_rloc_probe_state_t_handler(vl_api_show_one_rloc_probe_state_t *mp)
Definition: one_api.c:1222
static void vl_api_show_one_stats_enable_disable_t_handler(vl_api_show_one_stats_enable_disable_t *mp)
Definition: one_api.c:1466
#define fid_addr_ippref(_a)
Definition: lisp_types.h:131
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2206
Reply with L2 ARP entries from specified bridge domain.
Definition: one.api:447
Definition: control.h:106
struct _gid_address_t gid_address_t
static void vl_api_show_one_map_register_ttl_t_handler(vl_api_show_one_map_register_ttl_t *mp)
Definition: one_api.c:176
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:671
static uword hash_elts(void *v)
Definition: hash.h:117
#define ASSERT(truth)
#define fid_addr_type(_a)
Definition: lisp_types.h:136
unsigned int u32
Definition: types.h:88
static void vl_api_show_one_map_register_state_t_handler(vl_api_show_one_map_register_state_t *mp)
Definition: one_api.c:1237
u8 is_add
Definition: one.api:417
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1426
map/unmap vni/bd_index to vrf
Definition: one.api:605
#define gid_address_sd_dst(_a)
Definition: lisp_types.h:279
u8 mac[6]
Definition: one.api:460
gid_dictionary_t mapping_index_by_gid
Definition: control.h:165
#define REPLY_DETAILS(t, body)
Definition: one_api.c:71
u64 size
Definition: vhost-user.h:76
locator_set_t * locator_set_pool
Definition: control.h:177
static void vl_api_one_nsh_set_locator_set_t_handler(vl_api_one_nsh_set_locator_set_t *mp)
Definition: one_api.c:478
#define gid_address_ndp_bd
Definition: lisp_types.h:287
static void vl_api_one_add_del_l2_arp_entry_t_handler(vl_api_one_add_del_l2_arp_entry_t *mp)
Definition: one_api.c:1559
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:2137
static void vl_api_one_locator_set_dump_t_handler(vl_api_one_locator_set_dump_t *mp)
Definition: one_api.c:783
Get state of ONE RLOC probing.
Definition: one.api:256
Add/delete map server.
Definition: one.api:146
ONE PETR status, enable or disable.
Definition: one.api:243
u64 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
static void vl_api_one_stats_dump_t_handler(vl_api_one_stats_dump_t *mp)
Definition: one_api.c:1528
Definition: control.h:100
u64 uword
Definition: types.h:112
int vnet_lisp_map_register_fallback_threshold_set(u32 value)
Definition: control.c:1654
add or delete remote static mapping
Definition: one.api:387
static void vl_api_one_eid_table_map_dump_t_handler(vl_api_one_eid_table_map_dump_t *mp)
Definition: one_api.c:1124
counter_t bytes
byte counter
Definition: counter.h:142
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
#define gid_address_vni(_a)
Definition: lisp_types.h:271
static void vl_api_show_one_nsh_mapping_t_handler(vl_api_show_one_nsh_mapping_t *mp)
Definition: one_api.c:1369
add or delete locator for locator set
Definition: one.api:62
static void vl_api_one_add_del_locator_set_t_handler(vl_api_one_add_del_locator_set_t *mp)
Definition: one_api.c:191
Reply for locator_set add/del.
Definition: one.api:46
Request for map resolver summary status.
Definition: one.api:862
#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
static void vl_api_one_add_del_locator_t_handler(vl_api_one_add_del_locator_t *mp)
Definition: one_api.c:241
enable/disable ONE RLOC probing
Definition: one.api:279
#define gid_address_nsh_spi(_a)
Definition: lisp_types.h:269
int vnet_lisp_del_mapping(gid_address_t *eid, u32 *res_map_index)
Removes a mapping.
Definition: control.c:1377
u32 * vnet_lisp_l2_arp_bds_get(void)
Definition: control.c:920
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
int vnet_lisp_nsh_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1559
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
Definition: lisp_types.c:1495
static void vl_api_one_map_request_mode_t_handler(vl_api_one_map_request_mode_t *mp)
Definition: one_api.c:467
Definition: lisp_types.h:37
gid_address_t eid
Definition: lisp_types.h:351
gid_address_t reid
Definition: control.h:74
static void vl_api_one_pitr_set_locator_set_t_handler(vl_api_one_pitr_set_locator_set_t *mp)
Definition: one_api.c:493
gid_address_t address
Definition: lisp_types.h:325
static void vl_api_one_l2_arp_entries_get_t_handler(vl_api_one_l2_arp_entries_get_t *mp)
Definition: one_api.c:1645
#define hash_get_mem(h, key)
Definition: hash.h:268
void mac_copy(void *dst, void *src)
Definition: lisp_types.c:1051
ONE locator_set status.
Definition: one.api:654
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:2213
static void vl_api_show_one_pitr_t_handler(vl_api_show_one_pitr_t *mp)
Definition: one_api.c:1418
int vnet_lisp_add_del_l2_arp_ndp_entry(gid_address_t *key, u8 *mac, u8 is_add)
Definition: control.c:1030
u8 is_add
Definition: one.api:459
#define vec_foreach(var, vec)
Vector iterator.
#define fid_addr_prefix_length(_a)
Definition: lisp_types.h:132
Set ONE transport protocol.
Definition: one.api:493
static void vl_api_show_one_use_petr_t_handler(vl_api_show_one_use_petr_t *mp)
Definition: one_api.c:521
Request for eid table summary status.
Definition: one.api:747
vhost_vring_addr_t addr
Definition: vhost-user.h:83
u8 mac[6]
Definition: one.api:437
Request for locator_set summary status.
Definition: one.api:670
Contains current TTL for map register messages.
Definition: one.api:132
Request for list of bridge domains used by neighbor discovery.
Definition: one.api:517
Definition: lisp_types.h:38
static void vl_api_one_stats_flush_t_handler(vl_api_one_stats_flush_t *mp)
Definition: one_api.c:1518
int vnet_lisp_map_register_set_ttl(u32 ttl)
Definition: control.c:2261
static void send_one_locator_set_details(lisp_cp_main_t *lcm, locator_set_t *lsit, unix_shared_memory_queue_t *q, u32 context, u32 ls_index)
Definition: one_api.c:752
u32 vnet_lisp_map_register_get_ttl(void)
Definition: control.c:2269
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1682
ONE map resolver status.
Definition: one.api:851
static void send_eid_table_map_pair(hash_pair_t *p, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1108
u32 mreq_itr_rlocs
Definition: control.h:233
u8 ip6[16]
Definition: one.api:475
u32 * locator_indices
Definition: lisp_types.h:345
static locator_t * unformat_one_locs(vl_api_one_remote_locator_t *rmt_locs, u32 rloc_num)
Definition: one_api.c:140
Reply for show_one_map_register_state.
Definition: one.api:312
static void lisp_fid_addr_to_api(fid_address_t *fid, u8 *dst, u8 *api_eid_type, u8 *prefix_length)
Definition: one_api.c:1490
uword key
Definition: hash.h:161
LISP-GPE definitions.
configure or disable ONE PITR node
Definition: one.api:203
Definition: one.api:455
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
u32 bd
Definition: one.api:461
vl_api_one_adjacency_t adjacencies[count]
Definition: one.api:787
static void one_adjacency_copy(vl_api_one_adjacency_t *dst, lisp_adjacency_t *adjs)
Definition: one_api.c:1168
static void vl_api_one_map_server_dump_t_handler(vl_api_one_map_server_dump_t *mp)
Definition: one_api.c:1038
static void send_one_eid_table_details(mapping_t *mapit, unix_shared_memory_queue_t *q, u32 context, u8 filter)
Definition: one_api.c:864