FD.io VPP  v18.01-8-g0eacf49
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 _(ONE_ENABLE_DISABLE_XTR_MODE, one_enable_disable_xtr_mode) \
139 _(ONE_SHOW_XTR_MODE, one_show_xtr_mode) \
140 _(ONE_ENABLE_DISABLE_PITR_MODE, one_enable_disable_pitr_mode) \
141 _(ONE_SHOW_PITR_MODE, one_show_pitr_mode) \
142 _(ONE_ENABLE_DISABLE_PETR_MODE, one_enable_disable_petr_mode) \
143 _(ONE_SHOW_PETR_MODE, one_show_petr_mode) \
144 
145 
146 static locator_t *
148 {
149  u32 i;
150  locator_t *locs = 0, loc;
152 
153  for (i = 0; i < rloc_num; i++)
154  {
155  /* remote locators */
156  r = &rmt_locs[i];
157  memset (&loc, 0, sizeof (loc));
158  gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
159 
160  loc.priority = r->priority;
161  loc.weight = r->weight;
162 
163  vec_add1 (locs, loc);
164  }
165  return locs;
166 }
167 
168 static void
170  mp)
171 {
172  vl_api_one_map_register_set_ttl_reply_t *rmp;
173  int rv = 0;
174 
175  mp->ttl = clib_net_to_host_u32 (mp->ttl);
177 
178  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_SET_TTL_REPLY);
179 }
180 
181 static void
184 {
186  int rv = 0;
187 
189  /* *INDENT-OFF* */
190  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_TTL_REPLY,
191  ({
192  rmp->ttl = clib_host_to_net_u32 (ttl);
193  }));
194  /* *INDENT-ON* */
195 }
196 
197 static void
199  mp)
200 {
202  int rv = 0;
204  locator_t locator;
206  u32 ls_index = ~0, locator_num;
207  u8 *locator_name = NULL;
208  int i;
209 
210  memset (a, 0, sizeof (a[0]));
211 
212  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
213  locator_name = format (0, "%s", mp->locator_set_name);
214  vec_terminate_c_string (locator_name);
215 
216  a->name = locator_name;
217  a->is_add = mp->is_add;
218  a->local = 1;
219  locator_num = clib_net_to_host_u32 (mp->locator_num);
220 
221  memset (&locator, 0, sizeof (locator));
222  for (i = 0; i < locator_num; i++)
223  {
224  ls_loc = &mp->locators[i];
225  VALIDATE_SW_IF_INDEX (ls_loc);
226 
227  locator.sw_if_index = htonl (ls_loc->sw_if_index);
228  locator.priority = ls_loc->priority;
229  locator.weight = ls_loc->weight;
230  locator.local = 1;
231  vec_add1 (a->locators, locator);
232  }
233 
234  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
235 
237 
238  vec_free (locator_name);
239  vec_free (a->locators);
240 
241  /* *INDENT-OFF* */
242  REPLY_MACRO2 (VL_API_ONE_ADD_DEL_LOCATOR_SET_REPLY,
243  ({
244  rmp->ls_index = clib_host_to_net_u32 (ls_index);
245  }));
246  /* *INDENT-ON* */
247 }
248 
249 static void
251 {
252  vl_api_one_add_del_locator_reply_t *rmp;
253  int rv = 0;
254  locator_t locator, *locators = NULL;
256  u32 ls_index = ~0;
257  u8 *locator_name = NULL;
258 
259  memset (&locator, 0, sizeof (locator));
260  memset (a, 0, sizeof (a[0]));
261 
262  locator.sw_if_index = ntohl (mp->sw_if_index);
263  locator.priority = mp->priority;
264  locator.weight = mp->weight;
265  locator.local = 1;
266  vec_add1 (locators, locator);
267 
268  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
269  locator_name = format (0, "%s", mp->locator_set_name);
270  vec_terminate_c_string (locator_name);
271 
272  a->name = locator_name;
273  a->locators = locators;
274  a->is_add = mp->is_add;
275  a->local = 1;
276 
277  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
278 
279  vec_free (locators);
280  vec_free (locator_name);
281 
282  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCATOR_REPLY);
283 }
284 
285 typedef struct
286 {
289 } __attribute__ ((__packed__)) lisp_nsh_api_t;
290 
291 static int
292 unformat_one_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
293  u8 len)
294 {
295  lisp_nsh_api_t *nsh;
296 
297  switch (type)
298  {
299  case 0: /* ipv4 */
301  gid_address_ip_set (dst, src, IP4);
302  gid_address_ippref_len (dst) = len;
304  break;
305  case 1: /* ipv6 */
307  gid_address_ip_set (dst, src, IP6);
308  gid_address_ippref_len (dst) = len;
310  break;
311  case 2: /* l2 mac */
313  clib_memcpy (&gid_address_mac (dst), src, 6);
314  break;
315  case 3: /* NSH */
317  nsh = src;
318  gid_address_nsh_spi (dst) = clib_net_to_host_u32 (nsh->spi);
319  gid_address_nsh_si (dst) = nsh->si;
320  break;
321  default:
322  /* unknown type */
323  return VNET_API_ERROR_INVALID_VALUE;
324  }
325 
326  gid_address_vni (dst) = vni;
327 
328  return 0;
329 }
330 
331 static void
333 {
334  vl_api_one_add_del_local_eid_reply_t *rmp;
336  int rv = 0;
337  gid_address_t _eid, *eid = &_eid;
338  uword *p = NULL;
339  u32 locator_set_index = ~0, map_index = ~0;
341  u8 *name = NULL, *key = NULL;
342  memset (a, 0, sizeof (a[0]));
343  memset (eid, 0, sizeof (eid[0]));
344 
345  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
346  mp->eid_type, mp->eid, mp->prefix_len);
347  if (rv)
348  goto out;
349 
350  if (gid_address_type (eid) == GID_ADDR_NSH)
351  {
352  rv = VNET_API_ERROR_INVALID_VALUE;
353  goto out;
354  }
355 
356  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
357  name = format (0, "%s", mp->locator_set_name);
358  vec_terminate_c_string (name);
359  p = hash_get_mem (lcm->locator_set_index_by_name, name);
360  if (!p)
361  {
362  rv = VNET_API_ERROR_INVALID_VALUE;
363  goto out;
364  }
365  locator_set_index = p[0];
366 
367  if (*mp->key)
368  key = format (0, "%s", mp->key);
369 
370  /* XXX treat batch configuration */
371  a->is_add = mp->is_add;
372  gid_address_copy (&a->eid, eid);
373  a->locator_set_index = locator_set_index;
374  a->local = 1;
375  a->key = key;
376  a->key_id = clib_net_to_host_u16 (mp->key_id);
377 
378  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
379 
380 out:
381  vec_free (name);
382  vec_free (key);
383  gid_address_free (&a->eid);
384 
385  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCAL_EID_REPLY);
386 }
387 
388 static void
391 {
392  vl_api_one_eid_table_add_del_map_reply_t *rmp;
393  int rv = 0;
394  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
395  clib_net_to_host_u32 (mp->dp_table),
396  mp->is_l2, mp->is_add);
397 REPLY_MACRO (VL_API_ONE_EID_TABLE_ADD_DEL_MAP_REPLY)}
398 
399 static void
401 {
402  vl_api_one_add_del_map_server_reply_t *rmp;
403  int rv = 0;
404  ip_address_t addr;
405 
406  memset (&addr, 0, sizeof (addr));
407 
408  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
409  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
410 
411  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
412 }
413 
414 static void
416  * mp)
417 {
418  vl_api_one_add_del_map_resolver_reply_t *rmp;
419  int rv = 0;
421 
422  memset (a, 0, sizeof (a[0]));
423 
424  a->is_add = mp->is_add;
425  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
426 
428 
429  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_RESOLVER_REPLY);
430 }
431 
432 static void
435 {
436  vl_api_one_map_register_enable_disable_reply_t *rmp;
437  int rv = 0;
438 
440  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
441 }
442 
443 static void
446 {
447  vl_api_one_rloc_probe_enable_disable_reply_t *rmp;
448  int rv = 0;
449 
451  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
452 }
453 
454 static void
456 {
457  vl_api_one_enable_disable_reply_t *rmp;
458  int rv = 0;
459 
461  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
462 }
463 
464 static void
467 {
468  int rv = 0;
470 
471  /* *INDENT-OFF* */
472  REPLY_MACRO2(VL_API_SHOW_ONE_MAP_REQUEST_MODE_REPLY,
473  ({
475  }));
476  /* *INDENT-ON* */
477 }
478 
479 static void
481 {
482  vl_api_one_map_request_mode_reply_t *rmp;
483  int rv = 0;
484 
486 
487  REPLY_MACRO (VL_API_ONE_MAP_REQUEST_MODE_REPLY);
488 }
489 
490 static void
492  * mp)
493 {
494  vl_api_one_nsh_set_locator_set_reply_t *rmp;
495  int rv = 0;
496  u8 *ls_name = 0;
497 
498  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
499  ls_name = format (0, "%s", mp->ls_name);
500  vec_terminate_c_string (ls_name);
501  rv = vnet_lisp_nsh_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  * mp)
510 {
511  vl_api_one_pitr_set_locator_set_reply_t *rmp;
512  int rv = 0;
513  u8 *ls_name = 0;
514 
515  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
516  ls_name = format (0, "%s", mp->ls_name);
517  vec_terminate_c_string (ls_name);
518  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
519  vec_free (ls_name);
520 
521  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
522 }
523 
524 static void
526 {
527  vl_api_one_use_petr_reply_t *rmp;
528  int rv = 0;
529  ip_address_t addr;
530 
531  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
532  rv = vnet_lisp_use_petr (&addr, mp->is_add);
533 
534  REPLY_MACRO (VL_API_ONE_USE_PETR_REPLY);
535 }
536 
537 static void
539 {
543  mapping_t *m;
544  locator_set_t *ls = 0;
545  int rv = 0;
546  locator_t *loc = 0;
547  u8 status = 0;
549 
551  if (q == 0)
552  {
553  return;
554  }
555 
556  memset (&addr, 0, sizeof (addr));
557  status = lcm->flags & LISP_FLAG_USE_PETR;
558  if (status)
559  {
561  if (~0 != m->locator_set_index)
562  {
563  ls =
565  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
566  gid_address_copy (&addr, &loc->address);
567  }
568  }
569 
570  /* *INDENT-OFF* */
571  REPLY_MACRO2 (VL_API_SHOW_ONE_USE_PETR_REPLY,
572  {
573  rmp->status = status;
574  ip_address_t *ip = &gid_address_ip (&addr);
575  switch (ip_addr_version (ip))
576  {
577  case IP4:
578  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
579  sizeof (ip_addr_v4 (ip)));
580  break;
581 
582  case IP6:
583  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
584  sizeof (ip_addr_v6 (ip)));
585  break;
586 
587  default:
588  ASSERT (0);
589  }
590  rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
591  });
592  /* *INDENT-ON* */
593 }
594 
595 static void
598 {
599  vl_api_one_add_del_map_request_itr_rlocs_reply_t *rmp;
600  int rv = 0;
601  u8 *locator_set_name = NULL;
603 
604  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
605  locator_set_name = format (0, "%s", mp->locator_set_name);
606  vec_terminate_c_string (locator_set_name);
607 
608  a->is_add = mp->is_add;
609  a->locator_set_name = locator_set_name;
610 
612 
613  vec_free (locator_set_name);
614 
615  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
616 }
617 
618 static void
621 {
622  locator_t *rlocs = 0;
623  vl_api_one_add_del_remote_mapping_reply_t *rmp;
624  int rv = 0;
625  gid_address_t _eid, *eid = &_eid;
626  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
627 
628  memset (eid, 0, sizeof (eid[0]));
629 
630  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
631  mp->eid_type, mp->eid, mp->eid_len);
632  if (rv)
633  goto send_reply;
634 
635  rlocs = unformat_one_locs (mp->rlocs, rloc_num);
636 
637  if (!mp->is_add)
638  {
640  memset (a, 0, sizeof (a[0]));
641  gid_address_copy (&a->reid, eid);
642  a->is_add = 0;
644  if (rv)
645  {
646  goto out;
647  }
648  }
649 
650  /* NOTE: for now this works as a static remote mapping, i.e.,
651  * not authoritative and ttl infinite. */
652  if (mp->is_add)
653  {
654  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
655  memset (m_args, 0, sizeof (m_args[0]));
656  gid_address_copy (&m_args->eid, eid);
657  m_args->action = mp->action;
658  m_args->is_static = 1;
659  m_args->ttl = ~0;
660  m_args->authoritative = 0;
661  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
662  }
663  else
664  rv = vnet_lisp_del_mapping (eid, NULL);
665 
666  if (mp->del_all)
668 
669 out:
670  vec_free (rlocs);
671 send_reply:
672  REPLY_MACRO (VL_API_ONE_ADD_DEL_REMOTE_MAPPING_REPLY);
673 }
674 
675 static void
677 {
678  vl_api_one_add_del_adjacency_reply_t *rmp;
680 
681  int rv = 0;
682  memset (a, 0, sizeof (a[0]));
683 
684  rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
685  mp->eid_type, mp->leid, mp->leid_len);
686  rv |= unformat_one_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
687  mp->eid_type, mp->reid, mp->reid_len);
688 
689  if (rv)
690  goto send_reply;
691 
692  a->is_add = mp->is_add;
694 
695 send_reply:
696  REPLY_MACRO (VL_API_ONE_ADD_DEL_ADJACENCY_REPLY);
697 }
698 
699 static void
701  locator_t * loc,
702  unix_shared_memory_queue_t * q, u32 context)
703 {
705 
706  rmp = vl_msg_api_alloc (sizeof (*rmp));
707  memset (rmp, 0, sizeof (*rmp));
708  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
709  rmp->context = context;
710 
711  rmp->local = loc->local;
712  if (loc->local)
713  {
714  rmp->sw_if_index = ntohl (loc->sw_if_index);
715  }
716  else
717  {
718  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
720  }
721  rmp->priority = loc->priority;
722  rmp->weight = loc->weight;
723 
724  vl_msg_api_send_shmem (q, (u8 *) & rmp);
725 }
726 
727 static void
729 {
730  u8 *ls_name = 0;
733  locator_set_t *lsit = 0;
734  locator_t *loc = 0;
735  u32 ls_index = ~0, *locit = 0;
736  uword *p = 0;
737 
739  if (q == 0)
740  {
741  return;
742  }
743 
744  if (mp->is_index_set)
745  ls_index = htonl (mp->ls_index);
746  else
747  {
748  /* make sure we get a proper C-string */
749  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
750  ls_name = format (0, "%s", mp->ls_name);
751  vec_terminate_c_string (ls_name);
752  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
753  if (!p)
754  goto out;
755  ls_index = p[0];
756  }
757 
758  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
759  return;
760 
761  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
762 
763  vec_foreach (locit, lsit->locator_indices)
764  {
765  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
766  send_one_locator_details (lcm, loc, q, mp->context);
767  };
768 out:
769  vec_free (ls_name);
770 }
771 
772 static void
774  locator_set_t * lsit,
776  u32 context, u32 ls_index)
777 {
779  u8 *str = 0;
780 
781  rmp = vl_msg_api_alloc (sizeof (*rmp));
782  memset (rmp, 0, sizeof (*rmp));
783  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
784  rmp->context = context;
785 
786  rmp->ls_index = htonl (ls_index);
787  if (lsit->local)
788  {
789  ASSERT (lsit->name != NULL);
790  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
791  vec_len (lsit->name));
792  }
793  else
794  {
795  str = format (0, "<remote-%d>", ls_index);
796  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
797  vec_free (str);
798  }
799 
800  vl_msg_api_send_shmem (q, (u8 *) & rmp);
801 }
802 
803 static void
805 {
808  locator_set_t *lsit = NULL;
809  u8 filter;
810 
812  if (q == 0)
813  {
814  return;
815  }
816 
817  filter = mp->filter;
818  /* *INDENT-OFF* */
819  pool_foreach (lsit, lcm->locator_set_pool,
820  ({
821  if (filter && !((1 == filter && lsit->local) ||
822  (2 == filter && !lsit->local)))
823  {
824  continue;
825  }
826  send_one_locator_set_details (lcm, lsit, q, mp->context,
827  lsit - lcm->locator_set_pool);
828  }));
829  /* *INDENT-ON* */
830 }
831 
832 static void
833 one_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
834 {
835  ASSERT (prefix_length);
836  ip_prefix_t *ippref = &fid_addr_ippref (src);
837 
838  switch (fid_addr_type (src))
839  {
840  case FID_ADDR_IP_PREF:
841  if (ip_prefix_version (ippref) == IP4)
842  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
843  else
844  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
845  prefix_length[0] = ip_prefix_len (ippref);
846  break;
847 
848  case FID_ADDR_MAC:
849  prefix_length[0] = 0;
850  clib_memcpy (dst, fid_addr_mac (src), 6);
851  break;
852 
853  default:
854  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
855  break;
856  }
857 }
858 
859 static u8
861 {
862  ip_prefix_t *ippref;
863 
864  switch (fid_addr_type (fid))
865  {
866  case FID_ADDR_IP_PREF:
867  ippref = &fid_addr_ippref (fid);
868  if (ip_prefix_version (ippref) == IP4)
869  return 0;
870  else if (ip_prefix_version (ippref) == IP6)
871  return 1;
872  else
873  return ~0;
874 
875  case FID_ADDR_MAC:
876  return 2;
877  case FID_ADDR_NSH:
878  return 3;
879  }
880 
881  return ~0;
882 }
883 
884 static void
887  u32 context, u8 filter)
888 {
889  fid_address_t *fid;
891  locator_set_t *ls = 0;
893  gid_address_t *gid = NULL;
894  u8 *mac = 0;
895  ip_prefix_t *ip_prefix = NULL;
896 
897  if (mapit->pitr_set || mapit->nsh_set)
898  return;
899 
900  switch (filter)
901  {
902  case 0: /* all mappings */
903  break;
904 
905  case 1: /* local only */
906  if (!mapit->local)
907  return;
908  break;
909  case 2: /* remote only */
910  if (mapit->local)
911  return;
912  break;
913  default:
914  clib_warning ("Filter error, unknown filter: %d", filter);
915  return;
916  }
917 
918  gid = &mapit->eid;
919  ip_prefix = &gid_address_ippref (gid);
920  mac = gid_address_mac (gid);
921 
922  rmp = vl_msg_api_alloc (sizeof (*rmp));
923  memset (rmp, 0, sizeof (*rmp));
924  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
925 
927  if (vec_len (ls->locator_indices) == 0)
928  rmp->locator_set_index = ~0;
929  else
930  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
931 
932  rmp->is_local = mapit->local;
933  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
934  rmp->action = mapit->action;
935  rmp->authoritative = mapit->authoritative;
936 
937  switch (gid_address_type (gid))
938  {
939  case GID_ADDR_SRC_DST:
940  rmp->is_src_dst = 1;
941  fid = &gid_address_sd_src (gid);
942  rmp->eid_type = fid_type_to_api_type (fid);
944  &rmp->seid_prefix_len);
945  one_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
946  &rmp->eid_prefix_len);
947  break;
948  case GID_ADDR_IP_PREFIX:
949  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
950  if (ip_prefix_version (ip_prefix) == IP4)
951  {
952  rmp->eid_type = 0; /* ipv4 type */
953  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
954  sizeof (ip_prefix_v4 (ip_prefix)));
955  }
956  else
957  {
958  rmp->eid_type = 1; /* ipv6 type */
959  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
960  sizeof (ip_prefix_v6 (ip_prefix)));
961  }
962  break;
963  case GID_ADDR_MAC:
964  rmp->eid_type = 2; /* l2 mac type */
965  clib_memcpy (rmp->eid, mac, 6);
966  break;
967  case GID_ADDR_NSH:
968  rmp->eid_type = 3; /* NSH type */
969  lisp_nsh_api_t nsh;
970  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (gid));
971  nsh.si = gid_address_nsh_si (gid);
972  clib_memcpy (rmp->eid, &nsh, sizeof (nsh));
973  break;
974  default:
975  ASSERT (0);
976  }
977  rmp->context = context;
978  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
979  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
980  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
981  vl_msg_api_send_shmem (q, (u8 *) & rmp);
982 }
983 
984 static void
986 {
987  u32 mi;
990  mapping_t *mapit = NULL;
991  gid_address_t _eid, *eid = &_eid;
992 
994  if (q == 0)
995  {
996  return;
997  }
998 
999  if (mp->eid_set)
1000  {
1001  memset (eid, 0, sizeof (*eid));
1002 
1003  unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
1004  mp->eid_type, mp->eid, mp->prefix_length);
1005 
1006  mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, eid);
1007  if ((u32) ~ 0 == mi)
1008  return;
1009 
1010  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
1011  send_one_eid_table_details (mapit, q, mp->context,
1012  0 /* ignore filter */ );
1013  }
1014  else
1015  {
1016  /* *INDENT-OFF* */
1017  pool_foreach (mapit, lcm->mapping_pool,
1018  ({
1019  send_one_eid_table_details(mapit, q, mp->context,
1020  mp->filter);
1021  }));
1022  /* *INDENT-ON* */
1023  }
1024 }
1025 
1026 static void
1027 send_one_map_server_details (ip_address_t * ip,
1028  unix_shared_memory_queue_t * q, u32 context)
1029 {
1031 
1032  rmp = vl_msg_api_alloc (sizeof (*rmp));
1033  memset (rmp, 0, sizeof (*rmp));
1034  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
1035 
1036  switch (ip_addr_version (ip))
1037  {
1038  case IP4:
1039  rmp->is_ipv6 = 0;
1040  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
1041  sizeof (ip_addr_v4 (ip)));
1042  break;
1043 
1044  case IP6:
1045  rmp->is_ipv6 = 1;
1046  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
1047  sizeof (ip_addr_v6 (ip)));
1048  break;
1049 
1050  default:
1051  ASSERT (0);
1052  }
1053  rmp->context = context;
1054 
1055  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1056 }
1057 
1058 static void
1060 {
1063  lisp_msmr_t *mr;
1064 
1066  if (q == 0)
1067  {
1068  return;
1069  }
1070 
1071  vec_foreach (mr, lcm->map_servers)
1072  {
1074  }
1075 }
1076 
1077 static void
1079  unix_shared_memory_queue_t * q, u32 context)
1080 {
1082 
1083  rmp = vl_msg_api_alloc (sizeof (*rmp));
1084  memset (rmp, 0, sizeof (*rmp));
1085  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
1086 
1087  switch (ip_addr_version (ip))
1088  {
1089  case IP4:
1090  rmp->is_ipv6 = 0;
1091  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
1092  sizeof (ip_addr_v4 (ip)));
1093  break;
1094 
1095  case IP6:
1096  rmp->is_ipv6 = 1;
1097  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
1098  sizeof (ip_addr_v6 (ip)));
1099  break;
1100 
1101  default:
1102  ASSERT (0);
1103  }
1104  rmp->context = context;
1105 
1106  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1107 }
1108 
1109 static void
1111 {
1114  lisp_msmr_t *mr;
1115 
1117  if (q == 0)
1118  {
1119  return;
1120  }
1121 
1122  vec_foreach (mr, lcm->map_resolvers)
1123  {
1125  }
1126 }
1127 
1128 static void
1130  unix_shared_memory_queue_t * q, u32 context)
1131 {
1133 
1134  rmp = vl_msg_api_alloc (sizeof (*rmp));
1135  memset (rmp, 0, sizeof (*rmp));
1136  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
1137 
1138  rmp->vni = clib_host_to_net_u32 (p->key);
1139  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1140  rmp->context = context;
1141  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1142 }
1143 
1144 static void
1146 {
1149  hash_pair_t *p;
1150  uword *vni_table = 0;
1151 
1153  if (q == 0)
1154  {
1155  return;
1156  }
1157 
1158  if (mp->is_l2)
1159  {
1160  vni_table = lcm->bd_id_by_vni;
1161  }
1162  else
1163  {
1164  vni_table = lcm->table_id_by_vni;
1165  }
1166 
1167  /* *INDENT-OFF* */
1168  hash_foreach_pair (p, vni_table,
1169  ({
1170  send_eid_table_map_pair (p, q, mp->context);
1171  }));
1172  /* *INDENT-ON* */
1173 }
1174 
1175 static void
1177 {
1179 
1180  rmp = vl_msg_api_alloc (sizeof (*rmp));
1181  memset (rmp, 0, sizeof (*rmp));
1182  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
1183  rmp->context = context;
1184  rmp->vni = clib_host_to_net_u32 (vni);
1185  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1186 }
1187 
1188 static void
1190 {
1191  lisp_adjacency_t *adj;
1193  u32 i, n = vec_len (adjs);
1194  lisp_nsh_api_t nsh;
1195 
1196  for (i = 0; i < n; i++)
1197  {
1198  adj = vec_elt_at_index (adjs, i);
1199  memset (&a, 0, sizeof (a));
1200 
1201  switch (gid_address_type (&adj->reid))
1202  {
1203  case GID_ADDR_IP_PREFIX:
1206  if (gid_address_ip_version (&adj->reid) == IP4)
1207  {
1208  a.eid_type = 0; /* ipv4 type */
1209  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1210  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1211  }
1212  else
1213  {
1214  a.eid_type = 1; /* ipv6 type */
1215  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1216  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1217  }
1218  break;
1219  case GID_ADDR_MAC:
1220  a.eid_type = 2; /* l2 mac type */
1221  mac_copy (a.reid, gid_address_mac (&adj->reid));
1222  mac_copy (a.leid, gid_address_mac (&adj->leid));
1223  break;
1224  case GID_ADDR_NSH:
1225  a.eid_type = 3; /* NSH type */
1226  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (&adj->reid));
1227  nsh.si = gid_address_nsh_si (&adj->reid);
1228  clib_memcpy (a.reid, &nsh, sizeof (nsh));
1229 
1230  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (&adj->leid));
1231  nsh.si = gid_address_nsh_si (&adj->leid);
1232  clib_memcpy (a.leid, &nsh, sizeof (nsh));
1233  break;
1234  default:
1235  ASSERT (0);
1236  }
1237  dst[i] = a;
1238  }
1239 }
1240 
1241 static void
1244 {
1246  int rv = 0;
1247 
1248  /* *INDENT-OFF* */
1249  REPLY_MACRO2 (VL_API_SHOW_ONE_RLOC_PROBE_STATE_REPLY,
1250  {
1252  });
1253  /* *INDENT-ON* */
1254 }
1255 
1256 static void
1259 {
1261  int rv = 0;
1262 
1263  /* *INDENT-OFF* */
1264  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_STATE_REPLY,
1265  {
1267  });
1268  /* *INDENT-ON* */
1269 }
1270 
1271 static void
1273 {
1275  lisp_adjacency_t *adjs = 0;
1276  int rv = 0;
1277  u32 size = ~0;
1278  u32 vni = clib_net_to_host_u32 (mp->vni);
1279 
1280  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1281  size = vec_len (adjs) * sizeof (vl_api_one_adjacency_t);
1282 
1283  /* *INDENT-OFF* */
1284  REPLY_MACRO4 (VL_API_ONE_ADJACENCIES_GET_REPLY, size,
1285  {
1286  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1287  one_adjacency_copy (rmp->adjacencies, adjs);
1288  });
1289  /* *INDENT-ON* */
1290 
1291  vec_free (adjs);
1292 }
1293 
1294 static void
1296 {
1297  hash_pair_t *p;
1298  u32 *vnis = 0;
1301 
1303  if (q == 0)
1304  {
1305  return;
1306  }
1307 
1308  /* *INDENT-OFF* */
1310  ({
1311  hash_set (vnis, p->key, 0);
1312  }));
1313 
1315  ({
1316  hash_set (vnis, p->key, 0);
1317  }));
1318 
1319  hash_foreach_pair (p, vnis,
1320  ({
1321  send_eid_table_vni (p->key, q, mp->context);
1322  }));
1323  /* *INDENT-ON* */
1324 
1325  hash_free (vnis);
1326 }
1327 
1328 static void
1330 {
1333  int rv = 0;
1334 
1336  if (q == 0)
1337  {
1338  return;
1339  }
1340 
1341  /* *INDENT-OFF* */
1342  REPLY_MACRO2(VL_API_SHOW_ONE_STATUS_REPLY,
1343  ({
1346  }));
1347  /* *INDENT-ON* */
1348 }
1349 
1350 static void
1353 {
1357  locator_set_t *loc_set = 0;
1358  u8 *tmp_str = 0;
1359  int rv = 0;
1360 
1362  if (q == 0)
1363  {
1364  return;
1365  }
1366 
1367  if (~0 == lcm->mreq_itr_rlocs)
1368  {
1369  tmp_str = format (0, " ");
1370  }
1371  else
1372  {
1373  loc_set =
1375  tmp_str = format (0, "%s", loc_set->name);
1376  }
1377 
1378  /* *INDENT-OFF* */
1379  REPLY_MACRO2(VL_API_ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1380  ({
1381  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1382  ARRAY_LEN(rmp->locator_set_name) - 1);
1383  }));
1384  /* *INDENT-ON* */
1385 
1386  vec_free (tmp_str);
1387 }
1388 
1389 static void
1391 {
1395  mapping_t *m;
1396  locator_set_t *ls = 0;
1397  u8 *tmp_str = 0;
1398  u8 is_set = 0;
1399  int rv = 0;
1400 
1402  if (q == 0)
1403  {
1404  return;
1405  }
1406 
1407  if (lcm->nsh_map_index == (u32) ~ 0)
1408  {
1409  tmp_str = format (0, "N/A");
1410  }
1411  else
1412  {
1413  m = pool_elt_at_index (lcm->mapping_pool, lcm->nsh_map_index);
1414  if (~0 != m->locator_set_index)
1415  {
1416  ls =
1418  tmp_str = format (0, "%s", ls->name);
1419  is_set = 1;
1420  }
1421  else
1422  {
1423  tmp_str = format (0, "N/A");
1424  }
1425  }
1426  vec_add1 (tmp_str, 0);
1427 
1428  /* *INDENT-OFF* */
1429  REPLY_MACRO2(VL_API_SHOW_ONE_NSH_MAPPING_REPLY,
1430  ({
1431  rmp->is_set = is_set;
1432  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1433  ARRAY_LEN(rmp->locator_set_name) - 1);
1434  }));
1435  /* *INDENT-ON* */
1436 }
1437 
1438 static void
1440 {
1444  mapping_t *m;
1445  locator_set_t *ls = 0;
1446  u8 *tmp_str = 0;
1447  int rv = 0;
1448 
1450  if (q == 0)
1451  {
1452  return;
1453  }
1454 
1455  u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE)
1456  && lcm->pitr_map_index != ~0;
1457 
1458  if (!is_enabled)
1459  {
1460  tmp_str = format (0, "N/A");
1461  }
1462  else
1463  {
1465  if (~0 != m->locator_set_index)
1466  {
1467  ls =
1469  tmp_str = format (0, "%s", ls->name);
1470  }
1471  else
1472  {
1473  tmp_str = format (0, "N/A");
1474  }
1475  }
1476  vec_add1 (tmp_str, 0);
1477 
1478  /* *INDENT-OFF* */
1479  REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
1480  ({
1481  rmp->status = lcm->flags & LISP_FLAG_PITR_MODE;
1482  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1483  ARRAY_LEN(rmp->locator_set_name) - 1);
1484  }));
1485  /* *INDENT-ON* */
1486 }
1487 
1488 static void
1491 {
1493  vnet_api_error_t rv = 0;
1494 
1495  /* *INDENT-OFF* */
1496  REPLY_MACRO2 (VL_API_SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,
1497  ({
1499  }));
1500  /* *INDENT-ON* */
1501 }
1502 
1503 static void
1506 {
1507  vl_api_one_enable_disable_reply_t *rmp = NULL;
1508 
1510  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
1511 }
1512 
1513 static void
1514 lisp_fid_addr_to_api (fid_address_t * fid, u8 * dst, u8 * api_eid_type,
1515  u8 * prefix_length)
1516 {
1517  switch (fid_addr_type (fid))
1518  {
1519  case FID_ADDR_IP_PREF:
1520  *prefix_length = fid_addr_prefix_length (fid);
1521  if (fid_addr_ip_version (fid) == IP4)
1522  {
1523  *api_eid_type = 0; /* ipv4 type */
1524  clib_memcpy (dst, &fid_addr_ippref (fid), 4);
1525  }
1526  else
1527  {
1528  *api_eid_type = 1; /* ipv6 type */
1529  clib_memcpy (dst, &fid_addr_ippref (fid), 16);
1530  }
1531  break;
1532  case FID_ADDR_MAC:
1533  *api_eid_type = 2; /* l2 mac type */
1534  mac_copy (dst, fid_addr_mac (fid));
1535  break;
1536  default:
1537  ASSERT (0);
1538  }
1539 }
1540 
1541 static void
1543 {
1544  vl_api_one_stats_flush_reply_t *rmp;
1545  u8 rv;
1546 
1547  rv = vnet_lisp_flush_stats ();
1548  REPLY_MACRO (VL_API_ONE_STATS_FLUSH_REPLY);
1549 }
1550 
1551 static void
1553 {
1555  lisp_api_stats_t *stats, *stat;
1556  u8 rv = 0;
1557 
1558  stats = vnet_lisp_get_stats ();
1559  vec_foreach (stat, stats)
1560  {
1561  /* *INDENT-OFF* */
1562  REPLY_DETAILS (VL_API_ONE_STATS_DETAILS,
1563  ({
1564  lisp_fid_addr_to_api (&stat->deid, rmp->deid, &rmp->eid_type,
1565  &rmp->deid_pref_len);
1566  lisp_fid_addr_to_api (&stat->seid, rmp->seid, &rmp->eid_type,
1567  &rmp->seid_pref_len);
1568  rmp->vni = clib_host_to_net_u32 (stat->vni);
1569 
1570  rmp->is_ip4 = ip_addr_version (&stat->rmt_rloc) == IP4 ? 1 : 0;
1571  ip_address_copy_addr (rmp->rloc, &stat->rmt_rloc);
1572  ip_address_copy_addr (rmp->lloc, &stat->loc_rloc);
1573 
1574  rmp->pkt_count = clib_host_to_net_u32 (stat->counters.packets);
1575  rmp->bytes = clib_host_to_net_u32 (stat->counters.bytes);
1576  }));
1577  /* *INDENT-ON* */
1578  }
1579 }
1580 
1581 static void
1584 {
1585  vl_api_one_add_del_l2_arp_entry_reply_t *rmp;
1586  int rv = 0;
1587  gid_address_t _arp, *arp = &_arp;
1588  memset (arp, 0, sizeof (*arp));
1589 
1591  gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
1592 
1593  /* vpp keeps ip4 addresses in network byte order */
1594  ip_address_set (&gid_address_arp_ndp_ip (arp), &mp->ip4, IP4);
1595 
1596  rv = vnet_lisp_add_del_l2_arp_ndp_entry (arp, mp->mac, mp->is_add);
1597 
1598  REPLY_MACRO (VL_API_ONE_ADD_DEL_L2_ARP_ENTRY_REPLY);
1599 }
1600 
1601 static void
1603 {
1604  vl_api_one_add_del_ndp_entry_reply_t *rmp;
1605  int rv = 0;
1606  gid_address_t _g, *g = &_g;
1607  memset (g, 0, sizeof (*g));
1608 
1610  gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd);
1612 
1613  rv = vnet_lisp_add_del_l2_arp_ndp_entry (g, mp->mac, mp->is_add);
1614 
1615  REPLY_MACRO (VL_API_ONE_ADD_DEL_NDP_ENTRY_REPLY);
1616 }
1617 
1618 static void
1620 {
1622  int rv = 0;
1623  u32 i = 0;
1624  hash_pair_t *p;
1625 
1626  u32 *bds = vnet_lisp_ndp_bds_get ();
1627  u32 size = hash_elts (bds) * sizeof (u32);
1628 
1629  /* *INDENT-OFF* */
1630  REPLY_MACRO4 (VL_API_ONE_NDP_BD_GET_REPLY, size,
1631  {
1632  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1633  hash_foreach_pair (p, bds,
1634  ({
1635  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1636  }));
1637  });
1638  /* *INDENT-ON* */
1639 
1640  hash_free (bds);
1641 }
1642 
1643 static void
1645 {
1647  int rv = 0;
1648  u32 i = 0;
1649  hash_pair_t *p;
1650 
1651  u32 *bds = vnet_lisp_l2_arp_bds_get ();
1652  u32 size = hash_elts (bds) * sizeof (u32);
1653 
1654  /* *INDENT-OFF* */
1655  REPLY_MACRO4 (VL_API_ONE_L2_ARP_BD_GET_REPLY, size,
1656  {
1657  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1658  hash_foreach_pair (p, bds,
1659  ({
1660  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1661  }));
1662  });
1663  /* *INDENT-ON* */
1664 
1665  hash_free (bds);
1666 }
1667 
1668 static void
1670 {
1672  lisp_api_l2_arp_entry_t *entries = 0, *e;
1673  u32 i = 0;
1674  int rv = 0;
1675 
1676  u32 bd = clib_net_to_host_u32 (mp->bd);
1677 
1678  entries = vnet_lisp_l2_arp_entries_get_by_bd (bd);
1679  u32 size = vec_len (entries) * sizeof (vl_api_one_l2_arp_entry_t);
1680 
1681  /* *INDENT-OFF* */
1682  REPLY_MACRO4 (VL_API_ONE_L2_ARP_ENTRIES_GET_REPLY, size,
1683  {
1684  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1685  vec_foreach (e, entries)
1686  {
1687  mac_copy (rmp->entries[i].mac, e->mac);
1688  rmp->entries[i].ip4 = e->ip4;
1689  i++;
1690  }
1691  });
1692  /* *INDENT-ON* */
1693 
1694  vec_free (entries);
1695 }
1696 
1697 static void
1700 {
1701  vl_api_one_map_register_fallback_threshold_reply_t *rmp;
1702  int rv = 0;
1703 
1704  mp->value = clib_net_to_host_u32 (mp->value);
1706  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY);
1707 }
1708 
1709 static void
1712 {
1714  int rv = 0;
1715 
1717 
1718  /* *INDENT-OFF* */
1719  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY,
1720  ({
1721  rmp->value = clib_host_to_net_u32 (value);
1722  }));
1723  /* *INDENT-ON* */
1724 }
1725 
1726 static void
1729 {
1730  vl_api_one_set_transport_protocol_reply_t *rmp;
1731  int rv = 0;
1732 
1734 
1735  REPLY_MACRO (VL_API_ONE_SET_TRANSPORT_PROTOCOL_REPLY);
1736 }
1737 
1738 static void
1741 {
1743  int rv = 0;
1744  u8 proto = (u8) vnet_lisp_get_transport_protocol ();
1745 
1746  /* *INDENT-OFF* */
1747  REPLY_MACRO2 (VL_API_ONE_GET_TRANSPORT_PROTOCOL_REPLY,
1748  ({
1749  rmp->protocol = proto;
1750  }));
1751  /* *INDENT-ON* */
1752 }
1753 
1754 static void
1756 {
1758  lisp_api_ndp_entry_t *entries = 0, *e;
1759  u32 i = 0;
1760  int rv = 0;
1761 
1762  u32 bd = clib_net_to_host_u32 (mp->bd);
1763 
1764  entries = vnet_lisp_ndp_entries_get_by_bd (bd);
1765  u32 size = vec_len (entries) * sizeof (vl_api_one_ndp_entry_t);
1766 
1767  /* *INDENT-OFF* */
1768  REPLY_MACRO4 (VL_API_ONE_NDP_ENTRIES_GET_REPLY, size,
1769  {
1770  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1771  vec_foreach (e, entries)
1772  {
1773  mac_copy (rmp->entries[i].mac, e->mac);
1774  clib_memcpy (rmp->entries[i].ip6, e->ip6, 16);
1775  i++;
1776  }
1777  });
1778  /* *INDENT-ON* */
1779 
1780  vec_free (entries);
1781 }
1782 
1783 static void
1786 {
1787  vl_api_one_enable_disable_xtr_mode_reply_t *rmp = 0;
1789 
1790  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_XTR_MODE_REPLY);
1791 }
1792 
1793 static void
1795 {
1797  int rv = 0;
1798 
1799  /* *INDENT-OFF* */
1800  REPLY_MACRO2 (VL_API_ONE_SHOW_XTR_MODE_REPLY,
1801  {
1802  rmp->is_en = vnet_lisp_get_xtr_mode ();
1803  });
1804  /* *INDENT-ON* */
1805 }
1806 
1807 static void
1810 {
1811  vl_api_one_enable_disable_pitr_mode_reply_t *rmp = 0;
1813 
1814  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PITR_MODE_REPLY);
1815 }
1816 
1817 static void
1819 {
1821  int rv = 0;
1822 
1823  /* *INDENT-OFF* */
1824  REPLY_MACRO2 (VL_API_ONE_SHOW_PITR_MODE_REPLY,
1825  {
1826  rmp->is_en = vnet_lisp_get_pitr_mode ();
1827  });
1828  /* *INDENT-ON* */
1829 }
1830 
1831 static void
1834 {
1835  vl_api_one_enable_disable_petr_mode_reply_t *rmp = 0;
1837 
1838  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PETR_MODE_REPLY);
1839 }
1840 
1841 static void
1843 {
1845  int rv = 0;
1846 
1847  /* *INDENT-OFF* */
1848  REPLY_MACRO2 (VL_API_ONE_SHOW_PETR_MODE_REPLY,
1849  {
1850  rmp->is_en = vnet_lisp_get_petr_mode ();
1851  });
1852  /* *INDENT-ON* */
1853 }
1854 
1855 /*
1856  * one_api_hookup
1857  * Add vpe's API message handlers to the table.
1858  * vlib has alread mapped shared memory and
1859  * added the client registration handlers.
1860  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1861  */
1862 #define vl_msg_name_crc_list
1863 #include <vnet/vnet_all_api_h.h>
1864 #undef vl_msg_name_crc_list
1865 
1866 static void
1868 {
1869 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1870  foreach_vl_msg_name_crc_one;
1871 #undef _
1872 }
1873 
1874 static clib_error_t *
1876 {
1877  api_main_t *am = &api_main;
1878 
1879 #define _(N,n) \
1880  vl_msg_api_set_handlers(VL_API_##N, #n, \
1881  vl_api_##n##_t_handler, \
1882  vl_noop_handler, \
1883  vl_api_##n##_t_endian, \
1884  vl_api_##n##_t_print, \
1885  sizeof(vl_api_##n##_t), 1);
1887 #undef _
1888 
1889  /*
1890  * Set up the (msg_name, crc, message-id) table
1891  */
1893 
1894  return 0;
1895 }
1896 
1898 
1899 /*
1900  * fd.io coding-style-patch-verification: ON
1901  *
1902  * Local Variables:
1903  * eval: (c-set-style "gnu")
1904  * End:
1905  */
#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:833
static void vl_api_one_eid_table_dump_t_handler(vl_api_one_eid_table_dump_t *mp)
Definition: one_api.c:985
u8 mac[6]
Definition: one.api:420
vl_api_one_ndp_entry_t entries[count]
Definition: one.api:485
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:390
Add/delete L2 ARP entries.
Definition: one.api:415
#define gid_address_ip_version(_a)
Definition: lisp_types.h:265
Get ONE map request itr rlocs status.
Definition: one.api:918
u32 pitr_map_index
Definition: control.h:250
vnet_api_error_t
Definition: api_errno.h:139
gid_address_t leid
Definition: control.h:73
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
u8 vnet_lisp_get_pitr_mode(void)
Definition: control.c:4995
#define gid_address_type(_a)
Definition: lisp_types.h:261
Status of ONE PITR, enable or disable.
Definition: one.api:971
static void vl_api_one_enable_disable_pitr_mode_t_handler(vl_api_one_enable_disable_pitr_mode_t *mp)
Definition: one_api.c:1809
enable or disable ONE feature
Definition: one.api:178
static void vl_api_one_rloc_probe_enable_disable_t_handler(vl_api_one_rloc_probe_enable_disable_t *mp)
Definition: one_api.c:445
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:990
add or delete map request itr rlocs
Definition: one.api:592
Reply with list of bridge domains used by L2 ARP table.
Definition: one.api:553
lisp_msmr_t * map_resolvers
Definition: control.h:220
static void vl_api_one_stats_enable_disable_t_handler(vl_api_one_stats_enable_disable_t *mp)
Definition: one_api.c:1505
Definition: one.api:474
Get TTL for map register messages.
Definition: one.api:123
u32 vnet_lisp_set_transport_protocol(u8 protocol)
Definition: control.c:4871
configure or delete ONE NSH mapping
Definition: one.api:191
static void vl_api_one_add_del_local_eid_t_handler(vl_api_one_add_del_local_eid_t *mp)
Definition: one_api.c:332
#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:1602
static void vl_api_one_enable_disable_petr_mode_t_handler(vl_api_one_enable_disable_petr_mode_t *mp)
Definition: one_api.c:1833
uword * table_id_by_vni
Definition: control.h:239
add or delete locator_set
Definition: one.api:33
ONE adjacency.
Definition: one.api:771
static void vl_api_one_ndp_entries_get_t_handler(vl_api_one_ndp_entries_get_t *mp)
Definition: one_api.c:1755
static void vl_api_one_add_del_map_server_t_handler(vl_api_one_add_del_map_server_t *mp)
Definition: one_api.c:400
#define REPLY_MACRO2(t, body)
#define NULL
Definition: clib.h:55
Request for ONE status.
Definition: one.api:895
enable/disable ONE map-register
Definition: one.api:293
locator_t * locator_pool
Definition: control.h:177
dp_address_t seid
Definition: lisp_gpe.h:103
static void setup_message_id_table(api_main_t *am)
Definition: one_api.c:1867
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:842
ip_address_t loc_rloc
Definition: lisp_gpe.h:104
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Definition: vec.h:990
#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:93
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:700
static void vl_api_one_locator_dump_t_handler(vl_api_one_locator_dump_t *mp)
Definition: one_api.c:728
static void vl_api_one_show_pitr_mode_t_handler(vl_api_one_show_pitr_mode_t *mp)
Definition: one_api.c:1818
Request for map server summary status.
Definition: one.api:885
#define foreach_vpe_api_msg
Definition: one_api.c:86
u32 nsh_map_index
Definition: control.h:257
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:1728
static void vl_api_show_one_status_t_handler(vl_api_show_one_status_t *mp)
Definition: one_api.c:1329
ip_address_t address
Definition: control.h:88
vnet_api_error_t vnet_lisp_stats_enable_disable(u8 enable)
Definition: control.c:4835
int vnet_lisp_add_mapping(vnet_lisp_add_del_mapping_args_t *a, locator_t *rlocs, u32 *res_map_index, u8 *is_updated)
Adds/updates mapping.
Definition: control.c:1279
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: lisp_types.c:908
u8 mac[6]
Definition: one.api:476
Reply for ONE NSH mapping.
Definition: one.api:948
static void vl_api_show_one_map_request_mode_t_handler(vl_api_show_one_map_request_mode_t *mp)
Definition: one_api.c:466
static clib_error_t * one_api_hookup(vlib_main_t *vm)
Definition: one_api.c:1875
#define ip_prefix_version(_a)
Definition: lisp_types.h:72
u8 vnet_lisp_stats_enable_disable_state(void)
Definition: control.c:4851
#define fid_addr_mac(_a)
Definition: lisp_types.h:134
u8 vnet_lisp_map_register_state_get(void)
Definition: control.c:424
static void send_one_map_server_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1027
u8 vnet_lisp_get_petr_mode(void)
Definition: control.c:5002
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1559
int vnet_lisp_add_del_adjacency(vnet_lisp_add_del_adjacency_args_t *a)
Adds adjacency or removes forwarding entry associated to remote mapping.
Definition: control.c:1488
configure or disable use of PETR
Definition: one.api:220
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:1740
Request for L2 ARP entries from specified bridge domain.
Definition: one.api:430
Request for map request itr rlocs summary status.
Definition: one.api:926
ONE locator_set status.
Definition: one.api:640
lisp_msmr_t * map_servers
Definition: control.h:223
lisp_transport_protocol_t vnet_lisp_get_transport_protocol(void)
Definition: control.c:4884
u32 ip4
Definition: one.api:422
int vnet_lisp_enable_disable_petr_mode(u8 is_enabled)
Definition: control.c:4957
static void vl_api_one_adjacencies_get_t_handler(vl_api_one_adjacencies_get_t *mp)
Definition: one_api.c:1272
int vnet_lisp_enable_disable_pitr_mode(u8 is_enabled)
Definition: control.c:4928
static void vl_api_one_l2_arp_bd_get_t_handler(vl_api_one_l2_arp_bd_get_t *mp)
Definition: one_api.c:1644
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:438
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:1352
Request for ONE map-request mode.
Definition: one.api:340
u8 * key
Definition: lisp_types.h:373
Request for ONE adjacencies.
Definition: one.api:797
ip_address_t rmt_rloc
Definition: lisp_gpe.h:105
Request for one_eid_table_map_details.
Definition: one.api:820
int vnet_lisp_flush_stats(void)
u8 ip6[16]
Definition: one.api:464
#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:415
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 ip4
Definition: one.api:440
static void vl_api_one_map_register_set_ttl_t_handler(vl_api_one_map_register_set_ttl_t *mp)
Definition: one_api.c:169
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:1079
Dumps all VNIs used in mappings.
Definition: one.api:831
lisp_api_ndp_entry_t * vnet_lisp_ndp_entries_get_by_bd(u32 bd)
Definition: control.c:1025
static void vl_api_one_enable_disable_t_handler(vl_api_one_enable_disable_t *mp)
Definition: one_api.c:455
static void vl_api_one_add_del_adjacency_t_handler(vl_api_one_add_del_adjacency_t *mp)
Definition: one_api.c:676
static void vl_api_one_map_register_fallback_threshold_t_handler(vl_api_one_map_register_fallback_threshold_t *mp)
Definition: one_api.c:1699
uword * bd_id_by_vni
Definition: control.h:243
#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:1110
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:301
static int unformat_one_eid_api(gid_address_t *dst, u32 vni, u8 type, void *src, u8 len)
Definition: one_api.c:292
add or delete ONE adjacency adjacency
Definition: one.api:573
u32 bd
Definition: one.api:421
void * vl_msg_api_alloc(int nbytes)
vl_api_one_local_locator_t locators[locator_num]
Definition: one.api:40
u32 petr_map_index
Proxy ETR map index used for &#39;use-petr&#39;.
Definition: control.h:254
#define ip_addr_version(_a)
Definition: lisp_types.h:56
static void vl_api_one_add_del_map_request_itr_rlocs_t_handler(vl_api_one_add_del_map_request_itr_rlocs_t *mp)
Definition: one_api.c:597
Reply with list of bridge domains used by neighbor discovery.
Definition: one.api:530
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:2260
static void vl_api_one_map_register_enable_disable_t_handler(vl_api_one_map_register_enable_disable_t *mp)
Definition: one_api.c:434
void ip_address_copy_addr(void *dst, const ip_address_t *src)
Definition: lisp_types.c:902
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1631
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:459
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:431
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:1295
static void send_one_map_resolver_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1078
#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:112
static u8 fid_type_to_api_type(fid_address_t *fid)
Definition: one_api.c:860
int vnet_lisp_add_del_local_mapping(vnet_lisp_add_del_mapping_args_t *a, u32 *map_index_result)
Add/update/delete mapping to/in/from map-cache.
Definition: control.c:884
Request for ONE PITR status.
Definition: one.api:960
#define hash_free(h)
Definition: hash.h:309
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:620
u8 authoritative
Definition: lisp_types.h:363
Request for ONE PETR status.
Definition: one.api:233
lisp_api_stats_t * vnet_lisp_get_stats(void)
Definition: control.c:4535
#define REPLY_MACRO(t)
set ONE map-request mode.
Definition: one.api:329
u8 vnet_lisp_get_xtr_mode(void)
Definition: control.c:4988
Reply for show_one_rloc_probe_state.
Definition: one.api:269
add or delete map-resolver
Definition: one.api:164
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:1711
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:198
Definition: one.api:437
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:627
static void vl_api_one_ndp_bd_get_t_handler(vl_api_one_ndp_bd_get_t *mp)
Definition: one_api.c:1619
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:324
ONE map server details.
Definition: one.api:874
Request for map one locator status.
Definition: one.api:624
u32 * vnet_lisp_ndp_bds_get(void)
Definition: control.c:953
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:2392
Shows relationship between vni and vrf/bd.
Definition: one.api:808
vlib_counter_t counters
Definition: lisp_gpe.h:107
Dump ONE eid-table.
Definition: one.api:705
vl_api_one_remote_locator_t rlocs[rloc_num]
Definition: one.api:404
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:525
#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:304
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
Request for ONE NSH mapping.
Definition: one.api:937
#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:542
ONE adjacency reply.
Definition: one.api:784
#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:1176
#define clib_memcpy(a, b, c)
Definition: string.h:75
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:454
#define fid_addr_ip_version(_a)
Definition: lisp_types.h:133
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:2194
u32 vnet_lisp_map_register_fallback_threshold_get(void)
Definition: control.c:1683
Reply for show_one_map_request_mode.
Definition: one.api:351
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:268
#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_one_enable_disable_xtr_mode_t_handler(vl_api_one_enable_disable_xtr_mode_t *mp)
Definition: one_api.c:1785
static void vl_api_show_one_rloc_probe_state_t_handler(vl_api_show_one_rloc_probe_state_t *mp)
Definition: one_api.c:1243
static void vl_api_show_one_stats_enable_disable_t_handler(vl_api_show_one_stats_enable_disable_t *mp)
Definition: one_api.c:1490
#define fid_addr_ippref(_a)
Definition: lisp_types.h:131
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2322
Reply with L2 ARP entries from specified bridge domain.
Definition: one.api:449
int vnet_lisp_enable_disable_xtr_mode(u8 is_enabled)
Definition: control.c:4891
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:183
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:681
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:1258
u8 is_add
Definition: one.api:419
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1437
map/unmap vni/bd_index to vrf
Definition: one.api:607
#define gid_address_sd_dst(_a)
Definition: lisp_types.h:279
u8 mac[6]
Definition: one.api:462
gid_dictionary_t mapping_index_by_gid
Definition: control.h:168
#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:180
static void vl_api_one_nsh_set_locator_set_t_handler(vl_api_one_nsh_set_locator_set_t *mp)
Definition: one_api.c:491
#define gid_address_ndp_bd
Definition: lisp_types.h:287
static void vl_api_one_show_xtr_mode_t_handler(vl_api_one_show_xtr_mode_t *mp)
Definition: one_api.c:1794
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:1583
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:2185
static void vl_api_one_locator_set_dump_t_handler(vl_api_one_locator_set_dump_t *mp)
Definition: one_api.c:804
Get state of ONE RLOC probing.
Definition: one.api:258
Add/delete map server.
Definition: one.api:148
ONE PETR status, enable or disable.
Definition: one.api:245
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:1552
Definition: control.h:100
u64 uword
Definition: types.h:112
int vnet_lisp_map_register_fallback_threshold_set(u32 value)
Definition: control.c:1670
add or delete remote static mapping
Definition: one.api:389
static void vl_api_one_eid_table_map_dump_t_handler(vl_api_one_eid_table_map_dump_t *mp)
Definition: one_api.c:1145
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:2045
#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:1390
add or delete locator for locator set
Definition: one.api:64
static void vl_api_one_add_del_locator_set_t_handler(vl_api_one_add_del_locator_set_t *mp)
Definition: one_api.c:198
Reply for locator_set add/del.
Definition: one.api:48
Request for map resolver summary status.
Definition: one.api:864
#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:372
static void vl_api_one_add_del_locator_t_handler(vl_api_one_add_del_locator_t *mp)
Definition: one_api.c:250
enable/disable ONE RLOC probing
Definition: one.api:281
#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:1388
u32 * vnet_lisp_l2_arp_bds_get(void)
Definition: control.c:930
int vnet_lisp_add_del_locator(vnet_lisp_add_del_locator_set_args_t *a, locator_set_t *ls, u32 *ls_result)
Definition: control.c:1941
mapping_t * mapping_pool
Definition: control.h:171
uword * locator_set_index_by_name
Definition: control.h:186
int vnet_lisp_nsh_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1580
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:480
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:508
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:1669
#define hash_get_mem(h, key)
Definition: hash.h:268
void mac_copy(void *dst, void *src)
Definition: lisp_types.c:1051
static void vl_api_one_show_petr_mode_t_handler(vl_api_one_show_petr_mode_t *mp)
Definition: one_api.c:1842
ONE locator_set status.
Definition: one.api:656
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:2329
static void vl_api_show_one_pitr_t_handler(vl_api_show_one_pitr_t *mp)
Definition: one_api.c:1439
int vnet_lisp_add_del_l2_arp_ndp_entry(gid_address_t *key, u8 *mac, u8 is_add)
Definition: control.c:1040
u8 is_add
Definition: one.api:461
#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:495
static void vl_api_show_one_use_petr_t_handler(vl_api_show_one_use_petr_t *mp)
Definition: one_api.c:538
Request for eid table summary status.
Definition: one.api:749
vhost_vring_addr_t addr
Definition: vhost-user.h:83
u8 mac[6]
Definition: one.api:439
Request for locator_set summary status.
Definition: one.api:672
Contains current TTL for map register messages.
Definition: one.api:134
Request for list of bridge domains used by neighbor discovery.
Definition: one.api:519
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:1542
int vnet_lisp_map_register_set_ttl(u32 ttl)
Definition: control.c:2377
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:773
u32 vnet_lisp_map_register_get_ttl(void)
Definition: control.c:2385
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1698
ONE map resolver status.
Definition: one.api:853
static void send_eid_table_map_pair(hash_pair_t *p, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1129
u32 mreq_itr_rlocs
Definition: control.h:236
u8 ip6[16]
Definition: one.api:477
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:147
Reply for show_one_map_register_state.
Definition: one.api:314
static void lisp_fid_addr_to_api(fid_address_t *fid, u8 *dst, u8 *api_eid_type, u8 *prefix_length)
Definition: one_api.c:1514
uword key
Definition: hash.h:161
LISP-GPE definitions.
configure or disable ONE PITR node
Definition: one.api:205
Definition: one.api:457
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
u32 bd
Definition: one.api:463
vl_api_one_adjacency_t adjacencies[count]
Definition: one.api:789
static void one_adjacency_copy(vl_api_one_adjacency_t *dst, lisp_adjacency_t *adjs)
Definition: one_api.c:1189
static void vl_api_one_map_server_dump_t_handler(vl_api_one_map_server_dump_t *mp)
Definition: one_api.c:1059
static void send_one_eid_table_details(mapping_t *mapit, unix_shared_memory_queue_t *q, u32 context, u8 filter)
Definition: one_api.c:885