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