FD.io VPP  v17.04.2-2-ga8f93f8
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_typedefs /* define message structures */
46 #include <vnet/vnet_all_api_h.h>
47 #undef vl_typedefs
48 
49 #define vl_endianfun /* define message structures */
50 #include <vnet/vnet_all_api_h.h>
51 #undef vl_endianfun
52 
53 /* instantiate all the print functions we know about */
54 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
55 #define vl_printfun
56 #include <vnet/vnet_all_api_h.h>
57 #undef vl_printfun
58 
60 
61 #define REPLY_DETAILS(t, body) \
62 do { \
63  unix_shared_memory_queue_t * q; \
64  rv = vl_msg_api_pd_handler (mp, rv); \
65  q = vl_api_client_index_to_input_queue (mp->client_index); \
66  if (!q) \
67  return; \
68  \
69  rmp = vl_msg_api_alloc (sizeof (*rmp)); \
70  rmp->_vl_msg_id = ntohs((t)); \
71  rmp->context = mp->context; \
72  do {body;} while (0); \
73  vl_msg_api_send_shmem (q, (u8 *)&rmp); \
74 } while(0);
75 
76 #define foreach_vpe_api_msg \
77 _(ONE_ADD_DEL_LOCATOR_SET, one_add_del_locator_set) \
78 _(ONE_ADD_DEL_LOCATOR, one_add_del_locator) \
79 _(ONE_ADD_DEL_LOCAL_EID, one_add_del_local_eid) \
80 _(ONE_ADD_DEL_MAP_RESOLVER, one_add_del_map_resolver) \
81 _(ONE_ADD_DEL_MAP_SERVER, one_add_del_map_server) \
82 _(ONE_ENABLE_DISABLE, one_enable_disable) \
83 _(ONE_RLOC_PROBE_ENABLE_DISABLE, one_rloc_probe_enable_disable) \
84 _(ONE_MAP_REGISTER_ENABLE_DISABLE, one_map_register_enable_disable) \
85 _(ONE_ADD_DEL_REMOTE_MAPPING, one_add_del_remote_mapping) \
86 _(ONE_ADD_DEL_ADJACENCY, one_add_del_adjacency) \
87 _(ONE_PITR_SET_LOCATOR_SET, one_pitr_set_locator_set) \
88 _(ONE_MAP_REQUEST_MODE, one_map_request_mode) \
89 _(ONE_EID_TABLE_ADD_DEL_MAP, one_eid_table_add_del_map) \
90 _(ONE_LOCATOR_SET_DUMP, one_locator_set_dump) \
91 _(ONE_LOCATOR_DUMP, one_locator_dump) \
92 _(ONE_EID_TABLE_DUMP, one_eid_table_dump) \
93 _(ONE_MAP_RESOLVER_DUMP, one_map_resolver_dump) \
94 _(ONE_MAP_SERVER_DUMP, one_map_server_dump) \
95 _(ONE_EID_TABLE_MAP_DUMP, one_eid_table_map_dump) \
96 _(ONE_EID_TABLE_VNI_DUMP, one_eid_table_vni_dump) \
97 _(ONE_ADJACENCIES_GET, one_adjacencies_get) \
98 _(SHOW_ONE_RLOC_PROBE_STATE, show_one_rloc_probe_state) \
99 _(SHOW_ONE_MAP_REGISTER_STATE, show_one_map_register_state) \
100 _(SHOW_ONE_STATUS, show_one_status) \
101 _(ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
102  one_add_del_map_request_itr_rlocs) \
103 _(ONE_GET_MAP_REQUEST_ITR_RLOCS, one_get_map_request_itr_rlocs) \
104 _(SHOW_ONE_PITR, show_one_pitr) \
105 _(SHOW_ONE_MAP_REQUEST_MODE, show_one_map_request_mode) \
106 _(ONE_USE_PETR, one_use_petr) \
107 _(SHOW_ONE_USE_PETR, show_one_use_petr) \
108 _(SHOW_ONE_STATS_ENABLE_DISABLE, show_one_stats_enable_disable) \
109 _(ONE_STATS_ENABLE_DISABLE, one_stats_enable_disable) \
110 _(ONE_STATS_DUMP, one_stats_dump) \
111 
112 
113 static locator_t *
115 {
116  u32 i;
117  locator_t *locs = 0, loc;
119 
120  for (i = 0; i < rloc_num; i++)
121  {
122  /* remote locators */
123  r = &rmt_locs[i];
124  memset (&loc, 0, sizeof (loc));
125  gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
126 
127  loc.priority = r->priority;
128  loc.weight = r->weight;
129 
130  vec_add1 (locs, loc);
131  }
132  return locs;
133 }
134 
135 static void
137  mp)
138 {
140  int rv = 0;
142  locator_t locator;
144  u32 ls_index = ~0, locator_num;
145  u8 *locator_name = NULL;
146  int i;
147 
148  memset (a, 0, sizeof (a[0]));
149 
150  locator_name = format (0, "%s", mp->locator_set_name);
151 
152  a->name = locator_name;
153  a->is_add = mp->is_add;
154  a->local = 1;
155  locator_num = clib_net_to_host_u32 (mp->locator_num);
156 
157  memset (&locator, 0, sizeof (locator));
158  for (i = 0; i < locator_num; i++)
159  {
160  ls_loc = &mp->locators[i];
161  VALIDATE_SW_IF_INDEX (ls_loc);
162 
163  locator.sw_if_index = htonl (ls_loc->sw_if_index);
164  locator.priority = ls_loc->priority;
165  locator.weight = ls_loc->weight;
166  locator.local = 1;
167  vec_add1 (a->locators, locator);
168  }
169 
170  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
171 
173 
174  vec_free (locator_name);
175  vec_free (a->locators);
176 
177  /* *INDENT-OFF* */
178  REPLY_MACRO2 (VL_API_ONE_ADD_DEL_LOCATOR_SET_REPLY,
179  ({
180  rmp->ls_index = clib_host_to_net_u32 (ls_index);
181  }));
182  /* *INDENT-ON* */
183 }
184 
185 static void
187 {
189  int rv = 0;
190  locator_t locator, *locators = NULL;
192  u32 ls_index = ~0;
193  u8 *locator_name = NULL;
194 
195  memset (&locator, 0, sizeof (locator));
196  memset (a, 0, sizeof (a[0]));
197 
198  locator.sw_if_index = ntohl (mp->sw_if_index);
199  locator.priority = mp->priority;
200  locator.weight = mp->weight;
201  locator.local = 1;
202  vec_add1 (locators, locator);
203 
204  locator_name = format (0, "%s", mp->locator_set_name);
205 
206  a->name = locator_name;
207  a->locators = locators;
208  a->is_add = mp->is_add;
209  a->local = 1;
210 
211  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
212 
213  vec_free (locators);
214  vec_free (locator_name);
215 
216  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCATOR_REPLY);
217 }
218 
219 static int
220 unformat_one_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
221  u8 len)
222 {
223  switch (type)
224  {
225  case 0: /* ipv4 */
227  gid_address_ip_set (dst, src, IP4);
228  gid_address_ippref_len (dst) = len;
230  break;
231  case 1: /* ipv6 */
233  gid_address_ip_set (dst, src, IP6);
234  gid_address_ippref_len (dst) = len;
236  break;
237  case 2: /* l2 mac */
239  clib_memcpy (&gid_address_mac (dst), src, 6);
240  break;
241  default:
242  /* unknown type */
243  return VNET_API_ERROR_INVALID_VALUE;
244  }
245 
246  gid_address_vni (dst) = vni;
247 
248  return 0;
249 }
250 
251 static void
253 {
256  int rv = 0;
257  gid_address_t _eid, *eid = &_eid;
258  uword *p = NULL;
259  u32 locator_set_index = ~0, map_index = ~0;
261  u8 *name = NULL, *key = NULL;
262  memset (a, 0, sizeof (a[0]));
263  memset (eid, 0, sizeof (eid[0]));
264 
265  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
266  mp->eid_type, mp->eid, mp->prefix_len);
267  if (rv)
268  goto out;
269 
270  name = format (0, "%s", mp->locator_set_name);
271  p = hash_get_mem (lcm->locator_set_index_by_name, name);
272  if (!p)
273  {
274  rv = VNET_API_ERROR_INVALID_VALUE;
275  goto out;
276  }
277  locator_set_index = p[0];
278 
279  if (*mp->key)
280  key = format (0, "%s", mp->key);
281 
282  /* XXX treat batch configuration */
283  a->is_add = mp->is_add;
284  gid_address_copy (&a->eid, eid);
285  a->locator_set_index = locator_set_index;
286  a->local = 1;
287  a->key = key;
288  a->key_id = clib_net_to_host_u16 (mp->key_id);
289 
290  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
291 
292 out:
293  vec_free (name);
294  vec_free (key);
295  gid_address_free (&a->eid);
296 
297  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCAL_EID_REPLY);
298 }
299 
300 static void
303 {
305  int rv = 0;
306  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
307  clib_net_to_host_u32 (mp->dp_table),
308  mp->is_l2, mp->is_add);
309 REPLY_MACRO (VL_API_ONE_EID_TABLE_ADD_DEL_MAP_REPLY)}
310 
311 static void
313 {
315  int rv = 0;
316  ip_address_t addr;
317 
318  memset (&addr, 0, sizeof (addr));
319 
320  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
321  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
322 
323  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
324 }
325 
326 static void
328  * mp)
329 {
331  int rv = 0;
333 
334  memset (a, 0, sizeof (a[0]));
335 
336  a->is_add = mp->is_add;
337  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
338 
340 
341  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_RESOLVER_REPLY);
342 }
343 
344 static void
347 {
349  int rv = 0;
350 
352  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
353 }
354 
355 static void
358 {
360  int rv = 0;
361 
363  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
364 }
365 
366 static void
368 {
370  int rv = 0;
371 
373  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
374 }
375 
376 static void
379 {
380  int rv = 0;
382 
383  /* *INDENT-OFF* */
384  REPLY_MACRO2(VL_API_SHOW_ONE_MAP_REQUEST_MODE_REPLY,
385  ({
387  }));
388  /* *INDENT-ON* */
389 }
390 
391 static void
393 {
395  int rv = 0;
396 
398 
399  REPLY_MACRO (VL_API_ONE_MAP_REQUEST_MODE_REPLY);
400 }
401 
402 static void
404  * mp)
405 {
407  int rv = 0;
408  u8 *ls_name = 0;
409 
410  ls_name = format (0, "%s", mp->ls_name);
411  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
412  vec_free (ls_name);
413 
414  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
415 }
416 
417 static void
419 {
421  int rv = 0;
422  ip_address_t addr;
423 
424  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
425  rv = vnet_lisp_use_petr (&addr, mp->is_add);
426 
427  REPLY_MACRO (VL_API_ONE_USE_PETR_REPLY);
428 }
429 
430 static void
432 {
436  mapping_t *m;
437  locator_set_t *ls = 0;
438  int rv = 0;
439  locator_t *loc = 0;
440  u8 status = 0;
442 
444  if (q == 0)
445  {
446  return;
447  }
448 
449  memset (&addr, 0, sizeof (addr));
450  status = lcm->flags & LISP_FLAG_USE_PETR;
451  if (status)
452  {
454  if (~0 != m->locator_set_index)
455  {
456  ls =
458  loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
459  gid_address_copy (&addr, &loc->address);
460  }
461  }
462 
463  /* *INDENT-OFF* */
464  REPLY_MACRO2 (VL_API_SHOW_ONE_USE_PETR_REPLY,
465  {
466  rmp->status = status;
467  ip_address_t *ip = &gid_address_ip (&addr);
468  switch (ip_addr_version (ip))
469  {
470  case IP4:
471  clib_memcpy (rmp->address, &ip_addr_v4 (ip),
472  sizeof (ip_addr_v4 (ip)));
473  break;
474 
475  case IP6:
476  clib_memcpy (rmp->address, &ip_addr_v6 (ip),
477  sizeof (ip_addr_v6 (ip)));
478  break;
479 
480  default:
481  ASSERT (0);
482  }
483  rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
484  });
485  /* *INDENT-ON* */
486 }
487 
488 static void
491 {
493  int rv = 0;
494  u8 *locator_set_name = NULL;
496 
497  locator_set_name = format (0, "%s", mp->locator_set_name);
498 
499  a->is_add = mp->is_add;
500  a->locator_set_name = locator_set_name;
501 
503 
504  vec_free (locator_set_name);
505 
506  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
507 }
508 
509 static void
512 {
513  locator_t *rlocs = 0;
515  int rv = 0;
516  gid_address_t _eid, *eid = &_eid;
517  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
518 
519  memset (eid, 0, sizeof (eid[0]));
520 
521  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
522  mp->eid_type, mp->eid, mp->eid_len);
523  if (rv)
524  goto send_reply;
525 
526  rlocs = unformat_one_locs (mp->rlocs, rloc_num);
527 
528  if (!mp->is_add)
529  {
531  gid_address_copy (&a->reid, eid);
532  a->is_add = 0;
534  if (rv)
535  {
536  goto out;
537  }
538  }
539 
540  /* NOTE: for now this works as a static remote mapping, i.e.,
541  * not authoritative and ttl infinite. */
542  rv = vnet_lisp_add_del_mapping (eid, rlocs, mp->action, 0, ~0,
543  mp->is_add, 1 /* is_static */ , 0);
544 
545  if (mp->del_all)
547 
548 out:
549  vec_free (rlocs);
550 send_reply:
551  REPLY_MACRO (VL_API_ONE_ADD_DEL_REMOTE_MAPPING_REPLY);
552 }
553 
554 static void
556 {
559 
560  int rv = 0;
561  memset (a, 0, sizeof (a[0]));
562 
563  rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
564  mp->eid_type, mp->leid, mp->leid_len);
565  rv |= unformat_one_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
566  mp->eid_type, mp->reid, mp->reid_len);
567 
568  if (rv)
569  goto send_reply;
570 
571  a->is_add = mp->is_add;
573 
574 send_reply:
575  REPLY_MACRO (VL_API_ONE_ADD_DEL_ADJACENCY_REPLY);
576 }
577 
578 static void
580  locator_t * loc,
581  unix_shared_memory_queue_t * q, u32 context)
582 {
584 
585  rmp = vl_msg_api_alloc (sizeof (*rmp));
586  memset (rmp, 0, sizeof (*rmp));
587  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
588  rmp->context = context;
589 
590  rmp->local = loc->local;
591  if (loc->local)
592  {
593  rmp->sw_if_index = ntohl (loc->sw_if_index);
594  }
595  else
596  {
597  rmp->is_ipv6 = gid_address_ip_version (&loc->address);
599  }
600  rmp->priority = loc->priority;
601  rmp->weight = loc->weight;
602 
603  vl_msg_api_send_shmem (q, (u8 *) & rmp);
604 }
605 
606 static void
608 {
609  u8 *ls_name = 0;
612  locator_set_t *lsit = 0;
613  locator_t *loc = 0;
614  u32 ls_index = ~0, *locit = 0;
615  uword *p = 0;
616 
618  if (q == 0)
619  {
620  return;
621  }
622 
623  if (mp->is_index_set)
624  ls_index = htonl (mp->ls_index);
625  else
626  {
627  /* make sure we get a proper C-string */
628  mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
629  ls_name = format (0, "%s", mp->ls_name);
630  p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
631  if (!p)
632  goto out;
633  ls_index = p[0];
634  }
635 
636  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
637  return;
638 
639  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
640 
641  vec_foreach (locit, lsit->locator_indices)
642  {
643  loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
644  send_one_locator_details (lcm, loc, q, mp->context);
645  };
646 out:
647  vec_free (ls_name);
648 }
649 
650 static void
652  locator_set_t * lsit,
654  u32 context, u32 ls_index)
655 {
657  u8 *str = 0;
658 
659  rmp = vl_msg_api_alloc (sizeof (*rmp));
660  memset (rmp, 0, sizeof (*rmp));
661  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
662  rmp->context = context;
663 
664  rmp->ls_index = htonl (ls_index);
665  if (lsit->local)
666  {
667  ASSERT (lsit->name != NULL);
668  strncpy ((char *) rmp->ls_name, (char *) lsit->name,
669  vec_len (lsit->name));
670  }
671  else
672  {
673  str = format (0, "<remote-%d>", ls_index);
674  strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
675  vec_free (str);
676  }
677 
678  vl_msg_api_send_shmem (q, (u8 *) & rmp);
679 }
680 
681 static void
683 {
686  locator_set_t *lsit = NULL;
687  u8 filter;
688 
690  if (q == 0)
691  {
692  return;
693  }
694 
695  filter = mp->filter;
696  /* *INDENT-OFF* */
697  pool_foreach (lsit, lcm->locator_set_pool,
698  ({
699  if (filter && !((1 == filter && lsit->local) ||
700  (2 == filter && !lsit->local)))
701  {
702  continue;
703  }
704  send_one_locator_set_details (lcm, lsit, q, mp->context,
705  lsit - lcm->locator_set_pool);
706  }));
707  /* *INDENT-ON* */
708 }
709 
710 static void
711 one_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
712 {
713  ASSERT (prefix_length);
714  ip_prefix_t *ippref = &fid_addr_ippref (src);
715 
716  switch (fid_addr_type (src))
717  {
718  case FID_ADDR_IP_PREF:
719  if (ip_prefix_version (ippref) == IP4)
720  clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
721  else
722  clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
723  prefix_length[0] = ip_prefix_len (ippref);
724  break;
725 
726  case FID_ADDR_MAC:
727  prefix_length[0] = 0;
728  clib_memcpy (dst, fid_addr_mac (src), 6);
729  break;
730 
731  default:
732  clib_warning ("Unknown FID type %d!", fid_addr_type (src));
733  break;
734  }
735 }
736 
737 static u8
739 {
740  ip_prefix_t *ippref;
741 
742  switch (fid_addr_type (fid))
743  {
744  case FID_ADDR_IP_PREF:
745  ippref = &fid_addr_ippref (fid);
746  if (ip_prefix_version (ippref) == IP4)
747  return 0;
748  else if (ip_prefix_version (ippref) == IP6)
749  return 1;
750  else
751  return ~0;
752 
753  case FID_ADDR_MAC:
754  return 2;
755  case FID_ADDR_NSH:
756  return 3;
757  }
758 
759  return ~0;
760 }
761 
762 static void
765  u32 context, u8 filter)
766 {
767  fid_address_t *fid;
769  locator_set_t *ls = 0;
771  gid_address_t *gid = NULL;
772  u8 *mac = 0;
773  ip_prefix_t *ip_prefix = NULL;
774 
775  switch (filter)
776  {
777  case 0: /* all mappings */
778  break;
779 
780  case 1: /* local only */
781  if (!mapit->local)
782  return;
783  break;
784  case 2: /* remote only */
785  if (mapit->local)
786  return;
787  break;
788  default:
789  clib_warning ("Filter error, unknown filter: %d", filter);
790  return;
791  }
792 
793  gid = &mapit->eid;
794  ip_prefix = &gid_address_ippref (gid);
795  mac = gid_address_mac (gid);
796 
797  rmp = vl_msg_api_alloc (sizeof (*rmp));
798  memset (rmp, 0, sizeof (*rmp));
799  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
800 
802  if (vec_len (ls->locator_indices) == 0)
803  rmp->locator_set_index = ~0;
804  else
805  rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
806 
807  rmp->is_local = mapit->local;
808  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
809  rmp->action = mapit->action;
810  rmp->authoritative = mapit->authoritative;
811 
812  switch (gid_address_type (gid))
813  {
814  case GID_ADDR_SRC_DST:
815  rmp->is_src_dst = 1;
816  fid = &gid_address_sd_src (gid);
817  rmp->eid_type = fid_type_to_api_type (fid);
819  &rmp->seid_prefix_len);
820  one_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
821  &rmp->eid_prefix_len);
822  break;
823  case GID_ADDR_IP_PREFIX:
824  rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
825  if (ip_prefix_version (ip_prefix) == IP4)
826  {
827  rmp->eid_type = 0; /* ipv4 type */
828  clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
829  sizeof (ip_prefix_v4 (ip_prefix)));
830  }
831  else
832  {
833  rmp->eid_type = 1; /* ipv6 type */
834  clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
835  sizeof (ip_prefix_v6 (ip_prefix)));
836  }
837  break;
838  case GID_ADDR_MAC:
839  rmp->eid_type = 2; /* l2 mac type */
840  clib_memcpy (rmp->eid, mac, 6);
841  break;
842  default:
843  ASSERT (0);
844  }
845  rmp->context = context;
846  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
847  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
848  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
849  vl_msg_api_send_shmem (q, (u8 *) & rmp);
850 }
851 
852 static void
854 {
855  u32 mi;
858  mapping_t *mapit = NULL;
859  gid_address_t _eid, *eid = &_eid;
860 
862  if (q == 0)
863  {
864  return;
865  }
866 
867  if (mp->eid_set)
868  {
869  memset (eid, 0, sizeof (*eid));
870 
871  unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
872  mp->eid_type, mp->eid, mp->prefix_length);
873 
875  if ((u32) ~ 0 == mi)
876  return;
877 
878  mapit = pool_elt_at_index (lcm->mapping_pool, mi);
879  send_one_eid_table_details (mapit, q, mp->context,
880  0 /* ignore filter */ );
881  }
882  else
883  {
884  /* *INDENT-OFF* */
885  pool_foreach (mapit, lcm->mapping_pool,
886  ({
887  send_one_eid_table_details(mapit, q, mp->context,
888  mp->filter);
889  }));
890  /* *INDENT-ON* */
891  }
892 }
893 
894 static void
895 send_one_map_server_details (ip_address_t * ip,
896  unix_shared_memory_queue_t * q, u32 context)
897 {
899 
900  rmp = vl_msg_api_alloc (sizeof (*rmp));
901  memset (rmp, 0, sizeof (*rmp));
902  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
903 
904  switch (ip_addr_version (ip))
905  {
906  case IP4:
907  rmp->is_ipv6 = 0;
908  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
909  sizeof (ip_addr_v4 (ip)));
910  break;
911 
912  case IP6:
913  rmp->is_ipv6 = 1;
914  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
915  sizeof (ip_addr_v6 (ip)));
916  break;
917 
918  default:
919  ASSERT (0);
920  }
921  rmp->context = context;
922 
923  vl_msg_api_send_shmem (q, (u8 *) & rmp);
924 }
925 
926 static void
928 {
931  lisp_msmr_t *mr;
932 
934  if (q == 0)
935  {
936  return;
937  }
938 
939  vec_foreach (mr, lcm->map_servers)
940  {
942  }
943 }
944 
945 static void
946 send_one_map_resolver_details (ip_address_t * ip,
947  unix_shared_memory_queue_t * q, u32 context)
948 {
950 
951  rmp = vl_msg_api_alloc (sizeof (*rmp));
952  memset (rmp, 0, sizeof (*rmp));
953  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
954 
955  switch (ip_addr_version (ip))
956  {
957  case IP4:
958  rmp->is_ipv6 = 0;
959  clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
960  sizeof (ip_addr_v4 (ip)));
961  break;
962 
963  case IP6:
964  rmp->is_ipv6 = 1;
965  clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
966  sizeof (ip_addr_v6 (ip)));
967  break;
968 
969  default:
970  ASSERT (0);
971  }
972  rmp->context = context;
973 
974  vl_msg_api_send_shmem (q, (u8 *) & rmp);
975 }
976 
977 static void
979 {
982  lisp_msmr_t *mr;
983 
985  if (q == 0)
986  {
987  return;
988  }
989 
990  vec_foreach (mr, lcm->map_resolvers)
991  {
993  }
994 }
995 
996 static void
998  unix_shared_memory_queue_t * q, u32 context)
999 {
1001 
1002  rmp = vl_msg_api_alloc (sizeof (*rmp));
1003  memset (rmp, 0, sizeof (*rmp));
1004  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
1005 
1006  rmp->vni = clib_host_to_net_u32 (p->key);
1007  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
1008  rmp->context = context;
1009  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1010 }
1011 
1012 static void
1014 {
1017  hash_pair_t *p;
1018  uword *vni_table = 0;
1019 
1021  if (q == 0)
1022  {
1023  return;
1024  }
1025 
1026  if (mp->is_l2)
1027  {
1028  vni_table = lcm->bd_id_by_vni;
1029  }
1030  else
1031  {
1032  vni_table = lcm->table_id_by_vni;
1033  }
1034 
1035  /* *INDENT-OFF* */
1036  hash_foreach_pair (p, vni_table,
1037  ({
1038  send_eid_table_map_pair (p, q, mp->context);
1039  }));
1040  /* *INDENT-ON* */
1041 }
1042 
1043 static void
1045 {
1047 
1048  rmp = vl_msg_api_alloc (sizeof (*rmp));
1049  memset (rmp, 0, sizeof (*rmp));
1050  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
1051  rmp->context = context;
1052  rmp->vni = clib_host_to_net_u32 (vni);
1053  vl_msg_api_send_shmem (q, (u8 *) & rmp);
1054 }
1055 
1056 static void
1058 {
1059  lisp_adjacency_t *adj;
1061  u32 i, n = vec_len (adjs);
1062 
1063  for (i = 0; i < n; i++)
1064  {
1065  adj = vec_elt_at_index (adjs, i);
1066  memset (&a, 0, sizeof (a));
1067 
1068  switch (gid_address_type (&adj->reid))
1069  {
1070  case GID_ADDR_IP_PREFIX:
1073  if (gid_address_ip_version (&adj->reid) == IP4)
1074  {
1075  a.eid_type = 0; /* ipv4 type */
1076  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
1077  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
1078  }
1079  else
1080  {
1081  a.eid_type = 1; /* ipv6 type */
1082  clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
1083  clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
1084  }
1085  break;
1086  case GID_ADDR_MAC:
1087  a.eid_type = 2; /* l2 mac type */
1088  mac_copy (a.reid, gid_address_mac (&adj->reid));
1089  mac_copy (a.leid, gid_address_mac (&adj->leid));
1090  break;
1091  default:
1092  ASSERT (0);
1093  }
1094  dst[i] = a;
1095  }
1096 }
1097 
1098 static void
1101 {
1103  int rv = 0;
1104 
1105  /* *INDENT-OFF* */
1106  REPLY_MACRO2 (VL_API_SHOW_ONE_RLOC_PROBE_STATE_REPLY,
1107  {
1109  });
1110  /* *INDENT-ON* */
1111 }
1112 
1113 static void
1116 {
1118  int rv = 0;
1119 
1120  /* *INDENT-OFF* */
1121  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_STATE_REPLY,
1122  {
1124  });
1125  /* *INDENT-ON* */
1126 }
1127 
1128 static void
1130 {
1132  lisp_adjacency_t *adjs = 0;
1133  int rv = 0;
1134  u32 size = ~0;
1135  u32 vni = clib_net_to_host_u32 (mp->vni);
1136 
1137  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
1138  size = vec_len (adjs) * sizeof (vl_api_one_adjacency_t);
1139 
1140  /* *INDENT-OFF* */
1141  REPLY_MACRO4 (VL_API_ONE_ADJACENCIES_GET_REPLY, size,
1142  {
1143  rmp->count = clib_host_to_net_u32 (vec_len (adjs));
1144  one_adjacency_copy (rmp->adjacencies, adjs);
1145  });
1146  /* *INDENT-ON* */
1147 
1148  vec_free (adjs);
1149 }
1150 
1151 static void
1153 {
1154  hash_pair_t *p;
1155  u32 *vnis = 0;
1158 
1160  if (q == 0)
1161  {
1162  return;
1163  }
1164 
1165  /* *INDENT-OFF* */
1167  ({
1168  hash_set (vnis, p->key, 0);
1169  }));
1170 
1172  ({
1173  hash_set (vnis, p->key, 0);
1174  }));
1175 
1176  hash_foreach_pair (p, vnis,
1177  ({
1178  send_eid_table_vni (p->key, q, mp->context);
1179  }));
1180  /* *INDENT-ON* */
1181 
1182  hash_free (vnis);
1183 }
1184 
1185 static void
1187 {
1190  int rv = 0;
1191 
1193  if (q == 0)
1194  {
1195  return;
1196  }
1197 
1198  /* *INDENT-OFF* */
1199  REPLY_MACRO2(VL_API_SHOW_ONE_STATUS_REPLY,
1200  ({
1203  }));
1204  /* *INDENT-ON* */
1205 }
1206 
1207 static void
1210 {
1214  locator_set_t *loc_set = 0;
1215  u8 *tmp_str = 0;
1216  int rv = 0;
1217 
1219  if (q == 0)
1220  {
1221  return;
1222  }
1223 
1224  if (~0 == lcm->mreq_itr_rlocs)
1225  {
1226  tmp_str = format (0, " ");
1227  }
1228  else
1229  {
1230  loc_set =
1232  tmp_str = format (0, "%s", loc_set->name);
1233  }
1234 
1235  /* *INDENT-OFF* */
1236  REPLY_MACRO2(VL_API_ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
1237  ({
1238  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1239  ARRAY_LEN(rmp->locator_set_name) - 1);
1240  }));
1241  /* *INDENT-ON* */
1242 
1243  vec_free (tmp_str);
1244 }
1245 
1246 static void
1248 {
1252  mapping_t *m;
1253  locator_set_t *ls = 0;
1254  u8 *tmp_str = 0;
1255  int rv = 0;
1256 
1258  if (q == 0)
1259  {
1260  return;
1261  }
1262 
1263  if (!lcm->lisp_pitr)
1264  {
1265  tmp_str = format (0, "N/A");
1266  }
1267  else
1268  {
1270  if (~0 != m->locator_set_index)
1271  {
1272  ls =
1274  tmp_str = format (0, "%s", ls->name);
1275  }
1276  else
1277  {
1278  tmp_str = format (0, "N/A");
1279  }
1280  }
1281  vec_add1 (tmp_str, 0);
1282 
1283  /* *INDENT-OFF* */
1284  REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
1285  ({
1286  rmp->status = lcm->lisp_pitr;
1287  strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
1288  ARRAY_LEN(rmp->locator_set_name) - 1);
1289  }));
1290  /* *INDENT-ON* */
1291 }
1292 
1293 static void
1296 {
1298  vnet_api_error_t rv = 0;
1299 
1300  /* *INDENT-OFF* */
1301  REPLY_MACRO2 (VL_API_SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,
1302  ({
1304  }));
1305  /* *INDENT-ON* */
1306 }
1307 
1308 static void
1311 {
1313 
1315  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
1316 }
1317 
1318 static void
1319 lisp_fid_addr_to_api (fid_address_t * fid, u8 * dst, u8 * api_eid_type,
1320  u8 * prefix_length)
1321 {
1322  switch (fid_addr_type (fid))
1323  {
1324  case FID_ADDR_IP_PREF:
1325  *prefix_length = fid_addr_prefix_length (fid);
1326  if (fid_addr_ip_version (fid) == IP4)
1327  {
1328  *api_eid_type = 0; /* ipv4 type */
1329  clib_memcpy (dst, &fid_addr_ippref (fid), 4);
1330  }
1331  else
1332  {
1333  *api_eid_type = 1; /* ipv6 type */
1334  clib_memcpy (dst, &fid_addr_ippref (fid), 16);
1335  }
1336  break;
1337  case FID_ADDR_MAC:
1338  *api_eid_type = 2; /* l2 mac type */
1339  mac_copy (dst, fid_addr_mac (fid));
1340  break;
1341  default:
1342  ASSERT (0);
1343  }
1344 }
1345 
1346 static void
1348 {
1350  lisp_api_stats_t *stats, *stat;
1351  u8 rv = 0;
1352 
1353  stats = vnet_lisp_get_stats ();
1354  vec_foreach (stat, stats)
1355  {
1356  /* *INDENT-OFF* */
1357  REPLY_DETAILS (VL_API_ONE_STATS_DETAILS,
1358  ({
1359  lisp_fid_addr_to_api (&stat->deid, rmp->deid, &rmp->eid_type,
1360  &rmp->deid_pref_len);
1361  lisp_fid_addr_to_api (&stat->seid, rmp->seid, &rmp->eid_type,
1362  &rmp->seid_pref_len);
1363  rmp->vni = clib_host_to_net_u32 (stat->vni);
1364 
1365  rmp->is_ip4 = ip_addr_version (&stat->rmt_rloc) == IP4 ? 1 : 0;
1366  ip_address_copy_addr (rmp->rloc, &stat->rmt_rloc);
1367  ip_address_copy_addr (rmp->lloc, &stat->loc_rloc);
1368 
1369  rmp->pkt_count = clib_host_to_net_u32 (stat->counters.packets);
1370  rmp->bytes = clib_host_to_net_u32 (stat->counters.bytes);
1371  }));
1372  /* *INDENT-ON* */
1373  }
1374 }
1375 
1376 /*
1377  * one_api_hookup
1378  * Add vpe's API message handlers to the table.
1379  * vlib has alread mapped shared memory and
1380  * added the client registration handlers.
1381  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
1382  */
1383 #define vl_msg_name_crc_list
1384 #include <vnet/vnet_all_api_h.h>
1385 #undef vl_msg_name_crc_list
1386 
1387 static void
1389 {
1390 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1391  foreach_vl_msg_name_crc_one;
1392 #undef _
1393 }
1394 
1395 static clib_error_t *
1397 {
1398  api_main_t *am = &api_main;
1399 
1400 #define _(N,n) \
1401  vl_msg_api_set_handlers(VL_API_##N, #n, \
1402  vl_api_##n##_t_handler, \
1403  vl_noop_handler, \
1404  vl_api_##n##_t_endian, \
1405  vl_api_##n##_t_print, \
1406  sizeof(vl_api_##n##_t), 1);
1408 #undef _
1409 
1410  /*
1411  * Set up the (msg_name, crc, message-id) table
1412  */
1414 
1415  return 0;
1416 }
1417 
1419 
1420 /*
1421  * fd.io coding-style-patch-verification: ON
1422  *
1423  * Local Variables:
1424  * eval: (c-set-style "gnu")
1425  * End:
1426  */
#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:711
static void vl_api_one_eid_table_dump_t_handler(vl_api_one_eid_table_dump_t *mp)
Definition: one_api.c:853
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:302
#define gid_address_ip_version(_a)
Definition: lisp_types.h:245
Reply for one_use_petr.
Definition: one.api:243
Get ONE map request itr rlocs status.
Definition: one.api:843
u32 pitr_map_index
Definition: control.h:194
vnet_api_error_t
Definition: api_errno.h:109
gid_address_t leid
Definition: control.h:63
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
#define gid_address_type(_a)
Definition: lisp_types.h:241
Status of ONE PITR, enable or disable.
Definition: one.api:873
enable or disable ONE feature
Definition: one.api:182
static void vl_api_one_rloc_probe_enable_disable_t_handler(vl_api_one_rloc_probe_enable_disable_t *mp)
Definition: one_api.c:357
a
Definition: bitmap.h:516
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
Definition: lisp_gpe.c:181
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
add or delete map request itr rlocs
Definition: one.api:502
lisp_msmr_t * map_resolvers
Definition: control.h:166
static void vl_api_one_stats_enable_disable_t_handler(vl_api_one_stats_enable_disable_t *mp)
Definition: one_api.c:1310
static void vl_api_one_add_del_local_eid_t_handler(vl_api_one_add_del_local_eid_t *mp)
Definition: one_api.c:252
#define REPLY_MACRO4(t, n, body)
Reply for gpe enable/disable.
Definition: one.api:193
uword * table_id_by_vni
Definition: control.h:183
add or delete locator_set
Definition: one.api:31
ONE adjacency.
Definition: one.api:696
static void vl_api_one_add_del_map_server_t_handler(vl_api_one_add_del_map_server_t *mp)
Definition: one_api.c:312
#define REPLY_MACRO2(t, body)
#define NULL
Definition: clib.h:55
Request for ONE status.
Definition: one.api:820
enable/disable ONE map-register
Definition: one.api:323
locator_t * locator_pool
Definition: control.h:132
dp_address_t seid
Definition: lisp_gpe.h:103
static void setup_message_id_table(api_main_t *am)
Definition: one_api.c:1388
u8 vnet_lisp_get_map_request_mode(void)
Definition: control.c:55
#define ip_prefix_len(_a)
Definition: lisp_types.h:73
reply to one_eid_table_vni_dump
Definition: one.api:767
ip_address_t loc_rloc
Definition: lisp_gpe.h:104
#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:101
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void send_one_locator_details(lisp_cp_main_t *lcm, locator_t *loc, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:579
static void vl_api_one_locator_dump_t_handler(vl_api_one_locator_dump_t *mp)
Definition: one_api.c:607
Request for map server summary status.
Definition: one.api:810
#define foreach_vpe_api_msg
Definition: one_api.c:76
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
static void vl_api_show_one_status_t_handler(vl_api_show_one_status_t *mp)
Definition: one_api.c:1186
ip_address_t address
Definition: control.h:78
vnet_api_error_t vnet_lisp_stats_enable_disable(u8 enable)
Definition: control.c:3862
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: lisp_types.c:843
static void vl_api_show_one_map_request_mode_t_handler(vl_api_show_one_map_request_mode_t *mp)
Definition: one_api.c:378
static clib_error_t * one_api_hookup(vlib_main_t *vm)
Definition: one_api.c:1396
#define ip_prefix_version(_a)
Definition: lisp_types.h:72
u8 vnet_lisp_stats_enable_disable_state(void)
Definition: control.c:3878
#define fid_addr_mac(_a)
Definition: lisp_types.h:131
u8 vnet_lisp_map_register_state_get(void)
Definition: control.c:420
static void send_one_map_server_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:895
int vnet_lisp_set_map_request_mode(u8 mode)
Definition: control.c:1265
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:1219
configure or disable use of PETR
Definition: one.api:230
uword value[0]
Definition: hash.h:164
Request for map request itr rlocs summary status.
Definition: one.api:851
ONE locator_set status.
Definition: one.api:571
api_main_t api_main
Definition: api_shared.c:35
lisp_msmr_t * map_servers
Definition: control.h:169
static void vl_api_one_adjacencies_get_t_handler(vl_api_one_adjacencies_get_t *mp)
Definition: one_api.c:1129
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:376
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:1209
Request for ONE map-request mode.
Definition: one.api:390
u8 * key
Definition: lisp_types.h:341
Request for ONE adjacencies.
Definition: one.api:722
ip_address_t rmt_rloc
Definition: lisp_gpe.h:105
Request for one_eid_table_map_details.
Definition: one.api:745
#define gid_address_sd_src(_a)
Definition: lisp_types.h:256
static void vl_api_one_add_del_map_resolver_t_handler(vl_api_one_add_del_map_resolver_t *mp)
Definition: one_api.c:327
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
Definition: control.c:832
Dumps all VNIs used in mappings.
Definition: one.api:756
static void vl_api_one_enable_disable_t_handler(vl_api_one_enable_disable_t *mp)
Definition: one_api.c:367
static void vl_api_one_add_del_adjacency_t_handler(vl_api_one_add_del_adjacency_t *mp)
Definition: one_api.c:555
uword * bd_id_by_vni
Definition: control.h:187
#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:978
static lisp_cp_main_t * vnet_lisp_cp_get_main()
Definition: control.h:231
static int unformat_one_eid_api(gid_address_t *dst, u32 vni, u8 type, void *src, u8 len)
Definition: one_api.c:220
add or delete ONE adjacency adjacency
Definition: one.api:473
Reply for one_add_del_adjacency.
Definition: one.api:490
vl_api_one_local_locator_t locators[locator_num]
Definition: one.api:38
u32 petr_map_index
Proxy ETR map index.
Definition: control.h:197
#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:490
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
Definition: control.c:1745
u32 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
static void vl_api_one_map_register_enable_disable_t_handler(vl_api_one_map_register_enable_disable_t *mp)
Definition: one_api.c:346
void ip_address_copy_addr(void *dst, const ip_address_t *src)
Definition: lisp_types.c:837
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
Definition: control.c:1286
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:397
u8 vnet_lisp_rloc_probe_state_get(void)
Definition: control.c:427
counter_t packets
packet counter
Definition: counter.h:141
static void vl_api_one_eid_table_vni_dump_t_handler(vl_api_one_eid_table_vni_dump_t *mp)
Definition: one_api.c:1152
static void send_one_map_resolver_details(ip_address_t *ip, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:946
#define gid_address_mac(_a)
Definition: lisp_types.h:247
#define ip_prefix_v6(_a)
Definition: lisp_types.h:75
static u8 fid_type_to_api_type(fid_address_t *fid)
Definition: one_api.c:738
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:798
Request for ONE PITR status.
Definition: one.api:862
#define hash_free(h)
Definition: hash.h:286
void gid_address_free(gid_address_t *a)
Definition: lisp_types.c:785
static void vl_api_one_add_del_remote_mapping_t_handler(vl_api_one_add_del_remote_mapping_t *mp)
Definition: one_api.c:511
u8 authoritative
Definition: lisp_types.h:333
Request for ONE PETR status.
Definition: one.api:253
lisp_api_stats_t * vnet_lisp_get_stats(void)
Definition: control.c:3645
#define REPLY_MACRO(t)
Reply for map_resolver add/del.
Definition: one.api:171
set ONE map-request mode.
Definition: one.api:369
Reply for show_one_rloc_probe_state.
Definition: one.api:289
int vnet_lisp_add_del_mapping(gid_address_t *eid, locator_t *rlocs, u8 action, u8 authoritative, u32 ttl, u8 is_add, u8 is_static, u32 *res_map_index)
Adds/removes/updates mapping.
Definition: control.c:1035
add or delete map-resolver
Definition: one.api:158
void ip_prefix_normalize(ip_prefix_t *a)
Definition: lisp_types.c:923
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:242
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:598
#define BAD_SW_IF_INDEX_LABEL
u32 sw_if_index
Definition: lisp_types.h:294
ONE map server details.
Definition: one.api:799
Request for map one locator status.
Definition: one.api:555
void * vl_msg_api_alloc(int nbytes)
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
Definition: control.c:1842
Shows relationship between vni and vrf/bd.
Definition: one.api:733
vlib_counter_t counters
Definition: lisp_gpe.h:107
Dump ONE eid-table.
Definition: one.api:636
vl_api_one_remote_locator_t rlocs[rloc_num]
Definition: one.api:448
vlib_main_t * vm
Definition: buffer.c:276
static void vl_api_one_use_petr_t_handler(vl_api_one_use_petr_t *mp)
Definition: one_api.c:418
void gid_address_ip_set(gid_address_t *dst, void *src, u8 version)
Definition: lisp_types.c:1465
Get state of ONE map-register.
Definition: one.api:344
Reply for one_rloc_probe_enable_disable.
Definition: one.api:312
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:340
#define gid_address_ippref_len(_a)
Definition: lisp_types.h:243
ONE adjacency reply.
Definition: one.api:709
#define clib_warning(format, args...)
Definition: error.h:59
u32 locator_set_index
Definition: lisp_types.h:326
static void send_eid_table_vni(u32 vni, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:1044
#define clib_memcpy(a, b, c)
Definition: string.h:69
Reply for one_add_del_remote_mapping.
Definition: one.api:455
#define fid_addr_ip_version(_a)
Definition: lisp_types.h:130
int vnet_lisp_map_register_enable_disable(u8 is_enable)
Definition: control.c:1736
Reply for one_add_del_map_server.
Definition: one.api:145
Reply for show_one_map_request_mode.
Definition: one.api:401
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:238
#define ARRAY_LEN(x)
Definition: clib.h:59
lisp_key_type_t key_id
Definition: lisp_types.h:342
static void vl_api_show_one_rloc_probe_state_t_handler(vl_api_show_one_rloc_probe_state_t *mp)
Definition: one_api.c:1100
static void vl_api_show_one_stats_enable_disable_t_handler(vl_api_show_one_stats_enable_disable_t *mp)
Definition: one_api.c:1295
#define fid_addr_ippref(_a)
Definition: lisp_types.h:128
u8 vnet_lisp_enable_disable_status(void)
Definition: control.c:1787
struct _gid_address_t gid_address_t
Reply for local_eid add/del.
Definition: one.api:119
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
Definition: control.c:652
#define ASSERT(truth)
#define fid_addr_type(_a)
Definition: lisp_types.h:133
unsigned int u32
Definition: types.h:88
static void vl_api_show_one_map_register_state_t_handler(vl_api_show_one_map_register_state_t *mp)
Definition: one_api.c:1115
int vnet_lisp_clear_all_remote_adjacencies(void)
Definition: control.c:1168
map/unmap vni/bd_index to vrf
Definition: one.api:528
#define gid_address_sd_dst(_a)
Definition: lisp_types.h:257
gid_dictionary_t mapping_index_by_gid
Definition: control.h:123
#define REPLY_DETAILS(t, body)
Definition: one_api.c:61
u64 size
Definition: vhost-user.h:77
locator_set_t * locator_set_pool
Definition: control.h:135
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
Definition: control.c:1727
static void vl_api_one_locator_set_dump_t_handler(vl_api_one_locator_set_dump_t *mp)
Definition: one_api.c:682
Get state of ONE RLOC probing.
Definition: one.api:278
Add/delete map server.
Definition: one.api:132
ONE PETR status, enable or disable.
Definition: one.api:265
Reply for locator add/del.
Definition: one.api:77
static void vl_api_one_stats_dump_t_handler(vl_api_one_stats_dump_t *mp)
Definition: one_api.c:1347
Reply for one_pitr_set_locator_set.
Definition: one.api:217
u64 uword
Definition: types.h:112
Reply for one_map_register_enable_disable.
Definition: one.api:334
add or delete remote static mapping
Definition: one.api:433
static void vl_api_one_eid_table_map_dump_t_handler(vl_api_one_eid_table_map_dump_t *mp)
Definition: one_api.c:1013
counter_t bytes
byte counter
Definition: counter.h:142
int vnet_lisp_add_del_locator_set(vnet_lisp_add_del_locator_set_args_t *a, u32 *ls_result)
Definition: control.c:1587
#define gid_address_ip(_a)
Definition: lisp_types.h:244
#define gid_address_vni(_a)
Definition: lisp_types.h:249
Reply for one_map_request_mode.
Definition: one.api:380
add or delete locator for locator set
Definition: one.api:62
static void vl_api_one_add_del_locator_set_t_handler(vl_api_one_add_del_locator_set_t *mp)
Definition: one_api.c:136
Reply for locator_set add/del.
Definition: one.api:46
Request for map resolver summary status.
Definition: one.api:789
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
Definition: hash.h:349
static void vl_api_one_add_del_locator_t_handler(vl_api_one_add_del_locator_t *mp)
Definition: one_api.c:186
enable/disable ONE RLOC probing
Definition: one.api:301
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:1497
mapping_t * mapping_pool
Definition: control.h:126
uword * locator_set_index_by_name
Definition: control.h:141
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
Definition: lisp_types.c:1399
static void vl_api_one_map_request_mode_t_handler(vl_api_one_map_request_mode_t *mp)
Definition: one_api.c:392
Definition: lisp_types.h:37
gid_address_t eid
Definition: lisp_types.h:321
gid_address_t reid
Definition: control.h:64
static void vl_api_one_pitr_set_locator_set_t_handler(vl_api_one_pitr_set_locator_set_t *mp)
Definition: one_api.c:403
gid_address_t address
Definition: lisp_types.h:295
#define hash_get_mem(h, key)
Definition: hash.h:268
void mac_copy(void *dst, void *src)
Definition: lisp_types.c:986
ONE locator_set status.
Definition: one.api:587
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
Definition: control.c:1794
static void vl_api_show_one_pitr_t_handler(vl_api_show_one_pitr_t *mp)
Definition: one_api.c:1247
#define vec_foreach(var, vec)
Vector iterator.
#define fid_addr_prefix_length(_a)
Definition: lisp_types.h:129
static void vl_api_show_one_use_petr_t_handler(vl_api_show_one_use_petr_t *mp)
Definition: one_api.c:431
Request for eid table summary status.
Definition: one.api:674
vhost_vring_addr_t addr
Definition: vhost-user.h:84
Request for locator_set summary status.
Definition: one.api:603
Definition: lisp_types.h:38
static void send_one_locator_set_details(lisp_cp_main_t *lcm, locator_set_t *lsit, unix_shared_memory_queue_t *q, u32 context, u32 ls_index)
Definition: one_api.c:651
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
Definition: control.c:1338
ONE map resolver status.
Definition: one.api:778
Reply for one_eid_table_add_del_map.
Definition: one.api:542
static void send_eid_table_map_pair(hash_pair_t *p, unix_shared_memory_queue_t *q, u32 context)
Definition: one_api.c:997
u32 mreq_itr_rlocs
Definition: control.h:180
u32 * locator_indices
Definition: lisp_types.h:315
static locator_t * unformat_one_locs(vl_api_one_remote_locator_t *rmt_locs, u32 rloc_num)
Definition: one_api.c:114
Reply for one_add_del_map_request_itr_rlocs.
Definition: one.api:515
Reply for show_one_map_register_state.
Definition: one.api:354
static void lisp_fid_addr_to_api(fid_address_t *fid, u8 *dst, u8 *api_eid_type, u8 *prefix_length)
Definition: one_api.c:1319
uword key
Definition: hash.h:161
LISP-GPE definitions.
configure or disable ONE PITR node
Definition: one.api:205
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
vl_api_one_adjacency_t adjacencies[count]
Definition: one.api:714
static void one_adjacency_copy(vl_api_one_adjacency_t *dst, lisp_adjacency_t *adjs)
Definition: one_api.c:1057
static void vl_api_one_map_server_dump_t_handler(vl_api_one_map_server_dump_t *mp)
Definition: one_api.c:927
static void send_one_eid_table_details(mapping_t *mapit, unix_shared_memory_queue_t *q, u32 context, u8 filter)
Definition: one_api.c:763