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