FD.io VPP  v19.08.3-2-gbabecb413
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  vl_api_registration_t * reg; \
74  rv = vl_msg_api_pd_handler (mp, rv); \
75  reg = vl_api_client_index_to_registration (mp->client_index); \
76  if (!reg) \
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_api_send_msg (reg, (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  clib_memset (&loc, 0, sizeof (loc));
158  gid_address_ip_set (&loc.address, &r->addr,
159  r->is_ip4 ? AF_IP4 : AF_IP6);
160 
161  loc.priority = r->priority;
162  loc.weight = r->weight;
163 
164  vec_add1 (locs, loc);
165  }
166  return locs;
167 }
168 
169 static void
171  mp)
172 {
173  vl_api_one_map_register_set_ttl_reply_t *rmp;
174  int rv = 0;
175 
176  mp->ttl = clib_net_to_host_u32 (mp->ttl);
178 
179  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_SET_TTL_REPLY);
180 }
181 
182 static void
185 {
187  int rv = 0;
188 
190  /* *INDENT-OFF* */
191  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_TTL_REPLY,
192  ({
193  rmp->ttl = clib_host_to_net_u32 (ttl);
194  }));
195  /* *INDENT-ON* */
196 }
197 
198 static void
200  mp)
201 {
203  int rv = 0;
205  locator_t locator;
207  u32 ls_index = ~0, locator_num;
208  u8 *locator_name = NULL;
209  int i;
210 
211  clib_memset (a, 0, sizeof (a[0]));
212 
213  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
214  locator_name = format (0, "%s", mp->locator_set_name);
215  vec_terminate_c_string (locator_name);
216 
217  a->name = locator_name;
218  a->is_add = mp->is_add;
219  a->local = 1;
220  locator_num = clib_net_to_host_u32 (mp->locator_num);
221 
222  clib_memset (&locator, 0, sizeof (locator));
223  for (i = 0; i < locator_num; i++)
224  {
225  ls_loc = &mp->locators[i];
226  VALIDATE_SW_IF_INDEX (ls_loc);
227 
228  locator.sw_if_index = htonl (ls_loc->sw_if_index);
229  locator.priority = ls_loc->priority;
230  locator.weight = ls_loc->weight;
231  locator.local = 1;
232  vec_add1 (a->locators, locator);
233  }
234 
235  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
236 
238 
239  vec_free (locator_name);
240  vec_free (a->locators);
241 
242  /* *INDENT-OFF* */
243  REPLY_MACRO2 (VL_API_ONE_ADD_DEL_LOCATOR_SET_REPLY,
244  ({
245  rmp->ls_index = clib_host_to_net_u32 (ls_index);
246  }));
247  /* *INDENT-ON* */
248 }
249 
250 static void
252 {
253  vl_api_one_add_del_locator_reply_t *rmp;
254  int rv = 0;
255  locator_t locator, *locators = NULL;
257  u32 ls_index = ~0;
258  u8 *locator_name = NULL;
259 
260  clib_memset (&locator, 0, sizeof (locator));
261  clib_memset (a, 0, sizeof (a[0]));
262 
263  locator.sw_if_index = ntohl (mp->sw_if_index);
264  locator.priority = mp->priority;
265  locator.weight = mp->weight;
266  locator.local = 1;
267  vec_add1 (locators, locator);
268 
269  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
270  locator_name = format (0, "%s", mp->locator_set_name);
271  vec_terminate_c_string (locator_name);
272 
273  a->name = locator_name;
274  a->locators = locators;
275  a->is_add = mp->is_add;
276  a->local = 1;
277 
278  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
279 
280  vec_free (locators);
281  vec_free (locator_name);
282 
283  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCATOR_REPLY);
284 }
285 
286 typedef struct
287 {
290 } __attribute__ ((__packed__)) lisp_nsh_api_t;
291 
292 static int
294  u8 len)
295 {
296  lisp_nsh_api_t *nsh;
297 
298  switch (type)
299  {
300  case 0: /* ipv4 */
302  gid_address_ip_set (dst, src, AF_IP4);
303  gid_address_ippref_len (dst) = len;
305  break;
306  case 1: /* ipv6 */
308  gid_address_ip_set (dst, src, AF_IP6);
309  gid_address_ippref_len (dst) = len;
311  break;
312  case 2: /* l2 mac */
314  clib_memcpy (&gid_address_mac (dst), src, 6);
315  break;
316  case 3: /* NSH */
318  nsh = src;
319  gid_address_nsh_spi (dst) = clib_net_to_host_u32 (nsh->spi);
320  gid_address_nsh_si (dst) = nsh->si;
321  break;
322  default:
323  /* unknown type */
324  return VNET_API_ERROR_INVALID_VALUE;
325  }
326 
327  gid_address_vni (dst) = vni;
328 
329  return 0;
330 }
331 
332 static void
334 {
335  vl_api_one_add_del_local_eid_reply_t *rmp;
337  int rv = 0;
338  gid_address_t _eid, *eid = &_eid;
339  uword *p = NULL;
340  u32 locator_set_index = ~0, map_index = ~0;
342  u8 *name = NULL, *key = NULL;
343  clib_memset (a, 0, sizeof (a[0]));
344  clib_memset (eid, 0, sizeof (eid[0]));
345 
346  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
347  mp->eid_type, mp->eid, mp->prefix_len);
348  if (rv)
349  goto out;
350 
351  if (gid_address_type (eid) == GID_ADDR_NSH)
352  {
353  rv = VNET_API_ERROR_INVALID_VALUE;
354  goto out;
355  }
356 
357  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
358  name = format (0, "%s", mp->locator_set_name);
359  vec_terminate_c_string (name);
360  p = hash_get_mem (lcm->locator_set_index_by_name, name);
361  if (!p)
362  {
363  rv = VNET_API_ERROR_INVALID_VALUE;
364  goto out;
365  }
366  locator_set_index = p[0];
367 
368  if (*mp->key)
369  key = format (0, "%s", mp->key);
370 
371  /* XXX treat batch configuration */
372  a->is_add = mp->is_add;
373  gid_address_copy (&a->eid, eid);
374  a->locator_set_index = locator_set_index;
375  a->local = 1;
376  a->key = key;
377  a->key_id = clib_net_to_host_u16 (mp->key_id);
378 
379  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
380 
381 out:
382  vec_free (name);
383  vec_free (key);
384  gid_address_free (&a->eid);
385 
386  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCAL_EID_REPLY);
387 }
388 
389 static void
392 {
393  vl_api_one_eid_table_add_del_map_reply_t *rmp;
394  int rv = 0;
395  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
396  clib_net_to_host_u32 (mp->dp_table),
397  mp->is_l2, mp->is_add);
398 REPLY_MACRO (VL_API_ONE_EID_TABLE_ADD_DEL_MAP_REPLY)}
399 
400 static void
402 {
403  vl_api_one_add_del_map_server_reply_t *rmp;
404  int rv = 0;
406 
407  clib_memset (&addr, 0, sizeof (addr));
408 
409  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? AF_IP6 : AF_IP4);
410  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
411 
412  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
413 }
414 
415 static void
417  * mp)
418 {
419  vl_api_one_add_del_map_resolver_reply_t *rmp;
420  int rv = 0;
422 
423  clib_memset (a, 0, sizeof (a[0]));
424 
425  a->is_add = mp->is_add;
427 
429 
430  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_RESOLVER_REPLY);
431 }
432 
433 static void
436 {
437  vl_api_one_map_register_enable_disable_reply_t *rmp;
438  int rv = 0;
439 
441  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
442 }
443 
444 static void
447 {
448  vl_api_one_rloc_probe_enable_disable_reply_t *rmp;
449  int rv = 0;
450 
452  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
453 }
454 
455 static void
457 {
458  vl_api_one_enable_disable_reply_t *rmp;
459  int rv = 0;
460 
462  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
463 }
464 
465 static void
468 {
469  int rv = 0;
471 
472  /* *INDENT-OFF* */
473  REPLY_MACRO2(VL_API_SHOW_ONE_MAP_REQUEST_MODE_REPLY,
474  ({
476  }));
477  /* *INDENT-ON* */
478 }
479 
480 static void
482 {
483  vl_api_one_map_request_mode_reply_t *rmp;
484  int rv = 0;
485 
487 
488  REPLY_MACRO (VL_API_ONE_MAP_REQUEST_MODE_REPLY);
489 }
490 
491 static void
493  * mp)
494 {
495  vl_api_one_nsh_set_locator_set_reply_t *rmp;
496  int rv = 0;
497  u8 *ls_name = 0;
498 
499  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
500  ls_name = format (0, "%s", mp->ls_name);
501  vec_terminate_c_string (ls_name);
502  rv = vnet_lisp_nsh_set_locator_set (ls_name, mp->is_add);
503  vec_free (ls_name);
504 
505  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
506 }
507 
508 static void
510  * mp)
511 {
512  vl_api_one_pitr_set_locator_set_reply_t *rmp;
513  int rv = 0;
514  u8 *ls_name = 0;
515 
516  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
517  ls_name = format (0, "%s", mp->ls_name);
518  vec_terminate_c_string (ls_name);
519  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
520  vec_free (ls_name);
521 
522  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
523 }
524 
525 static void
527 {
528  vl_api_one_use_petr_reply_t *rmp;
529  int rv = 0;
531 
532  ip_address_set (&addr, &mp->address, mp->is_ip4 ? AF_IP4 : AF_IP6);
533  rv = vnet_lisp_use_petr (&addr, mp->is_add);
534 
535  REPLY_MACRO (VL_API_ONE_USE_PETR_REPLY);
536 }
537 
538 static void
540 {
543  mapping_t *m;
544  locator_set_t *ls = 0;
545  int rv = 0;
546  locator_t *loc = 0;
547  u8 status = 0;
549 
550  clib_memset (&addr, 0, sizeof (addr));
551  status = lcm->flags & LISP_FLAG_USE_PETR;
552  if (status)
553  {
555  if (~0 != m->locator_set_index)
556  {
557  ls =
559  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
560  gid_address_copy (&addr, &loc->address);
561  }
562  }
563 
564  /* *INDENT-OFF* */
565  REPLY_MACRO2 (VL_API_SHOW_ONE_USE_PETR_REPLY,
566  {
567  rmp->status = status;
568  ip_address_t *ip = &gid_address_ip (&addr);
569  switch (ip_addr_version (ip))
570  {
571  case AF_IP4:
572  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
573  sizeof (ip_addr_v4 (ip)));
574  break;
575 
576  case AF_IP6:
577  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
578  sizeof (ip_addr_v6 (ip)));
579  break;
580 
581  default:
582  ASSERT (0);
583  }
584  rmp->is_ip4 = (gid_address_ip_version (&addr) == AF_IP4);
585  });
586  /* *INDENT-ON* */
587 }
588 
589 static void
592 {
593  vl_api_one_add_del_map_request_itr_rlocs_reply_t *rmp;
594  int rv = 0;
595  u8 *locator_set_name = NULL;
597 
598  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
599  locator_set_name = format (0, "%s", mp->locator_set_name);
600  vec_terminate_c_string (locator_set_name);
601 
602  a->is_add = mp->is_add;
603  a->locator_set_name = locator_set_name;
604 
606 
607  vec_free (locator_set_name);
608 
609  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
610 }
611 
612 static void
615 {
616  locator_t *rlocs = 0;
617  vl_api_one_add_del_remote_mapping_reply_t *rmp;
618  int rv = 0;
619  gid_address_t _eid, *eid = &_eid;
620  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
621 
622  clib_memset (eid, 0, sizeof (eid[0]));
623 
624  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
625  mp->eid_type, mp->eid, mp->eid_len);
626  if (rv)
627  goto send_reply;
628 
629  rlocs = unformat_one_locs (mp->rlocs, rloc_num);
630 
631  if (!mp->is_add)
632  {
634  clib_memset (a, 0, sizeof (a[0]));
635  gid_address_copy (&a->reid, eid);
636  a->is_add = 0;
638  if (rv)
639  {
640  goto out;
641  }
642  }
643 
644  /* NOTE: for now this works as a static remote mapping, i.e.,
645  * not authoritative and ttl infinite. */
646  if (mp->is_add)
647  {
648  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
649  clib_memset (m_args, 0, sizeof (m_args[0]));
650  gid_address_copy (&m_args->eid, eid);
651  m_args->action = mp->action;
652  m_args->is_static = 1;
653  m_args->ttl = ~0;
654  m_args->authoritative = 0;
655  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
656  }
657  else
658  rv = vnet_lisp_del_mapping (eid, NULL);
659 
660  if (mp->del_all)
662 
663 out:
664  vec_free (rlocs);
665 send_reply:
666  REPLY_MACRO (VL_API_ONE_ADD_DEL_REMOTE_MAPPING_REPLY);
667 }
668 
669 static void
671 {
672  vl_api_one_add_del_adjacency_reply_t *rmp;
674 
675  int rv = 0;
676  clib_memset (a, 0, sizeof (a[0]));
677 
678  rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
679  mp->eid_type, mp->leid, mp->leid_len);
680  rv |= unformat_one_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
681  mp->eid_type, mp->reid, mp->reid_len);
682 
683  if (rv)
684  goto send_reply;
685 
686  a->is_add = mp->is_add;
688 
689 send_reply:
690  REPLY_MACRO (VL_API_ONE_ADD_DEL_ADJACENCY_REPLY);
691 }
692 
693 static void
695  locator_t * loc, vl_api_registration_t * reg,
696  u32 context)
697 {
699 
700  rmp = vl_msg_api_alloc (sizeof (*rmp));
701  clib_memset (rmp, 0, sizeof (*rmp));
702  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
703  rmp->context = context;
704 
705  rmp->local = loc->local;
706  if (loc->local)
707  {
708  rmp->sw_if_index = ntohl (loc->sw_if_index);
709  }
710  else
711  {
712  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
714  }
715  rmp->priority = loc->priority;
716  rmp->weight = loc->weight;
717 
718  vl_api_send_msg (reg, (u8 *) rmp);
719 }
720 
721 static void
723 {
724  u8 *ls_name = 0;
727  locator_set_t *lsit = 0;
728  locator_t *loc = 0;
729  u32 ls_index = ~0, *locit = 0;
730  uword *p = 0;
731 
733  if (!reg)
734  return;
735 
736  if (mp->is_index_set)
737  ls_index = htonl (mp->ls_index);
738  else
739  {
740  /* make sure we get a proper C-string */
741  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
742  ls_name = format (0, "%s", mp->ls_name);
743  vec_terminate_c_string (ls_name);
744  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
745  if (!p)
746  goto out;
747  ls_index = p[0];
748  }
749 
750  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
751  return;
752 
753  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
754 
755  vec_foreach (locit, lsit->locator_indices)
756  {
757  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
758  send_one_locator_details (lcm, loc, reg, mp->context);
759  };
760 out:
761  vec_free (ls_name);
762 }
763 
764 static void
766  locator_set_t * lsit,
768  u32 ls_index)
769 {
771  u8 *str = 0;
772 
773  rmp = vl_msg_api_alloc (sizeof (*rmp));
774  clib_memset (rmp, 0, sizeof (*rmp));
775  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
776  rmp->context = context;
777 
778  rmp->ls_index = htonl (ls_index);
779  if (lsit->local)
780  {
781  ASSERT (lsit->name != NULL);
782  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
783  vec_len (lsit->name));
784  }
785  else
786  {
787  str = format (0, "<remote-%d>", ls_index);
788  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
789  vec_free (str);
790  }
791 
792  vl_api_send_msg (reg, (u8 *) rmp);
793 }
794 
795 static void
797 {
800  locator_set_t *lsit = NULL;
801  u8 filter;
802 
804  if (!reg)
805  return;
806 
807  filter = mp->filter;
808  /* *INDENT-OFF* */
809  pool_foreach (lsit, lcm->locator_set_pool,
810  ({
811  if (filter && !((1 == filter && lsit->local) ||
812  (2 == filter && !lsit->local)))
813  {
814  continue;
815  }
816  send_one_locator_set_details (lcm, lsit, reg, mp->context,
817  lsit - lcm->locator_set_pool);
818  }));
819  /* *INDENT-ON* */
820 }
821 
822 static void
823 one_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
824 {
825  ASSERT (prefix_length);
826  ip_prefix_t *ippref = &fid_addr_ippref (src);
827 
828  switch (fid_addr_type (src))
829  {
830  case FID_ADDR_IP_PREF:
831  if (ip_prefix_version (ippref) == AF_IP4)
832  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
833  else
834  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
835  prefix_length[0] = ip_prefix_len (ippref);
836  break;
837 
838  case FID_ADDR_MAC:
839  prefix_length[0] = 0;
840  clib_memcpy (dst, fid_addr_mac (src), 6);
841  break;
842 
843  default:
844  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
845  break;
846  }
847 }
848 
849 static u8
851 {
852  ip_prefix_t *ippref;
853 
854  switch (fid_addr_type (fid))
855  {
856  case FID_ADDR_IP_PREF:
857  ippref = &fid_addr_ippref (fid);
858  if (ip_prefix_version (ippref) == AF_IP4)
859  return 0;
860  else if (ip_prefix_version (ippref) == AF_IP6)
861  return 1;
862  else
863  return ~0;
864 
865  case FID_ADDR_MAC:
866  return 2;
867  case FID_ADDR_NSH:
868  return 3;
869  }
870 
871  return ~0;
872 }
873 
874 static void
877  u8 filter)
878 {
879  fid_address_t *fid;
881  locator_set_t *ls = 0;
882  vl_api_one_eid_table_details_t *rmp = NULL;
883  gid_address_t *gid = NULL;
884  u8 *mac = 0;
885  ip_prefix_t *ip_prefix = NULL;
886 
887  if (mapit->pitr_set || mapit->nsh_set)
888  return;
889 
890  switch (filter)
891  {
892  case 0: /* all mappings */
893  break;
894 
895  case 1: /* local only */
896  if (!mapit->local)
897  return;
898  break;
899  case 2: /* remote only */
900  if (mapit->local)
901  return;
902  break;
903  default:
904  clib_warning ("Filter error, unknown filter: %d", filter);
905  return;
906  }
907 
908  gid = &mapit->eid;
909  ip_prefix = &gid_address_ippref (gid);
910  mac = gid_address_mac (gid);
911 
912  rmp = vl_msg_api_alloc (sizeof (*rmp));
913  clib_memset (rmp, 0, sizeof (*rmp));
914  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
915 
917  if (vec_len (ls->locator_indices) == 0)
918  rmp->locator_set_index = ~0;
919  else
920  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
921 
922  rmp->is_local = mapit->local;
923  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
924  rmp->action = mapit->action;
925  rmp->authoritative = mapit->authoritative;
926 
927  switch (gid_address_type (gid))
928  {
929  case GID_ADDR_SRC_DST:
930  rmp->is_src_dst = 1;
931  fid = &gid_address_sd_src (gid);
932  rmp->eid_type = fid_type_to_api_type (fid);
934  &rmp->seid_prefix_len);
935  one_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
936  &rmp->eid_prefix_len);
937  break;
938  case GID_ADDR_IP_PREFIX:
939  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
940  if (ip_prefix_version (ip_prefix) == AF_IP4)
941  {
942  rmp->eid_type = 0; /* ipv4 type */
943  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
944  sizeof (ip_prefix_v4 (ip_prefix)));
945  }
946  else
947  {
948  rmp->eid_type = 1; /* ipv6 type */
949  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
950  sizeof (ip_prefix_v6 (ip_prefix)));
951  }
952  break;
953  case GID_ADDR_MAC:
954  rmp->eid_type = 2; /* l2 mac type */
955  clib_memcpy (rmp->eid, mac, 6);
956  break;
957  case GID_ADDR_NSH:
958  rmp->eid_type = 3; /* NSH type */
959  lisp_nsh_api_t nsh;
960  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (gid));
961  nsh.si = gid_address_nsh_si (gid);
962  clib_memcpy (rmp->eid, &nsh, sizeof (nsh));
963  break;
964  default:
965  ASSERT (0);
966  }
967  rmp->context = context;
968  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
969  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
970  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
971  vl_api_send_msg (reg, (u8 *) rmp);
972 }
973 
974 static void
976 {
977  u32 mi;
980  mapping_t *mapit = NULL;
981  gid_address_t _eid, *eid = &_eid;
982 
984  if (!reg)
985  return;
986 
987  if (mp->eid_set)
988  {
989  clib_memset (eid, 0, sizeof (*eid));
990 
991  unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
992  mp->eid_type, mp->eid, mp->prefix_length);
993 
995  if ((u32) ~ 0 == mi)
996  return;
997 
998  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
999  send_one_eid_table_details (mapit, reg, mp->context,
1000  0 /* ignore filter */ );
1001  }
1002  else
1003  {
1004  /* *INDENT-OFF* */
1005  pool_foreach (mapit, lcm->mapping_pool,
1006  ({
1007  send_one_eid_table_details(mapit, reg, mp->context,
1008  mp->filter);
1009  }));
1010  /* *INDENT-ON* */
1011  }
1012 }
1013 
1014 static void
1016  u32 context)
1017 {
1018  vl_api_one_map_server_details_t *rmp = NULL;
1019 
1020  rmp = vl_msg_api_alloc (sizeof (*rmp));
1021  clib_memset (rmp, 0, sizeof (*rmp));
1022  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
1023 
1024  switch (ip_addr_version (ip))
1025  {
1026  case AF_IP4:
1027  rmp->is_ipv6 = 0;
1028  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
1029  sizeof (ip_addr_v4 (ip)));
1030  break;
1031 
1032  case AF_IP6:
1033  rmp->is_ipv6 = 1;
1034  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
1035  sizeof (ip_addr_v6 (ip)));
1036  break;
1037 
1038  default:
1039  ASSERT (0);
1040  }
1041  rmp->context = context;
1042 
1043  vl_api_send_msg (reg, (u8 *) rmp);
1044 }
1045 
1046 static void
1048 {
1049  vl_api_registration_t *reg;
1051  lisp_msmr_t *mr;
1052 
1054  if (!reg)
1055  return;
1056 
1057  vec_foreach (mr, lcm->map_servers)
1058  {
1059  send_one_map_server_details (&mr->address, reg, mp->context);
1060  }
1061 }
1062 
1063 static void
1066 {
1068 
1069  rmp = vl_msg_api_alloc (sizeof (*rmp));
1070  clib_memset (rmp, 0, sizeof (*rmp));
1071  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
1072 
1073  switch (ip_addr_version (ip))
1074  {
1075  case AF_IP4:
1076  rmp->is_ipv6 = 0;
1077  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
1078  sizeof (ip_addr_v4 (ip)));
1079  break;
1080 
1081  case AF_IP6:
1082  rmp->is_ipv6 = 1;
1083  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
1084  sizeof (ip_addr_v6 (ip)));
1085  break;
1086 
1087  default:
1088  ASSERT (0);
1089  }
1090  rmp->context = context;
1091 
1092  vl_api_send_msg (reg, (u8 *) rmp);
1093 }
1094 
1095 static void
1097 {
1098  vl_api_registration_t *reg;
1100  lisp_msmr_t *mr;
1101 
1103  if (!reg)
1104  return;
1105 
1106  vec_foreach (mr, lcm->map_resolvers)
1107  {
1109  }
1110 }
1111 
1112 static void
1114  u32 context)
1115 {
1117 
1118  rmp = vl_msg_api_alloc (sizeof (*rmp));
1119  clib_memset (rmp, 0, sizeof (*rmp));
1120  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
1121 
1122  rmp->vni = clib_host_to_net_u32 (p->key);
1123  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1124  rmp->context = context;
1125  vl_api_send_msg (reg, (u8 *) rmp);
1126 }
1127 
1128 static void
1130 {
1131  vl_api_registration_t *reg;
1133  hash_pair_t *p;
1134  uword *vni_table = 0;
1135 
1137  if (!reg)
1138  return;
1139 
1140  if (mp->is_l2)
1141  {
1142  vni_table = lcm->bd_id_by_vni;
1143  }
1144  else
1145  {
1146  vni_table = lcm->table_id_by_vni;
1147  }
1148 
1149  /* *INDENT-OFF* */
1150  hash_foreach_pair (p, vni_table,
1151  ({
1152  send_eid_table_map_pair (p, reg, mp->context);
1153  }));
1154  /* *INDENT-ON* */
1155 }
1156 
1157 static void
1159 {
1161 
1162  rmp = vl_msg_api_alloc (sizeof (*rmp));
1163  clib_memset (rmp, 0, sizeof (*rmp));
1164  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
1165  rmp->context = context;
1166  rmp->vni = clib_host_to_net_u32 (vni);
1167  vl_api_send_msg (reg, (u8 *) rmp);
1168 }
1169 
1170 static void
1172 {
1173  lisp_adjacency_t *adj;
1175  u32 i, n = vec_len (adjs);
1176  lisp_nsh_api_t nsh;
1177 
1178  for (i = 0; i < n; i++)
1179  {
1180  adj = vec_elt_at_index (adjs, i);
1181  clib_memset (&a, 0, sizeof (a));
1182 
1183  switch (gid_address_type (&adj->reid))
1184  {
1185  case GID_ADDR_IP_PREFIX:
1188  if (gid_address_ip_version (&adj->reid) == AF_IP4)
1189  {
1190  a.eid_type = 0; /* ipv4 type */
1191  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1192  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1193  }
1194  else
1195  {
1196  a.eid_type = 1; /* ipv6 type */
1197  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1198  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1199  }
1200  break;
1201  case GID_ADDR_MAC:
1202  a.eid_type = 2; /* l2 mac type */
1203  mac_copy (a.reid, gid_address_mac (&adj->reid));
1204  mac_copy (a.leid, gid_address_mac (&adj->leid));
1205  break;
1206  case GID_ADDR_NSH:
1207  a.eid_type = 3; /* NSH type */
1208  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (&adj->reid));
1209  nsh.si = gid_address_nsh_si (&adj->reid);
1210  clib_memcpy (a.reid, &nsh, sizeof (nsh));
1211 
1212  nsh.spi = clib_host_to_net_u32 (gid_address_nsh_spi (&adj->leid));
1213  nsh.si = gid_address_nsh_si (&adj->leid);
1214  clib_memcpy (a.leid, &nsh, sizeof (nsh));
1215  break;
1216  default:
1217  ALWAYS_ASSERT (0);
1218  }
1219  dst[i] = a;
1220  }
1221 }
1222 
1223 static void
1226 {
1228  int rv = 0;
1229 
1230  /* *INDENT-OFF* */
1231  REPLY_MACRO2 (VL_API_SHOW_ONE_RLOC_PROBE_STATE_REPLY,
1232  {
1234  });
1235  /* *INDENT-ON* */
1236 }
1237 
1238 static void
1241 {
1243  int rv = 0;
1244 
1245  /* *INDENT-OFF* */
1246  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_STATE_REPLY,
1247  {
1249  });
1250  /* *INDENT-ON* */
1251 }
1252 
1253 static void
1255 {
1257  lisp_adjacency_t *adjs = 0;
1258  int rv = 0;
1259  u32 size = ~0;
1260  u32 vni = clib_net_to_host_u32 (mp->vni);
1261 
1262  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1263  size = vec_len (adjs) * sizeof (vl_api_one_adjacency_t);
1264 
1265  /* *INDENT-OFF* */
1266  REPLY_MACRO4 (VL_API_ONE_ADJACENCIES_GET_REPLY, size,
1267  {
1268  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1269  one_adjacency_copy (rmp->adjacencies, adjs);
1270  });
1271  /* *INDENT-ON* */
1272 
1273  vec_free (adjs);
1274 }
1275 
1276 static void
1278 {
1279  hash_pair_t *p;
1280  u32 *vnis = 0;
1281  vl_api_registration_t *reg;
1283 
1285  if (!reg)
1286  return;
1287 
1288  /* *INDENT-OFF* */
1290  ({
1291  hash_set (vnis, p->key, 0);
1292  }));
1293 
1295  ({
1296  hash_set (vnis, p->key, 0);
1297  }));
1298 
1299  hash_foreach_pair (p, vnis,
1300  ({
1301  send_eid_table_vni (p->key, reg, mp->context);
1302  }));
1303  /* *INDENT-ON* */
1304 
1305  hash_free (vnis);
1306 }
1307 
1308 static void
1310 {
1311  vl_api_show_one_status_reply_t *rmp = NULL;
1312  int rv = 0;
1313 
1314  /* *INDENT-OFF* */
1315  REPLY_MACRO2(VL_API_SHOW_ONE_STATUS_REPLY,
1316  ({
1319  }));
1320  /* *INDENT-ON* */
1321 }
1322 
1323 static void
1326 {
1329  locator_set_t *loc_set = 0;
1330  u8 *tmp_str = 0;
1331  int rv = 0;
1332 
1333  if (~0 == lcm->mreq_itr_rlocs)
1334  {
1335  tmp_str = format (0, " ");
1336  }
1337  else
1338  {
1339  loc_set =
1341  tmp_str = format (0, "%s", loc_set->name);
1342  }
1343 
1344  /* *INDENT-OFF* */
1345  REPLY_MACRO2(VL_API_ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1346  ({
1347  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1348  ARRAY_LEN(rmp->locator_set_name) - 1);
1349  }));
1350  /* *INDENT-ON* */
1351 
1352  vec_free (tmp_str);
1353 }
1354 
1355 static void
1357 {
1360  mapping_t *m;
1361  locator_set_t *ls = 0;
1362  u8 *tmp_str = 0;
1363  u8 is_set = 0;
1364  int rv = 0;
1365 
1366  if (lcm->nsh_map_index == (u32) ~ 0)
1367  {
1368  tmp_str = format (0, "N/A");
1369  }
1370  else
1371  {
1372  m = pool_elt_at_index (lcm->mapping_pool, lcm->nsh_map_index);
1373  if (~0 != m->locator_set_index)
1374  {
1375  ls =
1377  tmp_str = format (0, "%s", ls->name);
1378  is_set = 1;
1379  }
1380  else
1381  {
1382  tmp_str = format (0, "N/A");
1383  }
1384  }
1385  vec_add1 (tmp_str, 0);
1386 
1387  /* *INDENT-OFF* */
1388  REPLY_MACRO2(VL_API_SHOW_ONE_NSH_MAPPING_REPLY,
1389  ({
1390  rmp->is_set = is_set;
1391  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1392  ARRAY_LEN(rmp->locator_set_name) - 1);
1393  }));
1394  /* *INDENT-ON* */
1395 }
1396 
1397 static void
1399 {
1400  vl_api_show_one_pitr_reply_t *rmp = NULL;
1402  mapping_t *m;
1403  locator_set_t *ls = 0;
1404  u8 *tmp_str = 0;
1405  int rv = 0;
1406 
1407  u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE)
1408  && lcm->pitr_map_index != ~0;
1409 
1410  if (!is_enabled)
1411  {
1412  tmp_str = format (0, "N/A");
1413  }
1414  else
1415  {
1417  if (~0 != m->locator_set_index)
1418  {
1419  ls =
1421  tmp_str = format (0, "%s", ls->name);
1422  }
1423  else
1424  {
1425  tmp_str = format (0, "N/A");
1426  }
1427  }
1428  vec_add1 (tmp_str, 0);
1429 
1430  /* *INDENT-OFF* */
1431  REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
1432  ({
1433  rmp->status = lcm->flags & LISP_FLAG_PITR_MODE;
1434  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1435  ARRAY_LEN(rmp->locator_set_name) - 1);
1436  }));
1437  /* *INDENT-ON* */
1438 }
1439 
1440 static void
1443 {
1445  vnet_api_error_t rv = 0;
1446 
1447  /* *INDENT-OFF* */
1448  REPLY_MACRO2 (VL_API_SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,
1449  ({
1451  }));
1452  /* *INDENT-ON* */
1453 }
1454 
1455 static void
1458 {
1459  vl_api_one_enable_disable_reply_t *rmp = NULL;
1460 
1462  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
1463 }
1464 
1465 static void
1466 lisp_fid_addr_to_api (fid_address_t * fid, u8 * dst, u8 * api_eid_type,
1467  u8 * prefix_length)
1468 {
1469  switch (fid_addr_type (fid))
1470  {
1471  case FID_ADDR_IP_PREF:
1472  *prefix_length = fid_addr_prefix_length (fid);
1473  if (fid_addr_ip_version (fid) == AF_IP4)
1474  {
1475  *api_eid_type = 0; /* ipv4 type */
1476  clib_memcpy (dst, &fid_addr_ippref (fid), 4);
1477  }
1478  else
1479  {
1480  *api_eid_type = 1; /* ipv6 type */
1481  clib_memcpy (dst, &fid_addr_ippref (fid), 16);
1482  }
1483  break;
1484  case FID_ADDR_MAC:
1485  *api_eid_type = 2; /* l2 mac type */
1486  mac_copy (dst, fid_addr_mac (fid));
1487  break;
1488  default:
1489  ASSERT (0);
1490  }
1491 }
1492 
1493 static void
1495 {
1496  vl_api_one_stats_flush_reply_t *rmp;
1497  u8 rv;
1498 
1499  rv = vnet_lisp_flush_stats ();
1500  REPLY_MACRO (VL_API_ONE_STATS_FLUSH_REPLY);
1501 }
1502 
1503 static void
1505 {
1507  lisp_api_stats_t *stats, *stat;
1508  u8 rv = 0;
1509 
1510  stats = vnet_lisp_get_stats ();
1511  vec_foreach (stat, stats)
1512  {
1513  /* *INDENT-OFF* */
1514  REPLY_DETAILS (VL_API_ONE_STATS_DETAILS,
1515  ({
1516  lisp_fid_addr_to_api (&stat->deid, rmp->deid, &rmp->eid_type,
1517  &rmp->deid_pref_len);
1518  lisp_fid_addr_to_api (&stat->seid, rmp->seid, &rmp->eid_type,
1519  &rmp->seid_pref_len);
1520  rmp->vni = clib_host_to_net_u32 (stat->vni);
1521 
1522  rmp->is_ip4 = ip_addr_version (&stat->rmt_rloc) == AF_IP4 ? 1 : 0;
1523  ip_address_copy_addr (rmp->rloc, &stat->rmt_rloc);
1524  ip_address_copy_addr (rmp->lloc, &stat->loc_rloc);
1525 
1526  rmp->pkt_count = clib_host_to_net_u32 (stat->counters.packets);
1527  rmp->bytes = clib_host_to_net_u32 (stat->counters.bytes);
1528  }));
1529  /* *INDENT-ON* */
1530  }
1531 }
1532 
1533 static void
1536 {
1537  vl_api_one_add_del_l2_arp_entry_reply_t *rmp;
1538  int rv = 0;
1539  gid_address_t _arp, *arp = &_arp;
1540  clib_memset (arp, 0, sizeof (*arp));
1541 
1543  gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
1544 
1545  /* vpp keeps ip4 addresses in network byte order */
1547 
1548  rv = vnet_lisp_add_del_l2_arp_ndp_entry (arp, mp->mac, mp->is_add);
1549 
1550  REPLY_MACRO (VL_API_ONE_ADD_DEL_L2_ARP_ENTRY_REPLY);
1551 }
1552 
1553 static void
1555 {
1556  vl_api_one_add_del_ndp_entry_reply_t *rmp;
1557  int rv = 0;
1558  gid_address_t _g, *g = &_g;
1559  clib_memset (g, 0, sizeof (*g));
1560 
1562  gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd);
1564 
1565  rv = vnet_lisp_add_del_l2_arp_ndp_entry (g, mp->mac, mp->is_add);
1566 
1567  REPLY_MACRO (VL_API_ONE_ADD_DEL_NDP_ENTRY_REPLY);
1568 }
1569 
1570 static void
1572 {
1574  int rv = 0;
1575  u32 i = 0;
1576  hash_pair_t *p;
1577 
1578  u32 *bds = vnet_lisp_ndp_bds_get ();
1579  u32 size = hash_elts (bds) * sizeof (u32);
1580 
1581  /* *INDENT-OFF* */
1582  REPLY_MACRO4 (VL_API_ONE_NDP_BD_GET_REPLY, size,
1583  {
1584  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1585  hash_foreach_pair (p, bds,
1586  ({
1587  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1588  }));
1589  });
1590  /* *INDENT-ON* */
1591 
1592  hash_free (bds);
1593 }
1594 
1595 static void
1597 {
1599  int rv = 0;
1600  u32 i = 0;
1601  hash_pair_t *p;
1602 
1603  u32 *bds = vnet_lisp_l2_arp_bds_get ();
1604  u32 size = hash_elts (bds) * sizeof (u32);
1605 
1606  /* *INDENT-OFF* */
1607  REPLY_MACRO4 (VL_API_ONE_L2_ARP_BD_GET_REPLY, size,
1608  {
1609  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1610  hash_foreach_pair (p, bds,
1611  ({
1612  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1613  }));
1614  });
1615  /* *INDENT-ON* */
1616 
1617  hash_free (bds);
1618 }
1619 
1620 static void
1622 {
1625  u32 i = 0;
1626  int rv = 0;
1627 
1628  u32 bd = clib_net_to_host_u32 (mp->bd);
1629 
1630  entries = vnet_lisp_l2_arp_entries_get_by_bd (bd);
1631  u32 size = vec_len (entries) * sizeof (vl_api_one_l2_arp_entry_t);
1632 
1633  /* *INDENT-OFF* */
1634  REPLY_MACRO4 (VL_API_ONE_L2_ARP_ENTRIES_GET_REPLY, size,
1635  {
1636  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1637  vec_foreach (e, entries)
1638  {
1639  mac_copy (rmp->entries[i].mac, e->mac);
1640  rmp->entries[i].ip4 = e->ip4;
1641  i++;
1642  }
1643  });
1644  /* *INDENT-ON* */
1645 
1646  vec_free (entries);
1647 }
1648 
1649 static void
1652 {
1653  vl_api_one_map_register_fallback_threshold_reply_t *rmp;
1654  int rv = 0;
1655 
1656  mp->value = clib_net_to_host_u32 (mp->value);
1658  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY);
1659 }
1660 
1661 static void
1664 {
1666  int rv = 0;
1667 
1669 
1670  /* *INDENT-OFF* */
1671  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY,
1672  ({
1673  rmp->value = clib_host_to_net_u32 (value);
1674  }));
1675  /* *INDENT-ON* */
1676 }
1677 
1678 static void
1681 {
1682  vl_api_one_set_transport_protocol_reply_t *rmp;
1683  int rv = 0;
1684 
1686 
1687  REPLY_MACRO (VL_API_ONE_SET_TRANSPORT_PROTOCOL_REPLY);
1688 }
1689 
1690 static void
1693 {
1695  int rv = 0;
1697 
1698  /* *INDENT-OFF* */
1699  REPLY_MACRO2 (VL_API_ONE_GET_TRANSPORT_PROTOCOL_REPLY,
1700  ({
1701  rmp->protocol = proto;
1702  }));
1703  /* *INDENT-ON* */
1704 }
1705 
1706 static void
1708 {
1710  lisp_api_ndp_entry_t *entries = 0, *e;
1711  u32 i = 0;
1712  int rv = 0;
1713 
1714  u32 bd = clib_net_to_host_u32 (mp->bd);
1715 
1716  entries = vnet_lisp_ndp_entries_get_by_bd (bd);
1717  u32 size = vec_len (entries) * sizeof (vl_api_one_ndp_entry_t);
1718 
1719  /* *INDENT-OFF* */
1720  REPLY_MACRO4 (VL_API_ONE_NDP_ENTRIES_GET_REPLY, size,
1721  {
1722  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1723  vec_foreach (e, entries)
1724  {
1725  mac_copy (rmp->entries[i].mac, e->mac);
1726  clib_memcpy (rmp->entries[i].ip6, e->ip6, 16);
1727  i++;
1728  }
1729  });
1730  /* *INDENT-ON* */
1731 
1732  vec_free (entries);
1733 }
1734 
1735 static void
1738 {
1739  vl_api_one_enable_disable_xtr_mode_reply_t *rmp = 0;
1741 
1742  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_XTR_MODE_REPLY);
1743 }
1744 
1745 static void
1747 {
1749  int rv = 0;
1750 
1751  /* *INDENT-OFF* */
1752  REPLY_MACRO2 (VL_API_ONE_SHOW_XTR_MODE_REPLY,
1753  {
1754  rmp->is_en = vnet_lisp_get_xtr_mode ();
1755  });
1756  /* *INDENT-ON* */
1757 }
1758 
1759 static void
1762 {
1763  vl_api_one_enable_disable_pitr_mode_reply_t *rmp = 0;
1765 
1766  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PITR_MODE_REPLY);
1767 }
1768 
1769 static void
1771 {
1773  int rv = 0;
1774 
1775  /* *INDENT-OFF* */
1776  REPLY_MACRO2 (VL_API_ONE_SHOW_PITR_MODE_REPLY,
1777  {
1778  rmp->is_en = vnet_lisp_get_pitr_mode ();
1779  });
1780  /* *INDENT-ON* */
1781 }
1782 
1783 static void
1786 {
1787  vl_api_one_enable_disable_petr_mode_reply_t *rmp = 0;
1789 
1790  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PETR_MODE_REPLY);
1791 }
1792 
1793 static void
1795 {
1797  int rv = 0;
1798 
1799  /* *INDENT-OFF* */
1800  REPLY_MACRO2 (VL_API_ONE_SHOW_PETR_MODE_REPLY,
1801  {
1802  rmp->is_en = vnet_lisp_get_petr_mode ();
1803  });
1804  /* *INDENT-ON* */
1805 }
1806 
1807 /*
1808  * one_api_hookup
1809  * Add vpe's API message handlers to the table.
1810  * vlib has already mapped shared memory and
1811  * added the client registration handlers.
1812  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1813  */
1814 #define vl_msg_name_crc_list
1815 #include <vnet/vnet_all_api_h.h>
1816 #undef vl_msg_name_crc_list
1817 
1818 static void
1820 {
1821 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1822  foreach_vl_msg_name_crc_one;
1823 #undef _
1824 }
1825 
1826 static clib_error_t *
1828 {
1829  api_main_t *am = &api_main;
1830 
1831 #define _(N,n) \
1832  vl_msg_api_set_handlers(VL_API_##N, #n, \
1833  vl_api_##n##_t_handler, \
1834  vl_noop_handler, \
1835  vl_api_##n##_t_endian, \
1836  vl_api_##n##_t_print, \
1837  sizeof(vl_api_##n##_t), 1);
1839 #undef _
1840 
1841  /*
1842  * Set up the (msg_name, crc, message-id) table
1843  */
1845 
1846  return 0;
1847 }
1848 
1850 
1851 /*
1852  * fd.io coding-style-patch-verification: ON
1853  *
1854  * Local Variables:
1855  * eval: (c-set-style "gnu")
1856  * End:
1857  */
static void one_fid_put_api(u8 *dst, fid_address_t *src, u8 *prefix_length)
Definition: one_api.c:823
static void vl_api_one_eid_table_dump_t_handler(vl_api_one_eid_table_dump_t *mp)
Definition: one_api.c:975
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:391
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:154
gid_address_t leid
Definition: control.h:73
u8 vnet_lisp_get_pitr_mode(void)
Definition: control.c:5043
#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:1761
vl_api_mac_address_t mac
Definition: l2.api:490
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:446
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:976
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:1457
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:4919
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:333
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:765
#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:1554
static void vl_api_one_enable_disable_petr_mode_t_handler(vl_api_one_enable_disable_petr_mode_t *mp)
Definition: one_api.c:1785
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:1158
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:1707
static void vl_api_one_add_del_map_server_t_handler(vl_api_one_add_del_map_server_t *mp)
Definition: one_api.c:401
#define REPLY_MACRO2(t, body)
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:1819
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:1018
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
add or delete ONE eid-table
Definition: one.api:93
vl_api_address_t src
Definition: gre.api:51
static void vl_api_one_locator_dump_t_handler(vl_api_one_locator_dump_t *mp)
Definition: one_api.c:722
static void vl_api_one_show_pitr_mode_t_handler(vl_api_one_show_pitr_mode_t *mp)
Definition: one_api.c:1770
int i
Request for map server summary status.
Definition: one.api:883
#define foreach_vpe_api_msg
Definition: one_api.c:86
u32 nsh_map_index
Definition: control.h: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:1680
#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:1309
ip_address_t address
Definition: control.h:88
vnet_api_error_t vnet_lisp_stats_enable_disable(u8 enable)
Definition: control.c:4880
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:1265
u8 mac[6]
Definition: one.api:476
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:467
static clib_error_t * one_api_hookup(vlib_main_t *vm)
Definition: one_api.c:1827
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:4896
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:409
u8 vnet_lisp_get_petr_mode(void)
Definition: control.c:5050
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1545
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:1474
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:1692
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:4932
u32 ip4
Definition: one.api:422
int vnet_lisp_enable_disable_petr_mode(u8 is_enabled)
Definition: control.c:5005
static void vl_api_one_adjacencies_get_t_handler(vl_api_one_adjacencies_get_t *mp)
Definition: one_api.c:1254
static void send_one_eid_table_details(mapping_t *mapit, vl_api_registration_t *reg, u32 context, u8 filter)
Definition: one_api.c:875
int vnet_lisp_enable_disable_pitr_mode(u8 is_enabled)
Definition: control.c:4976
static void send_one_map_resolver_details(ip_address_t *ip, vl_api_registration_t *reg, u32 context)
Definition: one_api.c:1064
static void vl_api_one_l2_arp_bd_get_t_handler(vl_api_one_l2_arp_bd_get_t *mp)
Definition: one_api.c:1596
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:493
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:1325
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:416
#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
#define ALWAYS_ASSERT(truth)
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:170
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:1065
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:1011
static void vl_api_one_enable_disable_t_handler(vl_api_one_enable_disable_t *mp)
Definition: one_api.c:456
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:670
static void vl_api_one_map_register_fallback_threshold_t_handler(vl_api_one_map_register_fallback_threshold_t *mp)
Definition: one_api.c:1651
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:1096
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:293
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:591
static void send_eid_table_map_pair(hash_pair_t *p, vl_api_registration_t *reg, u32 context)
Definition: one_api.c:1113
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:2241
static void vl_api_one_map_register_enable_disable_t_handler(vl_api_one_map_register_enable_disable_t *mp)
Definition: one_api.c:435
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1617
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:416
uword size
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:694
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:1277
#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:850
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:870
Request for ONE PITR status.
Definition: one.api:958
#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:614
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:4580
#define REPLY_MACRO(t)
set ONE map-request mode.
Definition: one.api:329
u8 vnet_lisp_get_xtr_mode(void)
Definition: control.c:5036
Reply for show_one_rloc_probe_state.
Definition: one.api:269
vl_api_address_t dst
Definition: gre.api:52
u8 name[64]
Definition: memclnt.api:152
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:1663
u8 len
Definition: ip_types.api:90
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:203
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:612
static void vl_api_one_ndp_bd_get_t_handler(vl_api_one_ndp_bd_get_t *mp)
Definition: one_api.c:1571
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:939
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
Definition: control.c:2376
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:323
static void vl_api_one_use_petr_t_handler(vl_api_one_use_petr_t *mp)
Definition: one_api.c:526
#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:341
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:1015
#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:2175
u32 vnet_lisp_map_register_fallback_threshold_get(void)
Definition: control.c:1669
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:283
#define ARRAY_LEN(x)
Definition: clib.h:63
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
static void vl_api_one_enable_disable_xtr_mode_t_handler(vl_api_one_enable_disable_xtr_mode_t *mp)
Definition: one_api.c:1737
static void vl_api_show_one_rloc_probe_state_t_handler(vl_api_show_one_rloc_probe_state_t *mp)
Definition: one_api.c:1225
static void vl_api_show_one_stats_enable_disable_t_handler(vl_api_show_one_stats_enable_disable_t *mp)
Definition: one_api.c:1442
#define fid_addr_ippref(_a)
Definition: lisp_types.h:82
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2306
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:4939
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:184
u8 value
Definition: qos.api:53
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:666
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:1240
u8 is_add
Definition: one.api:419
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1423
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:71
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:492
#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:1746
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:1535
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:2166
static void vl_api_one_locator_set_dump_t_handler(vl_api_one_locator_set_dump_t *mp)
Definition: one_api.c:796
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:1504
Definition: control.h:100
u32 entries
int vnet_lisp_map_register_fallback_threshold_set(u32 value)
Definition: control.c:1656
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:1129
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:2031
#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:1356
add or delete locator for locator set
Definition: one.api:64
vl_api_address_t ip
Definition: l2.api:489
static void vl_api_one_add_del_locator_set_t_handler(vl_api_one_add_del_locator_set_t *mp)
Definition: one_api.c:199
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:251
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:1374
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:1927
typedef key
Definition: ipsec.api:247
#define ip_prefix_len(_a)
Definition: ip_types.h:76
mapping_t * mapping_pool
Definition: control.h:171
u32 vni
Definition: vxlan_gbp.api:42
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:1566
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:481
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:509
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:1621
#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:1794
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:2313
static void vl_api_show_one_pitr_t_handler(vl_api_show_one_pitr_t *mp)
Definition: one_api.c:1398
int vnet_lisp_add_del_l2_arp_ndp_entry(gid_address_t *key, u8 *mac, u8 is_add)
Definition: control.c:1026
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:539
Request for eid table summary status.
Definition: one.api:749
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
static void vl_api_one_stats_flush_t_handler(vl_api_one_stats_flush_t *mp)
Definition: one_api.c:1494
int vnet_lisp_map_register_set_ttl(u32 ttl)
Definition: control.c:2361
u32 vnet_lisp_map_register_get_ttl(void)
Definition: control.c:2369
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1684
u32 context
Definition: gre.api:45
ONE map resolver status.
Definition: one.api:851
api_main_t api_main
Definition: api_shared.c:35
u32 mreq_itr_rlocs
Definition: control.h:236
u8 ip6[16]
Definition: one.api:477
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: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:1466
uword key
Definition: hash.h:162
LISP-GPE definitions.
configure or disable ONE PITR node
Definition: one.api:205
Definition: one.api:457
vl_api_fib_path_nh_proto_t proto
Definition: fib_types.api:125
#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:1171
static void vl_api_one_map_server_dump_t_handler(vl_api_one_map_server_dump_t *mp)
Definition: one_api.c:1047