FD.io VPP  v21.01.1
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 <lisp/lisp-cp/control.h>
26 #include <lisp/lisp-gpe/lisp_gpe.h>
27 
28 #include <vnet/ip/ip_types_api.h>
30 
31 /* define message IDs */
32 #include <vnet/format_fns.h>
33 #include <lisp/lisp-cp/one.api_enum.h>
34 #include <lisp/lisp-cp/one.api_types.h>
35 
36 /**
37  * Base message ID fot the plugin
38  */
40 #define REPLY_MSG_ID_BASE one_base_msg_id
41 
43 
44 #define REPLY_DETAILS(t, body) \
45 do { \
46  vl_api_registration_t * reg; \
47  rv = vl_msg_api_pd_handler (mp, rv); \
48  reg = vl_api_client_index_to_registration (mp->client_index); \
49  if (!reg) \
50  return; \
51  \
52  rmp = vl_msg_api_alloc (sizeof (*rmp)); \
53  rmp->_vl_msg_id = ntohs((t)); \
54  rmp->context = mp->context; \
55  do {body;} while (0); \
56  vl_api_send_msg (reg, (u8 *)&rmp); \
57 } while(0);
58 
59 #define foreach_vpe_api_msg \
60 _(ONE_ADD_DEL_LOCATOR_SET, one_add_del_locator_set) \
61 _(ONE_ADD_DEL_LOCATOR, one_add_del_locator) \
62 _(ONE_ADD_DEL_LOCAL_EID, one_add_del_local_eid) \
63 _(ONE_ADD_DEL_MAP_RESOLVER, one_add_del_map_resolver) \
64 _(ONE_ADD_DEL_MAP_SERVER, one_add_del_map_server) \
65 _(ONE_ENABLE_DISABLE, one_enable_disable) \
66 _(ONE_RLOC_PROBE_ENABLE_DISABLE, one_rloc_probe_enable_disable) \
67 _(ONE_MAP_REGISTER_ENABLE_DISABLE, one_map_register_enable_disable) \
68 _(ONE_MAP_REGISTER_FALLBACK_THRESHOLD, \
69  one_map_register_fallback_threshold) \
70 _(ONE_ADD_DEL_REMOTE_MAPPING, one_add_del_remote_mapping) \
71 _(ONE_ADD_DEL_ADJACENCY, one_add_del_adjacency) \
72 _(ONE_PITR_SET_LOCATOR_SET, one_pitr_set_locator_set) \
73 _(ONE_NSH_SET_LOCATOR_SET, one_nsh_set_locator_set) \
74 _(ONE_MAP_REQUEST_MODE, one_map_request_mode) \
75 _(ONE_EID_TABLE_ADD_DEL_MAP, one_eid_table_add_del_map) \
76 _(ONE_LOCATOR_SET_DUMP, one_locator_set_dump) \
77 _(ONE_LOCATOR_DUMP, one_locator_dump) \
78 _(ONE_EID_TABLE_DUMP, one_eid_table_dump) \
79 _(ONE_MAP_RESOLVER_DUMP, one_map_resolver_dump) \
80 _(ONE_MAP_SERVER_DUMP, one_map_server_dump) \
81 _(ONE_EID_TABLE_MAP_DUMP, one_eid_table_map_dump) \
82 _(ONE_EID_TABLE_VNI_DUMP, one_eid_table_vni_dump) \
83 _(ONE_ADJACENCIES_GET, one_adjacencies_get) \
84 _(ONE_MAP_REGISTER_SET_TTL, one_map_register_set_ttl) \
85 _(SHOW_ONE_NSH_MAPPING, show_one_nsh_mapping) \
86 _(SHOW_ONE_RLOC_PROBE_STATE, show_one_rloc_probe_state) \
87 _(SHOW_ONE_MAP_REGISTER_STATE, show_one_map_register_state) \
88 _(SHOW_ONE_MAP_REGISTER_TTL, show_one_map_register_ttl) \
89 _(SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD, \
90  show_one_map_register_fallback_threshold) \
91 _(SHOW_ONE_STATUS, show_one_status) \
92 _(ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
93  one_add_del_map_request_itr_rlocs) \
94 _(ONE_GET_MAP_REQUEST_ITR_RLOCS, one_get_map_request_itr_rlocs) \
95 _(SHOW_ONE_PITR, show_one_pitr) \
96 _(SHOW_ONE_MAP_REQUEST_MODE, show_one_map_request_mode) \
97 _(ONE_USE_PETR, one_use_petr) \
98 _(SHOW_ONE_USE_PETR, show_one_use_petr) \
99 _(SHOW_ONE_STATS_ENABLE_DISABLE, show_one_stats_enable_disable) \
100 _(ONE_STATS_ENABLE_DISABLE, one_stats_enable_disable) \
101 _(ONE_STATS_DUMP, one_stats_dump) \
102 _(ONE_STATS_FLUSH, one_stats_flush) \
103 _(ONE_L2_ARP_BD_GET, one_l2_arp_bd_get) \
104 _(ONE_L2_ARP_ENTRIES_GET, one_l2_arp_entries_get) \
105 _(ONE_ADD_DEL_L2_ARP_ENTRY, one_add_del_l2_arp_entry) \
106 _(ONE_ADD_DEL_NDP_ENTRY, one_add_del_ndp_entry) \
107 _(ONE_NDP_BD_GET, one_ndp_bd_get) \
108 _(ONE_NDP_ENTRIES_GET, one_ndp_entries_get) \
109 _(ONE_SET_TRANSPORT_PROTOCOL, one_set_transport_protocol) \
110 _(ONE_GET_TRANSPORT_PROTOCOL, one_get_transport_protocol) \
111 _(ONE_ENABLE_DISABLE_XTR_MODE, one_enable_disable_xtr_mode) \
112 _(ONE_SHOW_XTR_MODE, one_show_xtr_mode) \
113 _(ONE_ENABLE_DISABLE_PITR_MODE, one_enable_disable_pitr_mode) \
114 _(ONE_SHOW_PITR_MODE, one_show_pitr_mode) \
115 _(ONE_ENABLE_DISABLE_PETR_MODE, one_enable_disable_petr_mode) \
116 _(ONE_SHOW_PETR_MODE, one_show_petr_mode) \
117 
118 
119 static locator_t *
120 unformat_one_locs (vl_api_remote_locator_t * rmt_locs, u32 rloc_num)
121 {
122  u32 i;
123  locator_t *locs = 0, loc;
124  vl_api_remote_locator_t *r;
125 
126  for (i = 0; i < rloc_num; i++)
127  {
128  /* remote locators */
129  r = &rmt_locs[i];
130  clib_memset (&loc, 0, sizeof (loc));
131  ip_address_decode2 (&r->ip_address, &loc.address.ippref.addr);
132  loc.address.ippref.len =
133  ip_address_max_len (loc.address.ippref.addr.version);
134 
135  loc.priority = r->priority;
136  loc.weight = r->weight;
137 
138  vec_add1 (locs, loc);
139  }
140  return locs;
141 }
142 
143 static void
145  mp)
146 {
147  vl_api_one_map_register_set_ttl_reply_t *rmp;
148  int rv = 0;
149 
150  mp->ttl = clib_net_to_host_u32 (mp->ttl);
152 
153  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_SET_TTL_REPLY);
154 }
155 
156 static void
159 {
161  int rv = 0;
162 
164  /* *INDENT-OFF* */
165  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_TTL_REPLY,
166  ({
167  rmp->ttl = clib_host_to_net_u32 (ttl);
168  }));
169  /* *INDENT-ON* */
170 }
171 
172 static void
174  mp)
175 {
177  int rv = 0;
179  locator_t locator;
180  vl_api_local_locator_t *ls_loc;
181  u32 ls_index = ~0, locator_num;
182  u8 *locator_name = NULL;
183  int i;
184 
185  clib_memset (a, 0, sizeof (a[0]));
186 
187  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
188  locator_name = format (0, "%s", mp->locator_set_name);
189  vec_terminate_c_string (locator_name);
190 
191  a->name = locator_name;
192  a->is_add = mp->is_add;
193  a->local = 1;
194  locator_num = clib_net_to_host_u32 (mp->locator_num);
195 
196  clib_memset (&locator, 0, sizeof (locator));
197  for (i = 0; i < locator_num; i++)
198  {
199  ls_loc = &mp->locators[i];
200  VALIDATE_SW_IF_INDEX (ls_loc);
201 
202  locator.sw_if_index = htonl (ls_loc->sw_if_index);
203  locator.priority = ls_loc->priority;
204  locator.weight = ls_loc->weight;
205  locator.local = 1;
206  vec_add1 (a->locators, locator);
207  }
208 
209  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
210 
212 
213  vec_free (locator_name);
214  vec_free (a->locators);
215 
216  /* *INDENT-OFF* */
217  REPLY_MACRO2 (VL_API_ONE_ADD_DEL_LOCATOR_SET_REPLY,
218  ({
219  rmp->ls_index = clib_host_to_net_u32 (ls_index);
220  }));
221  /* *INDENT-ON* */
222 }
223 
224 static void
226 {
227  vl_api_one_add_del_locator_reply_t *rmp;
228  int rv = 0;
229  locator_t locator, *locators = NULL;
231  u32 ls_index = ~0;
232  u8 *locator_name = NULL;
233 
234  clib_memset (&locator, 0, sizeof (locator));
235  clib_memset (a, 0, sizeof (a[0]));
236 
237  locator.sw_if_index = ntohl (mp->sw_if_index);
238  locator.priority = mp->priority;
239  locator.weight = mp->weight;
240  locator.local = 1;
241  vec_add1 (locators, locator);
242 
243  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
244  locator_name = format (0, "%s", mp->locator_set_name);
245  vec_terminate_c_string (locator_name);
246 
247  a->name = locator_name;
248  a->locators = locators;
249  a->is_add = mp->is_add;
250  a->local = 1;
251 
252  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
253 
254  vec_free (locators);
255  vec_free (locator_name);
256 
257  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCATOR_REPLY);
258 }
259 
260 typedef struct
261 {
264 } __attribute__ ((__packed__)) lisp_nsh_api_t;
265 
266 static int
268 {
270 
271  switch (eid->type)
272  {
273  case EID_TYPE_API_PREFIX:
274  ip_prefix_decode (&eid->address.prefix, &prefix);
276  if (prefix.fp_proto == FIB_PROTOCOL_IP4)
277  gid_address_ip_set (dst, &prefix.fp_addr.ip4, AF_IP4);
278  if (prefix.fp_proto == FIB_PROTOCOL_IP6)
279  gid_address_ip_set (dst, &prefix.fp_addr.ip6, AF_IP6);
280  gid_address_ippref_len (dst) = prefix.fp_len;
282  break;
283  case EID_TYPE_API_MAC:
285  mac_address_decode (eid->address.mac,
286  (mac_address_t *) & gid_address_mac (dst));
287  break;
288  case EID_TYPE_API_NSH:
290  gid_address_nsh_spi (dst) = clib_net_to_host_u32 (eid->address.nsh.spi);
291  gid_address_nsh_si (dst) = eid->address.nsh.si;
292  break;
293  default:
294  /* unknown type */
295  return VNET_API_ERROR_INVALID_VALUE;
296  }
297 
298  gid_address_vni (dst) = vni;
299 
300  return 0;
301 }
302 
303 static void
304 fid_to_api_eid (fid_address_t * fid, vl_api_eid_t * eid)
305 {
306  fib_prefix_t fib_prefix;
307  u32 eid_type;
308 
309  switch (fid_addr_type (fid))
310  {
311  case FID_ADDR_IP_PREF:
312  eid_type = EID_TYPE_API_PREFIX;
313  ip_prefix_to_fib_prefix (&fid_addr_ippref (fid), &fib_prefix);
314  ip_prefix_encode (&fib_prefix, &eid->address.prefix);
315  break;
316  case FID_ADDR_MAC:
317  eid_type = EID_TYPE_API_MAC;
319  eid->address.mac);
320  break;
321  default:
322  /* unknown type */
323  return;
324  }
325 
326  eid->type = eid_type;
327 }
328 
329 static void
331 {
332  vl_api_one_add_del_local_eid_reply_t *rmp;
334  int rv = 0;
335  gid_address_t _eid, *eid = &_eid;
336  uword *p = NULL;
337  u32 locator_set_index = ~0, map_index = ~0;
339  u8 *name = NULL, *key = NULL;
340  clib_memset (a, 0, sizeof (a[0]));
341  clib_memset (eid, 0, sizeof (eid[0]));
342 
343  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni), &mp->eid);
344  if (rv)
345  goto out;
346 
347  if (gid_address_type (eid) == GID_ADDR_NSH)
348  {
349  rv = VNET_API_ERROR_INVALID_VALUE;
350  goto out;
351  }
352 
353  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
354  name = format (0, "%s", mp->locator_set_name);
355  vec_terminate_c_string (name);
356  p = hash_get_mem (lcm->locator_set_index_by_name, name);
357  if (!p)
358  {
359  rv = VNET_API_ERROR_INVALID_VALUE;
360  goto out;
361  }
362  locator_set_index = p[0];
363 
364  if (mp->key.id != KEY_ID_API_HMAC_NO_KEY)
365  key = format (0, "%s", mp->key.key);
366 
367  /* XXX treat batch configuration */
368  a->is_add = mp->is_add;
369  gid_address_copy (&a->eid, eid);
370  a->locator_set_index = locator_set_index;
371  a->local = 1;
372  a->key = key;
373  a->key_id = mp->key.id;
374 
375  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
376 
377 out:
378  vec_free (name);
379  vec_free (key);
380  gid_address_free (&a->eid);
381 
382  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCAL_EID_REPLY);
383 }
384 
385 static void
388 {
389  vl_api_one_eid_table_add_del_map_reply_t *rmp;
390  int rv = 0;
391  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
392  clib_net_to_host_u32 (mp->dp_table),
393  mp->is_l2, mp->is_add);
394 REPLY_MACRO (VL_API_ONE_EID_TABLE_ADD_DEL_MAP_REPLY)}
395 
396 static void
398 {
399  vl_api_one_add_del_map_server_reply_t *rmp;
400  int rv = 0;
402 
403  clib_memset (&addr, 0, sizeof (addr));
404 
405  ip_address_decode2 (&mp->ip_address, &addr);
406 
407  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
408 
409  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
410 }
411 
412 static void
414  * mp)
415 {
416  vl_api_one_add_del_map_resolver_reply_t *rmp;
417  int rv = 0;
419 
420  clib_memset (a, 0, sizeof (a[0]));
421 
423 
424  a->is_add = mp->is_add;
425 
427 
428  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_RESOLVER_REPLY);
429 }
430 
431 static void
434 {
435  vl_api_one_map_register_enable_disable_reply_t *rmp;
436  int rv = 0;
437 
439  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
440 }
441 
442 static void
445 {
446  vl_api_one_rloc_probe_enable_disable_reply_t *rmp;
447  int rv = 0;
448 
450  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
451 }
452 
453 static void
455 {
456  vl_api_one_enable_disable_reply_t *rmp;
457  int rv = 0;
458 
460  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
461 }
462 
463 static void
466 {
467  int rv = 0;
469 
470  /* *INDENT-OFF* */
471  REPLY_MACRO2(VL_API_SHOW_ONE_MAP_REQUEST_MODE_REPLY,
472  ({
474  }));
475  /* *INDENT-ON* */
476 }
477 
478 static void
480 {
481  vl_api_one_map_request_mode_reply_t *rmp;
482  int rv = 0;
483 
485 
486  REPLY_MACRO (VL_API_ONE_MAP_REQUEST_MODE_REPLY);
487 }
488 
489 static void
491  * mp)
492 {
493  vl_api_one_nsh_set_locator_set_reply_t *rmp;
494  int rv = 0;
495  u8 *ls_name = 0;
496 
497  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
498  ls_name = format (0, "%s", mp->ls_name);
499  vec_terminate_c_string (ls_name);
500  rv = vnet_lisp_nsh_set_locator_set (ls_name, mp->is_add);
501  vec_free (ls_name);
502 
503  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
504 }
505 
506 static void
508  * mp)
509 {
510  vl_api_one_pitr_set_locator_set_reply_t *rmp;
511  int rv = 0;
512  u8 *ls_name = 0;
513 
514  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
515  ls_name = format (0, "%s", mp->ls_name);
516  vec_terminate_c_string (ls_name);
517  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
518  vec_free (ls_name);
519 
520  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
521 }
522 
523 static void
525 {
526  vl_api_one_use_petr_reply_t *rmp;
527  int rv = 0;
529 
530  ip_address_decode2 (&mp->ip_address, &addr);
531 
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 
569  ip_address_encode2 (ip, &rmp->ip_address);
570  });
571  /* *INDENT-ON* */
572 }
573 
574 static void
577 {
578  vl_api_one_add_del_map_request_itr_rlocs_reply_t *rmp;
579  int rv = 0;
580  u8 *locator_set_name = NULL;
582 
583  mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
584  locator_set_name = format (0, "%s", mp->locator_set_name);
585  vec_terminate_c_string (locator_set_name);
586 
587  a->is_add = mp->is_add;
588  a->locator_set_name = locator_set_name;
589 
591 
592  vec_free (locator_set_name);
593 
594  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
595 }
596 
597 static void
600 {
601  locator_t *rlocs = 0;
602  vl_api_one_add_del_remote_mapping_reply_t *rmp;
603  int rv = 0;
604  gid_address_t _eid, *eid = &_eid;
605  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
606 
607  clib_memset (eid, 0, sizeof (eid[0]));
608 
609  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni), &mp->deid);
610  if (rv)
611  goto send_reply;
612 
613  rlocs = unformat_one_locs (mp->rlocs, rloc_num);
614 
615  if (!mp->is_add)
616  {
618  clib_memset (a, 0, sizeof (a[0]));
619  gid_address_copy (&a->reid, eid);
620  a->is_add = 0;
622  if (rv)
623  {
624  goto out;
625  }
626  }
627 
628  /* NOTE: for now this works as a static remote mapping, i.e.,
629  * not authoritative and ttl infinite. */
630  if (mp->is_add)
631  {
632  vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
633  clib_memset (m_args, 0, sizeof (m_args[0]));
634  gid_address_copy (&m_args->eid, eid);
635  m_args->action = mp->action;
636  m_args->is_static = 1;
637  m_args->ttl = ~0;
638  m_args->authoritative = 0;
639  rv = vnet_lisp_add_mapping (m_args, rlocs, NULL, NULL);
640  }
641  else
642  rv = vnet_lisp_del_mapping (eid, NULL);
643 
644  if (mp->del_all)
646 
647 out:
648  vec_free (rlocs);
649 send_reply:
650  REPLY_MACRO (VL_API_ONE_ADD_DEL_REMOTE_MAPPING_REPLY);
651 }
652 
653 static void
655 {
656  vl_api_one_add_del_adjacency_reply_t *rmp;
658 
659  int rv = 0;
660  clib_memset (a, 0, sizeof (a[0]));
661 
662  rv =
663  unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
664  &mp->leid);
665  rv |=
666  unformat_one_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
667  &mp->reid);
668 
669  if (rv)
670  goto send_reply;
671 
672  a->is_add = mp->is_add;
674 
675 send_reply:
676  REPLY_MACRO (VL_API_ONE_ADD_DEL_ADJACENCY_REPLY);
677 }
678 
679 static void
681  locator_t * loc, vl_api_registration_t * reg,
682  u32 context)
683 {
685 
686  rmp = vl_msg_api_alloc (sizeof (*rmp));
687  clib_memset (rmp, 0, sizeof (*rmp));
688  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
689  rmp->context = context;
690 
691  rmp->local = loc->local;
692  if (loc->local)
693  {
694  rmp->sw_if_index = ntohl (loc->sw_if_index);
695  }
696  else
697  {
698  ip_address_encode2 (&loc->address.ippref.addr, &rmp->ip_address);
699  }
700  rmp->priority = loc->priority;
701  rmp->weight = loc->weight;
702 
703  vl_api_send_msg (reg, (u8 *) rmp);
704 }
705 
706 static void
708 {
709  u8 *ls_name = 0;
712  locator_set_t *lsit = 0;
713  locator_t *loc = 0;
714  u32 ls_index = ~0, *locit = 0;
715  uword *p = 0;
716 
718  if (!reg)
719  return;
720 
721  if (mp->is_index_set)
722  ls_index = htonl (mp->ls_index);
723  else
724  {
725  /* make sure we get a proper C-string */
726  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
727  ls_name = format (0, "%s", mp->ls_name);
728  vec_terminate_c_string (ls_name);
729  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
730  if (!p)
731  goto out;
732  ls_index = p[0];
733  }
734 
735  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
736  return;
737 
738  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
739 
740  vec_foreach (locit, lsit->locator_indices)
741  {
742  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
743  send_one_locator_details (lcm, loc, reg, mp->context);
744  };
745 out:
746  vec_free (ls_name);
747 }
748 
749 static void
751  locator_set_t * lsit,
752  vl_api_registration_t * reg, u32 context,
753  u32 ls_index)
754 {
756  u8 *str = 0;
757 
758  rmp = vl_msg_api_alloc (sizeof (*rmp));
759  clib_memset (rmp, 0, sizeof (*rmp));
760  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
761  rmp->context = context;
762 
763  rmp->ls_index = htonl (ls_index);
764  if (lsit->local)
765  {
766  ASSERT (lsit->name != NULL);
767  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
768  vec_len (lsit->name));
769  }
770  else
771  {
772  str = format (0, "<remote-%d>", ls_index);
773  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
774  vec_free (str);
775  }
776 
777  vl_api_send_msg (reg, (u8 *) rmp);
778 }
779 
780 static void
782 {
785  locator_set_t *lsit = NULL;
786  u8 filter;
787 
789  if (!reg)
790  return;
791 
792  filter = mp->filter;
793  /* *INDENT-OFF* */
794  pool_foreach (lsit, lcm->locator_set_pool)
795  {
796  if (filter && !((1 == filter && lsit->local) ||
797  (2 == filter && !lsit->local)))
798  {
799  continue;
800  }
801  send_one_locator_set_details (lcm, lsit, reg, mp->context,
802  lsit - lcm->locator_set_pool);
803  }
804  /* *INDENT-ON* */
805 }
806 
807 static void
809  vl_api_registration_t * reg, u32 context,
810  u8 filter)
811 {
813  locator_set_t *ls = 0;
814  vl_api_one_eid_table_details_t *rmp = NULL;
815  gid_address_t *gid = NULL;
816  u32 eid_type;
817  fib_prefix_t fib_prefix;
818 
819  if (mapit->pitr_set || mapit->nsh_set)
820  return;
821 
822  switch (filter)
823  {
824  case ONE_FILTER_API_ALL: /* all mappings */
825  break;
826 
827  case ONE_FILTER_API_LOCAL: /* local only */
828  if (!mapit->local)
829  return;
830  break;
831  case ONE_FILTER_API_REMOTE: /* remote only */
832  if (mapit->local)
833  return;
834  break;
835  default:
836  clib_warning ("Filter error, unknown filter: %d", filter);
837  return;
838  }
839 
840  gid = &mapit->eid;
841 
842  rmp = vl_msg_api_alloc (sizeof (*rmp));
843  clib_memset (rmp, 0, sizeof (*rmp));
844  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
845 
847  if (vec_len (ls->locator_indices) == 0)
848  rmp->locator_set_index = ~0;
849  else
850  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
851 
852  rmp->is_local = mapit->local;
853  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
854  rmp->action = mapit->action;
855  rmp->authoritative = mapit->authoritative;
856 
857  switch (gid_address_type (gid))
858  {
859  case GID_ADDR_SRC_DST:
860  fid_to_api_eid (&gid_address_sd_src (gid), &rmp->seid);
861  fid_to_api_eid (&gid_address_sd_dst (gid), &rmp->deid);
862  break;
863  case GID_ADDR_IP_PREFIX:
864  eid_type = EID_TYPE_API_PREFIX;
865  rmp->seid.type = eid_type;
866  ip_prefix_to_fib_prefix (&gid_address_ippref (gid), &fib_prefix);
867  ip_prefix_encode (&fib_prefix, &rmp->seid.address.prefix);
868  break;
869  case GID_ADDR_MAC:
870  eid_type = EID_TYPE_API_MAC;
871  rmp->seid.type = eid_type;
873  rmp->seid.address.mac);
874  break;
875  case GID_ADDR_NSH:
876  eid_type = EID_TYPE_API_NSH;
877  rmp->seid.type = eid_type;
878  rmp->seid.address.nsh.spi =
879  clib_host_to_net_u32 (gid_address_nsh_spi (gid));
880  rmp->seid.address.nsh.si = gid_address_nsh_si (gid);
881  break;
882  default:
883  /* unknown type */
884  return;
885  }
886 
887  rmp->context = context;
888  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
889  rmp->key.id = mapit->key_id;
890  memcpy (rmp->key.key, mapit->key, vec_len (mapit->key));
891  vl_api_send_msg (reg, (u8 *) rmp);
892 }
893 
894 static void
896 {
897  u32 mi;
900  mapping_t *mapit = NULL;
901  gid_address_t _eid, *eid = &_eid;
902 
904  if (!reg)
905  return;
906 
907  if (mp->eid_set)
908  {
909  clib_memset (eid, 0, sizeof (*eid));
910 
911  unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni), &mp->eid);
912 
914  if ((u32) ~ 0 == mi)
915  return;
916 
917  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
918  send_one_eid_table_details (mapit, reg, mp->context,
919  0 /* ignore filter */ );
920  }
921  else
922  {
923  /* *INDENT-OFF* */
924  pool_foreach (mapit, lcm->mapping_pool)
925  {
926  send_one_eid_table_details(mapit, reg, mp->context,
927  mp->filter);
928  }
929  /* *INDENT-ON* */
930  }
931 }
932 
933 static void
935  u32 context)
936 {
938 
939  rmp = vl_msg_api_alloc (sizeof (*rmp));
940  clib_memset (rmp, 0, sizeof (*rmp));
941  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
942 
943 
944  ip_address_encode2 (ip, &rmp->ip_address);
945 
946  rmp->context = context;
947 
948  vl_api_send_msg (reg, (u8 *) rmp);
949 }
950 
951 static void
953 {
956  lisp_msmr_t *mr;
957 
959  if (!reg)
960  return;
961 
962  vec_foreach (mr, lcm->map_servers)
963  {
965  }
966 }
967 
968 static void
970  vl_api_registration_t * reg, u32 context)
971 {
973 
974  rmp = vl_msg_api_alloc (sizeof (*rmp));
975  clib_memset (rmp, 0, sizeof (*rmp));
976  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
977 
978  ip_address_encode2 (ip, &rmp->ip_address);
979  rmp->context = context;
980 
981  vl_api_send_msg (reg, (u8 *) rmp);
982 }
983 
984 static void
986 {
989  lisp_msmr_t *mr;
990 
992  if (!reg)
993  return;
994 
995  vec_foreach (mr, lcm->map_resolvers)
996  {
998  }
999 }
1000 
1001 static void
1003  u32 context)
1004 {
1006 
1007  rmp = vl_msg_api_alloc (sizeof (*rmp));
1008  clib_memset (rmp, 0, sizeof (*rmp));
1009  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
1010 
1011  rmp->vni = clib_host_to_net_u32 (p->key);
1012  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1013  rmp->context = context;
1014  vl_api_send_msg (reg, (u8 *) rmp);
1015 }
1016 
1017 static void
1019 {
1020  vl_api_registration_t *reg;
1022  hash_pair_t *p;
1023  uword *vni_table = 0;
1024 
1026  if (!reg)
1027  return;
1028 
1029  if (mp->is_l2)
1030  {
1031  vni_table = lcm->bd_id_by_vni;
1032  }
1033  else
1034  {
1035  vni_table = lcm->table_id_by_vni;
1036  }
1037 
1038  /* *INDENT-OFF* */
1039  hash_foreach_pair (p, vni_table,
1040  ({
1041  send_eid_table_map_pair (p, reg, mp->context);
1042  }));
1043  /* *INDENT-ON* */
1044 }
1045 
1046 static void
1048 {
1050 
1051  rmp = vl_msg_api_alloc (sizeof (*rmp));
1052  clib_memset (rmp, 0, sizeof (*rmp));
1053  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
1054  rmp->context = context;
1055  rmp->vni = clib_host_to_net_u32 (vni);
1056  vl_api_send_msg (reg, (u8 *) rmp);
1057 }
1058 
1059 static void
1060 one_adjacency_copy (vl_api_one_adjacency_t * dst, lisp_adjacency_t * adjs)
1061 {
1062  lisp_adjacency_t *adj;
1063  vl_api_one_adjacency_t a;
1064  u32 i, n = vec_len (adjs);
1065  fib_prefix_t rfib_prefix, lfib_prefix;
1066  u32 eid_type;
1067 
1068  for (i = 0; i < n; i++)
1069  {
1070  adj = vec_elt_at_index (adjs, i);
1071  clib_memset (&a, 0, sizeof (a));
1072 
1073  switch (gid_address_type (&adj->reid))
1074  {
1075  case GID_ADDR_IP_PREFIX:
1076  eid_type = EID_TYPE_API_PREFIX;
1078  &rfib_prefix);
1080  &lfib_prefix);
1081  ip_prefix_encode (&rfib_prefix, &a.reid.address.prefix);
1082  ip_prefix_encode (&lfib_prefix, &a.leid.address.prefix);
1083  break;
1084  case GID_ADDR_MAC:
1085  eid_type = EID_TYPE_API_PREFIX;
1087  a.reid.address.mac);
1089  a.leid.address.mac);
1090  break;
1091  case GID_ADDR_NSH:
1092  eid_type = EID_TYPE_API_PREFIX;
1093  a.reid.address.nsh.spi =
1094  clib_host_to_net_u32 (gid_address_nsh_spi (&adj->reid));
1095  a.reid.address.nsh.si = gid_address_nsh_si (&adj->reid);
1096  a.leid.address.nsh.spi =
1097  clib_host_to_net_u32 (gid_address_nsh_spi (&adj->leid));
1098  a.leid.address.nsh.si = gid_address_nsh_si (&adj->leid);
1099  break;
1100  default:
1101  ALWAYS_ASSERT (0);
1102  }
1103  a.reid.type = eid_type;
1104  a.leid.type = eid_type;
1105  dst[i] = a;
1106  }
1107 }
1108 
1109 static void
1112 {
1114  int rv = 0;
1115 
1116  /* *INDENT-OFF* */
1117  REPLY_MACRO2 (VL_API_SHOW_ONE_RLOC_PROBE_STATE_REPLY,
1118  {
1120  });
1121  /* *INDENT-ON* */
1122 }
1123 
1124 static void
1127 {
1129  int rv = 0;
1130 
1131  /* *INDENT-OFF* */
1132  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_STATE_REPLY,
1133  {
1135  });
1136  /* *INDENT-ON* */
1137 }
1138 
1139 static void
1141 {
1143  lisp_adjacency_t *adjs = 0;
1144  int rv = 0;
1145  u32 size = ~0;
1146  u32 vni = clib_net_to_host_u32 (mp->vni);
1147 
1148  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1149  size = vec_len (adjs) * sizeof (vl_api_one_adjacency_t);
1150 
1151  /* *INDENT-OFF* */
1152  REPLY_MACRO4 (VL_API_ONE_ADJACENCIES_GET_REPLY, size,
1153  {
1154  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1155  one_adjacency_copy (rmp->adjacencies, adjs);
1156  });
1157  /* *INDENT-ON* */
1158 
1159  vec_free (adjs);
1160 }
1161 
1162 static void
1164 {
1165  hash_pair_t *p;
1166  u32 *vnis = 0;
1167  vl_api_registration_t *reg;
1169 
1171  if (!reg)
1172  return;
1173 
1174  /* *INDENT-OFF* */
1176  ({
1177  hash_set (vnis, p->key, 0);
1178  }));
1179 
1181  ({
1182  hash_set (vnis, p->key, 0);
1183  }));
1184 
1185  hash_foreach_pair (p, vnis,
1186  ({
1187  send_eid_table_vni (p->key, reg, mp->context);
1188  }));
1189  /* *INDENT-ON* */
1190 
1191  hash_free (vnis);
1192 }
1193 
1194 static void
1196 {
1197  vl_api_show_one_status_reply_t *rmp = NULL;
1198  int rv = 0;
1199 
1200  /* *INDENT-OFF* */
1201  REPLY_MACRO2(VL_API_SHOW_ONE_STATUS_REPLY,
1202  ({
1205  }));
1206  /* *INDENT-ON* */
1207 }
1208 
1209 static void
1212 {
1215  locator_set_t *loc_set = 0;
1216  u8 *tmp_str = 0;
1217  int rv = 0;
1218 
1219  if (~0 == lcm->mreq_itr_rlocs)
1220  {
1221  tmp_str = format (0, " ");
1222  }
1223  else
1224  {
1225  loc_set =
1227  tmp_str = format (0, "%s", loc_set->name);
1228  }
1229 
1230  /* *INDENT-OFF* */
1231  REPLY_MACRO2(VL_API_ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1232  ({
1233  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1234  ARRAY_LEN(rmp->locator_set_name) - 1);
1235  }));
1236  /* *INDENT-ON* */
1237 
1238  vec_free (tmp_str);
1239 }
1240 
1241 static void
1243 {
1246  mapping_t *m;
1247  locator_set_t *ls = 0;
1248  u8 *tmp_str = 0;
1249  u8 is_set = 0;
1250  int rv = 0;
1251 
1252  if (lcm->nsh_map_index == (u32) ~ 0)
1253  {
1254  tmp_str = format (0, "N/A");
1255  }
1256  else
1257  {
1258  m = pool_elt_at_index (lcm->mapping_pool, lcm->nsh_map_index);
1259  if (~0 != m->locator_set_index)
1260  {
1261  ls =
1263  tmp_str = format (0, "%s", ls->name);
1264  is_set = 1;
1265  }
1266  else
1267  {
1268  tmp_str = format (0, "N/A");
1269  }
1270  }
1271  vec_add1 (tmp_str, 0);
1272 
1273  /* *INDENT-OFF* */
1274  REPLY_MACRO2(VL_API_SHOW_ONE_NSH_MAPPING_REPLY,
1275  ({
1276  rmp->is_set = is_set;
1277  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1278  ARRAY_LEN(rmp->locator_set_name) - 1);
1279  }));
1280  /* *INDENT-ON* */
1281 }
1282 
1283 static void
1285 {
1286  vl_api_show_one_pitr_reply_t *rmp = NULL;
1288  mapping_t *m;
1289  locator_set_t *ls = 0;
1290  u8 *tmp_str = 0;
1291  int rv = 0;
1292 
1293  u8 is_enable = (lcm->flags & LISP_FLAG_PITR_MODE)
1294  && lcm->pitr_map_index != ~0;
1295 
1296  if (!is_enable)
1297  {
1298  tmp_str = format (0, "N/A");
1299  }
1300  else
1301  {
1303  if (~0 != m->locator_set_index)
1304  {
1305  ls =
1307  tmp_str = format (0, "%s", ls->name);
1308  }
1309  else
1310  {
1311  tmp_str = format (0, "N/A");
1312  }
1313  }
1314  vec_add1 (tmp_str, 0);
1315 
1316  /* *INDENT-OFF* */
1317  REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
1318  ({
1319  rmp->status = lcm->flags & LISP_FLAG_PITR_MODE;
1320  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1321  ARRAY_LEN(rmp->locator_set_name) - 1);
1322  }));
1323  /* *INDENT-ON* */
1324 }
1325 
1326 static void
1329 {
1331  vnet_api_error_t rv = 0;
1332 
1333  /* *INDENT-OFF* */
1334  REPLY_MACRO2 (VL_API_SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,
1335  ({
1337  }));
1338  /* *INDENT-ON* */
1339 }
1340 
1341 static void
1344 {
1345  vl_api_one_enable_disable_reply_t *rmp = NULL;
1346 
1348  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
1349 }
1350 
1351 static void
1353 {
1354  vl_api_one_stats_flush_reply_t *rmp;
1355  u8 rv;
1356 
1357  rv = vnet_lisp_flush_stats ();
1358  REPLY_MACRO (VL_API_ONE_STATS_FLUSH_REPLY);
1359 }
1360 
1361 static void
1363 {
1365  lisp_api_stats_t *stats, *stat;
1366  u8 rv = 0;
1367 
1368  stats = vnet_lisp_get_stats ();
1369  vec_foreach (stat, stats)
1370  {
1371  /* *INDENT-OFF* */
1372  REPLY_DETAILS (VL_API_ONE_STATS_DETAILS,
1373  ({
1374  fid_to_api_eid (&stat->deid, &rmp->deid);
1375  fid_to_api_eid (&stat->seid, &rmp->seid);
1376  rmp->vni = clib_host_to_net_u32 (stat->vni);
1377 
1378  ip_address_encode2 (&stat->rmt_rloc, &rmp->rloc);
1379  ip_address_encode2 (&stat->loc_rloc, &rmp->lloc);
1380 
1381  rmp->pkt_count = clib_host_to_net_u32 (stat->counters.packets);
1382  rmp->bytes = clib_host_to_net_u32 (stat->counters.bytes);
1383  }));
1384  /* *INDENT-ON* */
1385  }
1386 }
1387 
1388 static void
1391 {
1392  vl_api_one_add_del_l2_arp_entry_reply_t *rmp;
1393  int rv = 0;
1394  gid_address_t _arp, *arp = &_arp;
1397  clib_memset (arp, 0, sizeof (*arp));
1398 
1400  gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
1401 
1402  ip4_address_decode (mp->entry.ip4, &ip4);
1404  mac_address_decode (mp->entry.mac, &mac);
1405 
1406  rv = vnet_lisp_add_del_l2_arp_ndp_entry (arp, mac.bytes, mp->is_add);
1407 
1408  REPLY_MACRO (VL_API_ONE_ADD_DEL_L2_ARP_ENTRY_REPLY);
1409 }
1410 
1411 static void
1413 {
1414  vl_api_one_add_del_ndp_entry_reply_t *rmp;
1415  int rv = 0;
1416  gid_address_t _g, *g = &_g;
1417  ip6_address_t ip6;
1419  clib_memset (g, 0, sizeof (*g));
1420 
1422  gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd);
1423 
1424  ip6_address_decode (mp->entry.ip6, &ip6);
1426  mac_address_decode (mp->entry.mac, &mac);
1427 
1428  rv = vnet_lisp_add_del_l2_arp_ndp_entry (g, mac.bytes, mp->is_add);
1429 
1430  REPLY_MACRO (VL_API_ONE_ADD_DEL_NDP_ENTRY_REPLY);
1431 }
1432 
1433 static void
1435 {
1437  int rv = 0;
1438  u32 i = 0;
1439  hash_pair_t *p;
1440 
1441  u32 *bds = vnet_lisp_ndp_bds_get ();
1442  u32 size = hash_elts (bds) * sizeof (u32);
1443 
1444  /* *INDENT-OFF* */
1445  REPLY_MACRO4 (VL_API_ONE_NDP_BD_GET_REPLY, size,
1446  {
1447  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1448  hash_foreach_pair (p, bds,
1449  ({
1450  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1451  }));
1452  });
1453  /* *INDENT-ON* */
1454 
1455  hash_free (bds);
1456 }
1457 
1458 static void
1460 {
1462  int rv = 0;
1463  u32 i = 0;
1464  hash_pair_t *p;
1465 
1466  u32 *bds = vnet_lisp_l2_arp_bds_get ();
1467  u32 size = hash_elts (bds) * sizeof (u32);
1468 
1469  /* *INDENT-OFF* */
1470  REPLY_MACRO4 (VL_API_ONE_L2_ARP_BD_GET_REPLY, size,
1471  {
1472  rmp->count = clib_host_to_net_u32 (hash_elts (bds));
1473  hash_foreach_pair (p, bds,
1474  ({
1475  rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
1476  }));
1477  });
1478  /* *INDENT-ON* */
1479 
1480  hash_free (bds);
1481 }
1482 
1483 static void
1485 {
1488  u32 i = 0;
1489  int rv = 0;
1490 
1491  u32 bd = clib_net_to_host_u32 (mp->bd);
1492 
1493  entries = vnet_lisp_l2_arp_entries_get_by_bd (bd);
1494  u32 size = vec_len (entries) * sizeof (vl_api_one_l2_arp_entry_t);
1495 
1496  /* *INDENT-OFF* */
1497  REPLY_MACRO4 (VL_API_ONE_L2_ARP_ENTRIES_GET_REPLY, size,
1498  {
1499  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1500  vec_foreach (e, entries)
1501  {
1502  mac_address_encode ((mac_address_t *) e->mac, rmp->entries[i].mac);
1503  ip4_address_encode ((ip4_address_t *) &e->ip4, rmp->entries[i].ip4);
1504  i++;
1505  }
1506  });
1507  /* *INDENT-ON* */
1508 
1509  vec_free (entries);
1510 }
1511 
1512 static void
1515 {
1516  vl_api_one_map_register_fallback_threshold_reply_t *rmp;
1517  int rv = 0;
1518 
1519  mp->value = clib_net_to_host_u32 (mp->value);
1521  REPLY_MACRO (VL_API_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY);
1522 }
1523 
1524 static void
1527 {
1529  int rv = 0;
1530 
1532 
1533  /* *INDENT-OFF* */
1534  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY,
1535  ({
1536  rmp->value = clib_host_to_net_u32 (value);
1537  }));
1538  /* *INDENT-ON* */
1539 }
1540 
1541 static void
1544 {
1545  vl_api_one_set_transport_protocol_reply_t *rmp;
1546  int rv = 0;
1547 
1549 
1550  REPLY_MACRO (VL_API_ONE_SET_TRANSPORT_PROTOCOL_REPLY);
1551 }
1552 
1553 static void
1556 {
1558  int rv = 0;
1560 
1561  /* *INDENT-OFF* */
1562  REPLY_MACRO2 (VL_API_ONE_GET_TRANSPORT_PROTOCOL_REPLY,
1563  ({
1564  rmp->protocol = proto;
1565  }));
1566  /* *INDENT-ON* */
1567 }
1568 
1569 static void
1571 {
1573  lisp_api_ndp_entry_t *entries = 0, *e;
1574  u32 i = 0;
1575  int rv = 0;
1576 
1577  u32 bd = clib_net_to_host_u32 (mp->bd);
1578 
1579  entries = vnet_lisp_ndp_entries_get_by_bd (bd);
1580  u32 size = vec_len (entries) * sizeof (vl_api_one_ndp_entry_t);
1581 
1582  /* *INDENT-OFF* */
1583  REPLY_MACRO4 (VL_API_ONE_NDP_ENTRIES_GET_REPLY, size,
1584  {
1585  rmp->count = clib_host_to_net_u32 (vec_len (entries));
1586  vec_foreach (e, entries)
1587  {
1588  mac_address_encode ((mac_address_t *) e->mac, rmp->entries[i].mac);
1589  ip6_address_encode ((ip6_address_t *) &e->ip6, rmp->entries[i].ip6);
1590  i++;
1591  }
1592  });
1593  /* *INDENT-ON* */
1594 
1595  vec_free (entries);
1596 }
1597 
1598 static void
1601 {
1602  vl_api_one_enable_disable_xtr_mode_reply_t *rmp = 0;
1604 
1605  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_XTR_MODE_REPLY);
1606 }
1607 
1608 static void
1610 {
1612  int rv = 0;
1613 
1614  /* *INDENT-OFF* */
1615  REPLY_MACRO2 (VL_API_ONE_SHOW_XTR_MODE_REPLY,
1616  {
1618  });
1619  /* *INDENT-ON* */
1620 }
1621 
1622 static void
1625 {
1626  vl_api_one_enable_disable_pitr_mode_reply_t *rmp = 0;
1628 
1629  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PITR_MODE_REPLY);
1630 }
1631 
1632 static void
1634 {
1636  int rv = 0;
1637 
1638  /* *INDENT-OFF* */
1639  REPLY_MACRO2 (VL_API_ONE_SHOW_PITR_MODE_REPLY,
1640  {
1642  });
1643  /* *INDENT-ON* */
1644 }
1645 
1646 static void
1649 {
1650  vl_api_one_enable_disable_petr_mode_reply_t *rmp = 0;
1652 
1653  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PETR_MODE_REPLY);
1654 }
1655 
1656 static void
1658 {
1660  int rv = 0;
1661 
1662  /* *INDENT-OFF* */
1663  REPLY_MACRO2 (VL_API_ONE_SHOW_PETR_MODE_REPLY,
1664  {
1666  });
1667  /* *INDENT-ON* */
1668 }
1669 
1670 /*
1671  * one_api_hookup
1672  * Add vpe's API message handlers to the table.
1673  * vlib has already mapped shared memory and
1674  * added the client registration handlers.
1675  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1676  */
1677 #include <lisp/lisp-cp/one.api.c>
1678 
1679 static clib_error_t *
1681 {
1682  one_base_msg_id = setup_message_id_table ();
1683 
1684  return 0;
1685 }
1686 
1688 
1689 #include <vlib/unix/plugin.h>
1690 #include <vpp/app/version.h>
1691 
1692 /* *INDENT-OFF* */
1693 VLIB_PLUGIN_REGISTER () = {
1694  .version = VPP_BUILD_VER,
1695  .description = "Locator ID Separation Protocol (LISP)",
1696 };
1697 /* *INDENT-ON* */
1698 
1699 /*
1700  * fd.io coding-style-patch-verification: ON
1701  *
1702  * Local Variables:
1703  * eval: (c-set-style "gnu")
1704  * End:
1705  */
static void vl_api_one_eid_table_dump_t_handler(vl_api_one_eid_table_dump_t *mp)
Definition: one_api.c:895
static int unformat_one_eid_api(gid_address_t *dst, u32 vni, vl_api_eid_t *eid)
Definition: one_api.c:267
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
bool is_enable[default=true]
Definition: one.api:931
vl_api_one_ndp_entry_t entries[count]
Definition: one.api:449
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:387
Add/delete L2 ARP entries.
Definition: one.api:386
u16 vni
Definition: flow_types.api:160
Get ONE map request itr rlocs status.
Definition: one.api:841
u32 pitr_map_index
Definition: control.h:251
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix
Definition: ip_types.c:411
vnet_api_error_t
Definition: api_errno.h:162
gid_address_t leid
Definition: control.h:74
u8 vnet_lisp_get_pitr_mode(void)
Definition: control.c:5010
#define gid_address_type(_a)
Definition: lisp_types.h:203
Status of ONE PITR, enable or disable.
Definition: one.api:894
static u32 one_base_msg_id
Base message ID fot the plugin.
Definition: one_api.c:39
static void vl_api_one_enable_disable_pitr_mode_t_handler(vl_api_one_enable_disable_pitr_mode_t *mp)
Definition: one_api.c:1624
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
Definition: ip_types_api.c:242
vl_api_mac_address_t mac
Definition: l2.api:502
enable or disable ONE feature
Definition: one.api:161
static void vl_api_one_rloc_probe_enable_disable_t_handler(vl_api_one_rloc_probe_enable_disable_t *mp)
Definition: one_api.c:444
a
Definition: bitmap.h:544
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
Definition: ip_types_api.c:259
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:208
lisp_api_l2_arp_entry_t * vnet_lisp_l2_arp_entries_get_by_bd(u32 bd)
Definition: control.c:944
bool is_add[default=true]
Definition: one.api:390
#define ntohs(x)
Definition: af_xdp.bpf.c:29
add or delete map request itr rlocs
Definition: one.api:549
Reply with list of bridge domains used by L2 ARP table.
Definition: one.api:517
lisp_msmr_t * map_resolvers
Definition: control.h:221
static void vl_api_one_stats_enable_disable_t_handler(vl_api_one_stats_enable_disable_t *mp)
Definition: one_api.c:1343
Get TTL for map register messages.
Definition: one.api:108
void mac_address_encode(const mac_address_t *in, u8 *out)
u32 vnet_lisp_set_transport_protocol(u8 protocol)
Definition: control.c:4886
configure or delete ONE NSH mapping
Definition: one.api:174
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:527
static void vl_api_one_add_del_local_eid_t_handler(vl_api_one_add_del_local_eid_t *mp)
Definition: one_api.c:330
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:750
#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:1412
eid_type
Definition: lisp_types.api:37
static void vl_api_one_enable_disable_petr_mode_t_handler(vl_api_one_enable_disable_petr_mode_t *mp)
Definition: one_api.c:1648
uword * table_id_by_vni
Definition: control.h:240
static void send_eid_table_vni(u32 vni, vl_api_registration_t *reg, u32 context)
Definition: one_api.c:1047
add or delete locator_set
Definition: one.api:29
vl_api_one_ndp_entry_t entry
Definition: one.api:434
static void vl_api_one_ndp_entries_get_t_handler(vl_api_one_ndp_entries_get_t *mp)
Definition: one_api.c:1570
static void vl_api_one_add_del_map_server_t_handler(vl_api_one_add_del_map_server_t *mp)
Definition: one_api.c:397
#define REPLY_MACRO2(t, body)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
Request for ONE status.
Definition: one.api:818
enable/disable ONE map-register
Definition: one.api:274
locator_t * locator_pool
Definition: control.h:178
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:104
u8 vnet_lisp_get_map_request_mode(void)
Definition: control.c:55
reply to one_eid_table_vni_dump
Definition: one.api:768
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
Definition: ip_types_api.c:143
ip_address_t loc_rloc
Definition: lisp_gpe.h:105
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Definition: vec.h:1090
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:592
add or delete ONE eid-table
Definition: one.api:81
vl_api_address_t ip_address
Definition: one.api:232
static void vl_api_one_locator_dump_t_handler(vl_api_one_locator_dump_t *mp)
Definition: one_api.c:707
static void vl_api_one_show_pitr_mode_t_handler(vl_api_one_show_pitr_mode_t *mp)
Definition: one_api.c:1633
vl_api_address_t ip_address
Definition: one.api:207
Request for map server summary status.
Definition: one.api:808
vl_api_address_t rloc
Definition: one.api:914
vlib_main_t * vm
Definition: in2out_ed.c:1580
u32 nsh_map_index
Definition: control.h:258
bool is_add[default=true]
Definition: one.api:85
static void vl_api_one_set_transport_protocol_t_handler(vl_api_one_set_transport_protocol_t *mp)
Definition: one_api.c:1543
static void vl_api_show_one_status_t_handler(vl_api_show_one_status_t *mp)
Definition: one_api.c:1195
vl_api_address_t ip_address
Definition: one.api:138
vl_api_remote_locator_t rlocs[rloc_num]
Definition: one.api:370
ip_address_t address
Definition: control.h:89
vnet_api_error_t vnet_lisp_stats_enable_disable(u8 enable)
Definition: control.c:4847
bool is_enable[default=true]
Definition: one.api:165
vl_api_prefix_t prefix
Definition: ip.api:144
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:1228
Reply for ONE NSH mapping.
Definition: one.api:871
static void vl_api_show_one_map_request_mode_t_handler(vl_api_show_one_map_request_mode_t *mp)
Definition: one_api.c:465
static clib_error_t * one_api_hookup(vlib_main_t *vm)
Definition: one_api.c:1680
vl_api_local_locator_t locators[locator_num]
Definition: one.api:36
void * vl_msg_api_alloc(int nbytes)
vhost_vring_addr_t addr
Definition: vhost_user.h:111
u8 vnet_lisp_stats_enable_disable_state(void)
Definition: control.c:4863
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:374
vl_api_address_t ip_address
Definition: one.api:801
u8 vnet_lisp_get_petr_mode(void)
Definition: control.c:5017
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1508
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:1437
configure or disable use of PETR
Definition: one.api:203
VLIB_PLUGIN_REGISTER()
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:1555
Request for L2 ARP entries from specified bridge domain.
Definition: one.api:400
Request for map request itr rlocs summary status.
Definition: one.api:849
ONE locator_set status.
Definition: one.api:598
lisp_msmr_t * map_servers
Definition: control.h:224
lisp_transport_protocol_t vnet_lisp_get_transport_protocol(void)
Definition: control.c:4899
int vnet_lisp_enable_disable_petr_mode(u8 is_enabled)
Definition: control.c:4972
vl_api_hmac_key_t key
Definition: one.api:89
static void vl_api_one_adjacencies_get_t_handler(vl_api_one_adjacencies_get_t *mp)
Definition: one_api.c:1140
static void send_one_eid_table_details(mapping_t *mapit, vl_api_registration_t *reg, u32 context, u8 filter)
Definition: one_api.c:808
int vnet_lisp_enable_disable_pitr_mode(u8 is_enabled)
Definition: control.c:4943
vl_api_address_t ip_address
Definition: one.api:603
static void send_one_map_resolver_details(ip_address_t *ip, vl_api_registration_t *reg, u32 context)
Definition: one_api.c:969
static void vl_api_one_l2_arp_bd_get_t_handler(vl_api_one_l2_arp_bd_get_t *mp)
Definition: one_api.c:1459
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:1211
Request for ONE map-request mode.
Definition: one.api:327
vl_api_ip6_address_t ip6
Definition: one.api:424
u8 * key
Definition: lisp_types.h:315
Request for ONE adjacencies.
Definition: one.api:724
ip_address_t rmt_rloc
Definition: lisp_gpe.h:106
Request for one_eid_table_map_details.
Definition: one.api:747
int vnet_lisp_flush_stats(void)
description fragment has unexpected format
Definition: map.api:433
vl_api_interface_index_t sw_if_index
Definition: one.api:602
bool is_add[default=true]
Definition: one.api:137
#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:413
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregate type for a prefix.
Definition: fib_types.h:202
void ip_prefix_normalize(ip_prefix_t *a)
Definition: ip_types.c:358
vl_api_hmac_key_t key
Definition: one.api:672
typedef eid
Definition: lisp_types.api:59
#define ALWAYS_ASSERT(truth)
static void vl_api_one_map_register_set_ttl_t_handler(vl_api_one_map_register_set_ttl_t *mp)
Definition: one_api.c:144
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:1034
Dumps all VNIs used in mappings.
Definition: one.api:758
lisp_api_ndp_entry_t * vnet_lisp_ndp_entries_get_by_bd(u32 bd)
Definition: control.c:980
static void vl_api_one_enable_disable_t_handler(vl_api_one_enable_disable_t *mp)
Definition: one_api.c:454
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:654
static void vl_api_one_map_register_fallback_threshold_t_handler(vl_api_one_map_register_fallback_threshold_t *mp)
Definition: one_api.c:1514
bool is_enable[default=true]
Definition: one.api:991
uword * bd_id_by_vni
Definition: control.h:244
static void vl_api_one_map_resolver_dump_t_handler(vl_api_one_map_resolver_dump_t *mp)
Definition: one_api.c:985
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:305
bool is_add[default=true]
Definition: one.api:208
u16 fp_len
The mask length.
Definition: fib_types.h:206
add or delete ONE adjacency adjacency
Definition: one.api:533
u32 bd
Definition: one.api:391
bool is_enable[default=true]
Definition: one.api:1011
u32 petr_map_index
Proxy ETR map index used for &#39;use-petr&#39;.
Definition: control.h:255
vl_api_eid_t seid
Definition: one.api:913
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:576
static void send_eid_table_map_pair(hash_pair_t *p, vl_api_registration_t *reg, u32 context)
Definition: one_api.c:1002
Reply with list of bridge domains used by neighbor discovery.
Definition: one.api:494
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:2204
static void vl_api_one_map_register_enable_disable_t_handler(vl_api_one_map_register_enable_disable_t *mp)
Definition: one_api.c:433
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1580
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:546
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:381
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:680
counter_t packets
packet counter
Definition: counter_types.h:28
#define gid_address_arp_ndp_ip(_a)
Definition: lisp_types.h:226
bool is_add[default=true]
Definition: one.api:192
static void vl_api_one_eid_table_vni_dump_t_handler(vl_api_one_eid_table_vni_dump_t *mp)
Definition: one_api.c:1163
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:225
vl_api_address_t lloc
Definition: one.api:915
vl_api_ip_proto_t proto
Definition: acl_types.api:51
#define gid_address_mac(_a)
Definition: lisp_types.h:209
bool is_add[default=true]
Definition: one.api:64
Set TTL for map register messages.
Definition: one.api:97
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:835
Request for ONE PITR status.
Definition: one.api:883
u32 size
Definition: vhost_user.h:106
#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:599
u8 authoritative
Definition: lisp_types.h:305
Request for ONE PETR status.
Definition: one.api:215
lisp_api_stats_t * vnet_lisp_get_stats(void)
Definition: control.c:4548
#define REPLY_MACRO(t)
vl_api_ip4_address_t ip4
Definition: one.api:376
set ONE map-request mode.
Definition: one.api:316
u8 vnet_lisp_get_xtr_mode(void)
Definition: control.c:5003
Reply for show_one_rloc_probe_state.
Definition: one.api:250
vl_api_address_t dst
Definition: gre.api:55
add or delete map-resolver
Definition: one.api:148
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:1526
dp_address_t deid
Definition: lisp_gpe.h:103
lisp_adjacency_t * vnet_lisp_adjacencies_get_by_vni(u32 vni)
Returns vector of adjacencies.
Definition: control.c:577
static void vl_api_one_ndp_bd_get_t_handler(vl_api_one_ndp_bd_get_t *mp)
Definition: one_api.c:1434
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
Definition: ip_types_api.c:192
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
static void setup_message_id_table(api_main_t *am)
Definition: bfd_api.c:409
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:266
ONE map server details.
Definition: one.api:798
Request for map one locator status.
Definition: one.api:582
u32 * vnet_lisp_ndp_bds_get(void)
Definition: control.c:906
vl_api_address_t ip_address
Definition: one.api:781
vl_api_interface_index_t sw_if_index
Definition: one.api:66
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
Definition: control.c:2339
Shows relationship between vni and vrf/bd.
Definition: one.api:735
string locator_set_name[64]
Definition: one.api:87
vlib_counter_t counters
Definition: lisp_gpe.h:108
Dump ONE eid-table.
Definition: one.api:660
static void vl_api_one_use_petr_t_handler(vl_api_one_use_petr_t *mp)
Definition: one_api.c:524
#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
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
Get state of ONE map-register.
Definition: one.api:285
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
Request for ONE NSH mapping.
Definition: one.api:860
static void send_one_map_server_details(ip_address_t *ip, vl_api_registration_t *reg, u32 context)
Definition: one_api.c:934
#define gid_address_ippref_len(_a)
Definition: lisp_types.h:205
vl_api_one_map_mode_t mode
Definition: one.api:342
Request for list of bridge domains used by L2 ARP table.
Definition: one.api:506
ONE adjacency reply.
Definition: one.api:711
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:418
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:2138
u32 vnet_lisp_map_register_fallback_threshold_get(void)
Definition: control.c:1632
string ls_name[64]
Definition: one.api:587
Reply for show_one_map_request_mode.
Definition: one.api:338
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:298
#define ARRAY_LEN(x)
Definition: clib.h:67
string locator_set_name[64]
Definition: one.api:899
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:79
#define gid_address_nsh_si(_a)
Definition: lisp_types.h:212
string name[64]
Definition: ip.api:44
static void vl_api_one_enable_disable_xtr_mode_t_handler(vl_api_one_enable_disable_xtr_mode_t *mp)
Definition: one_api.c:1600
static void vl_api_show_one_rloc_probe_state_t_handler(vl_api_show_one_rloc_probe_state_t *mp)
Definition: one_api.c:1111
static void vl_api_show_one_stats_enable_disable_t_handler(vl_api_show_one_stats_enable_disable_t *mp)
Definition: one_api.c:1328
#define fid_addr_ippref(_a)
Definition: lisp_types.h:82
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:2269
Reply with L2 ARP entries from specified bridge domain.
Definition: one.api:413
int vnet_lisp_enable_disable_xtr_mode(u8 is_enabled)
Definition: control.c:4906
Definition: control.h:107
bool is_enable[default=true]
Definition: one.api:971
struct _gid_address_t gid_address_t
vl_api_one_filter_t filter
Definition: one.api:640
static void vl_api_show_one_map_register_ttl_t_handler(vl_api_show_one_map_register_ttl_t *mp)
Definition: one_api.c:158
bool is_add[default=true]
Definition: one.api:432
u8 value
Definition: qos.api:54
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:631
static uword hash_elts(void *v)
Definition: hash.h:118
#define ASSERT(truth)
#define fid_addr_type(_a)
Definition: lisp_types.h:87
static void vl_api_show_one_map_register_state_t_handler(vl_api_show_one_map_register_state_t *mp)
Definition: one_api.c:1126
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1386
map/unmap vni/bd_index to vrf
Definition: one.api:565
#define gid_address_sd_dst(_a)
Definition: lisp_types.h:221
gid_dictionary_t mapping_index_by_gid
Definition: control.h:169
#define REPLY_DETAILS(t, body)
Definition: one_api.c:44
locator_set_t * locator_set_pool
Definition: control.h:181
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
Definition: ip_types_api.c:137
static void vl_api_one_nsh_set_locator_set_t_handler(vl_api_one_nsh_set_locator_set_t *mp)
Definition: one_api.c:490
#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:1609
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:1390
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:2129
static void vl_api_one_locator_set_dump_t_handler(vl_api_one_locator_set_dump_t *mp)
Definition: one_api.c:781
Get state of ONE RLOC probing.
Definition: one.api:239
Add/delete map server.
Definition: one.api:133
ONE PETR status, enable or disable.
Definition: one.api:227
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:1362
Definition: control.h:101
u32 entries
vl_api_eid_t deid
Definition: one.api:912
int vnet_lisp_map_register_fallback_threshold_set(u32 value)
Definition: control.c:1619
typedef key
Definition: ipsec_types.api:86
vl_api_one_l2_arp_entry_t entry
Definition: one.api:392
bool is_add[default=true]
Definition: one.api:362
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
Definition: ip_types_api.c:287
add or delete remote static mapping
Definition: one.api:358
static void vl_api_one_eid_table_map_dump_t_handler(vl_api_one_eid_table_map_dump_t *mp)
Definition: one_api.c:1018
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:1994
#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:1242
add or delete locator for locator set
Definition: one.api:60
vl_api_address_t ip_address
Definition: one.api:153
vl_api_one_filter_t filter
Definition: one.api:694
vl_api_address_t ip
Definition: l2.api:501
static void vl_api_one_add_del_locator_set_t_handler(vl_api_one_add_del_locator_set_t *mp)
Definition: one_api.c:173
Reply for locator_set add/del.
Definition: one.api:44
Request for map resolver summary status.
Definition: one.api:788
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
bool is_enable[default=true]
Definition: one.api:266
#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:225
void ip4_address_decode(const vl_api_ip4_address_t in, ip4_address_t *out)
Definition: ip_types_api.c:155
enable/disable ONE RLOC probing
Definition: one.api:262
#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:1337
u32 * vnet_lisp_l2_arp_bds_get(void)
Definition: control.c:882
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:1890
mapping_t * mapping_pool
Definition: control.h:172
u8 ip_address_max_len(u8 version)
Definition: lisp_types.c:432
uword * locator_set_index_by_name
Definition: control.h:187
static void fid_to_api_eid(fid_address_t *fid, vl_api_eid_t *eid)
Definition: one_api.c:304
int vnet_lisp_nsh_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1529
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
Definition: lisp_types.c:1203
static void vl_api_one_map_request_mode_t_handler(vl_api_one_map_request_mode_t *mp)
Definition: one_api.c:479
gid_address_t eid
Definition: lisp_types.h:293
gid_address_t reid
Definition: control.h:75
static void vl_api_one_pitr_set_locator_set_t_handler(vl_api_one_pitr_set_locator_set_t *mp)
Definition: one_api.c:507
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:1484
#define hash_get_mem(h, key)
Definition: hash.h:269
static void vl_api_one_show_petr_mode_t_handler(vl_api_one_show_petr_mode_t *mp)
Definition: one_api.c:1657
ONE locator_set status.
Definition: one.api:613
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:2276
static void vl_api_show_one_pitr_t_handler(vl_api_show_one_pitr_t *mp)
Definition: one_api.c:1284
int vnet_lisp_add_del_l2_arp_ndp_entry(gid_address_t *key, u8 *mac, u8 is_add)
Definition: control.c:995
bool is_add[default=true]
Definition: one.api:569
void ip4_address_encode(const ip4_address_t *in, vl_api_ip4_address_t out)
Definition: ip_types_api.c:149
bool is_add[default=true]
Definition: one.api:33
#define vec_foreach(var, vec)
Vector iterator.
Set ONE transport protocol.
Definition: one.api:459
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:687
string locator_set_name[64]
Definition: one.api:65
Request for locator_set summary status.
Definition: one.api:636
Contains current TTL for map register messages.
Definition: one.api:119
Request for list of bridge domains used by neighbor discovery.
Definition: one.api:483
static void vl_api_one_stats_flush_t_handler(vl_api_one_stats_flush_t *mp)
Definition: one_api.c:1352
bool is_add[default=true]
Definition: one.api:178
int vnet_lisp_map_register_set_ttl(u32 ttl)
Definition: control.c:2324
u32 vnet_lisp_map_register_get_ttl(void)
Definition: control.c:2332
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1647
ONE map resolver status.
Definition: one.api:778
u32 mreq_itr_rlocs
Definition: control.h:237
void mac_address_decode(const u8 *in, mac_address_t *out)
Conversion functions to/from (decode/encode) API types to VPP internal types.
bool is_add[default=true]
Definition: one.api:152
static locator_t * unformat_one_locs(vl_api_remote_locator_t *rmt_locs, u32 rloc_num)
Definition: one_api.c:120
u32 * locator_indices
Definition: lisp_types.h:287
Reply for show_one_map_register_state.
Definition: one.api:295
uword key
Definition: hash.h:162
LISP-GPE definitions.
configure or disable ONE PITR node
Definition: one.api:188
Definition: one.api:428
#define VALIDATE_SW_IF_INDEX(mp)
u32 bd
Definition: one.api:433
vl_api_one_map_mode_t mode
Definition: one.api:320
vl_api_one_adjacency_t adjacencies[count]
Definition: one.api:716
static void one_adjacency_copy(vl_api_one_adjacency_t *dst, lisp_adjacency_t *adjs)
Definition: one_api.c:1060
static void vl_api_one_map_server_dump_t_handler(vl_api_one_map_server_dump_t *mp)
Definition: one_api.c:952