FD.io VPP  v17.04-9-g99c0734
Vector Packet Processing
ip_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * ip_api.c - vnet ip api
4  *
5  * Copyright (c) 2016 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/ethernet/ethernet.h>
26 #include <vnet/ip/ip.h>
27 #include <vnet/ip/ip6_neighbor.h>
28 #include <vnet/fib/fib_table.h>
29 #include <vnet/fib/fib_api.h>
30 #include <vnet/dpo/drop_dpo.h>
31 #include <vnet/dpo/receive_dpo.h>
32 #include <vnet/dpo/lookup_dpo.h>
33 #include <vnet/dpo/classify_dpo.h>
34 #include <vnet/dpo/ip_null_dpo.h>
36 #include <vnet/mfib/ip6_mfib.h>
37 #include <vnet/mfib/ip4_mfib.h>
38 #include <vnet/mfib/mfib_signal.h>
39 #include <vnet/mfib/mfib_entry.h>
40 
41 #include <vnet/vnet_msg_enum.h>
42 
43 #define vl_typedefs /* define message structures */
44 #include <vnet/vnet_all_api_h.h>
45 #undef vl_typedefs
46 
47 #define vl_endianfun /* define message structures */
48 #include <vnet/vnet_all_api_h.h>
49 #undef vl_endianfun
50 
51 /* instantiate all the print functions we know about */
52 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
53 #define vl_printfun
54 #include <vnet/vnet_all_api_h.h>
55 #undef vl_printfun
56 
58 
59 
60 #define foreach_ip_api_msg \
61 _(IP_FIB_DUMP, ip_fib_dump) \
62 _(IP6_FIB_DUMP, ip6_fib_dump) \
63 _(IP_MFIB_DUMP, ip_mfib_dump) \
64 _(IP6_MFIB_DUMP, ip6_mfib_dump) \
65 _(IP_NEIGHBOR_DUMP, ip_neighbor_dump) \
66 _(IP_MROUTE_ADD_DEL, ip_mroute_add_del) \
67 _(MFIB_SIGNAL_DUMP, mfib_signal_dump) \
68 _(IP_ADDRESS_DUMP, ip_address_dump) \
69 _(IP_DUMP, ip_dump) \
70 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
71 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
72 _(SET_IP_FLOW_HASH,set_ip_flow_hash) \
73 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
74 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
75 _(IP6ND_PROXY_ADD_DEL, ip6nd_proxy_add_del) \
76 _(IP6ND_PROXY_DUMP, ip6nd_proxy_dump) \
77 _(SW_INTERFACE_IP6_ENABLE_DISABLE, sw_interface_ip6_enable_disable ) \
78 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
79  sw_interface_ip6_set_link_local_address)
80 
81 extern void stats_dslock_with_hint (int hint, int tag);
82 extern void stats_dsunlock (void);
83 
84 static void
86  u8 is_static,
87  u8 * mac_address,
88  u8 * ip_address,
89  unix_shared_memory_queue_t * q, u32 context)
90 {
92 
93  mp = vl_msg_api_alloc (sizeof (*mp));
94  memset (mp, 0, sizeof (*mp));
95  mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_DETAILS);
96  mp->context = context;
97  mp->is_ipv6 = is_ipv6;
98  mp->is_static = is_static;
99  memcpy (mp->mac_address, mac_address, 6);
100  memcpy (mp->ip_address, ip_address, (is_ipv6) ? 16 : 4);
101 
102  vl_msg_api_send_shmem (q, (u8 *) & mp);
103 }
104 
105 static void
107 {
109 
111  if (q == 0)
112  return;
113 
114  u32 sw_if_index = ntohl (mp->sw_if_index);
115 
116  if (mp->is_ipv6)
117  {
118  ip6_neighbor_t *n, *ns;
119 
120  ns = ip6_neighbors_entries (sw_if_index);
121  /* *INDENT-OFF* */
122  vec_foreach (n, ns)
123  {
125  (mp->is_ipv6, ((n->flags & IP6_NEIGHBOR_FLAG_STATIC) ? 1 : 0),
126  (u8 *) n->link_layer_address,
127  (u8 *) & (n->key.ip6_address.as_u8),
128  q, mp->context);
129  }
130  /* *INDENT-ON* */
131  vec_free (ns);
132  }
133  else
134  {
135  ethernet_arp_ip4_entry_t *n, *ns;
136 
137  ns = ip4_neighbor_entries (sw_if_index);
138  /* *INDENT-OFF* */
139  vec_foreach (n, ns)
140  {
142  ((n->flags & ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC) ? 1 : 0),
143  (u8*) n->ethernet_address,
144  (u8*) & (n->ip4_address.as_u8),
145  q, mp->context);
146  }
147  /* *INDENT-ON* */
148  vec_free (ns);
149  }
150 }
151 
152 
153 void
154 copy_fib_next_hop (fib_route_path_encode_t * api_rpath, void *fp_arg)
155 {
156  int is_ip4;
157  vl_api_fib_path_t *fp = (vl_api_fib_path_t *) fp_arg;
158 
159  if (api_rpath->rpath.frp_proto == FIB_PROTOCOL_IP4)
160  fp->afi = IP46_TYPE_IP4;
161  else if (api_rpath->rpath.frp_proto == FIB_PROTOCOL_IP6)
162  fp->afi = IP46_TYPE_IP6;
163  else
164  {
165  is_ip4 = ip46_address_is_ip4 (&api_rpath->rpath.frp_addr);
166  if (is_ip4)
167  fp->afi = IP46_TYPE_IP4;
168  else
169  fp->afi = IP46_TYPE_IP6;
170  }
171  if (fp->afi == IP46_TYPE_IP4)
172  memcpy (fp->next_hop, &api_rpath->rpath.frp_addr.ip4,
173  sizeof (api_rpath->rpath.frp_addr.ip4));
174  else
175  memcpy (fp->next_hop, &api_rpath->rpath.frp_addr.ip6,
176  sizeof (api_rpath->rpath.frp_addr.ip6));
177 }
178 
179 static void
182  u32 table_id, fib_prefix_t * pfx,
183  fib_route_path_encode_t * api_rpaths, u32 context)
184 {
186  fib_route_path_encode_t *api_rpath;
187  vl_api_fib_path_t *fp;
188  int path_count;
189 
190  path_count = vec_len (api_rpaths);
191  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
192  if (!mp)
193  return;
194  memset (mp, 0, sizeof (*mp));
195  mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
196  mp->context = context;
197 
198  mp->table_id = htonl (table_id);
199  mp->address_length = pfx->fp_len;
200  memcpy (mp->address, &pfx->fp_addr.ip4, sizeof (pfx->fp_addr.ip4));
201 
202  mp->count = htonl (path_count);
203  fp = mp->path;
204  vec_foreach (api_rpath, api_rpaths)
205  {
206  memset (fp, 0, sizeof (*fp));
207  switch (api_rpath->dpo.dpoi_type)
208  {
209  case DPO_RECEIVE:
210  fp->is_local = true;
211  break;
212  case DPO_DROP:
213  fp->is_drop = true;
214  break;
215  case DPO_IP_NULL:
216  switch (api_rpath->dpo.dpoi_index)
217  {
218  case IP_NULL_ACTION_NONE:
219  fp->is_drop = true;
220  break;
222  fp->is_unreach = true;
223  break;
225  fp->is_prohibit = true;
226  break;
227  default:
228  break;
229  }
230  break;
231  default:
232  break;
233  }
234  fp->weight = htonl (api_rpath->rpath.frp_weight);
235  fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
236  copy_fib_next_hop (api_rpath, fp);
237  fp++;
238  }
239 
240  vl_msg_api_send_shmem (q, (u8 *) & mp);
241 }
242 
243 static void
245 {
248  ip4_main_t *im = &ip4_main;
249  fib_table_t *fib_table;
250  fib_node_index_t lfei, *lfeip, *lfeis = NULL;
251  mpls_label_t key;
252  fib_prefix_t pfx;
253  u32 fib_index;
254  fib_route_path_encode_t *api_rpaths;
255  int i;
256 
258  if (q == 0)
259  return;
260 
261  /* *INDENT-OFF* */
262  pool_foreach (fib_table, im->fibs,
263  ({
264  for (i = 0; i < ARRAY_LEN (fib_table->v4.fib_entry_by_dst_address); i++)
265  {
266  hash_foreach(key, lfei, fib_table->v4.fib_entry_by_dst_address[i],
267  ({
268  vec_add1(lfeis, lfei);
269  }));
270  }
271  }));
272  /* *INDENT-ON* */
273 
275 
276  vec_foreach (lfeip, lfeis)
277  {
278  fib_entry_get_prefix (*lfeip, &pfx);
279  fib_index = fib_entry_get_fib_index (*lfeip);
280  fib_table = fib_table_get (fib_index, pfx.fp_proto);
281  api_rpaths = NULL;
282  fib_entry_encode (*lfeip, &api_rpaths);
283  send_ip_fib_details (am, q,
284  fib_table->ft_table_id, &pfx, api_rpaths,
285  mp->context);
286  vec_free (api_rpaths);
287  }
288 
289  vec_free (lfeis);
290 }
291 
292 static void
295  u32 table_id, fib_prefix_t * pfx,
296  fib_route_path_encode_t * api_rpaths, u32 context)
297 {
299  fib_route_path_encode_t *api_rpath;
300  vl_api_fib_path_t *fp;
301  int path_count;
302 
303  path_count = vec_len (api_rpaths);
304  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
305  if (!mp)
306  return;
307  memset (mp, 0, sizeof (*mp));
308  mp->_vl_msg_id = ntohs (VL_API_IP6_FIB_DETAILS);
309  mp->context = context;
310 
311  mp->table_id = htonl (table_id);
312  mp->address_length = pfx->fp_len;
313  memcpy (mp->address, &pfx->fp_addr.ip6, sizeof (pfx->fp_addr.ip6));
314 
315  mp->count = htonl (path_count);
316  fp = mp->path;
317  vec_foreach (api_rpath, api_rpaths)
318  {
319  memset (fp, 0, sizeof (*fp));
320  switch (api_rpath->dpo.dpoi_type)
321  {
322  case DPO_RECEIVE:
323  fp->is_local = true;
324  break;
325  case DPO_DROP:
326  fp->is_drop = true;
327  break;
328  case DPO_IP_NULL:
329  switch (api_rpath->dpo.dpoi_index)
330  {
332  fp->is_drop = true;
333  break;
335  fp->is_unreach = true;
336  break;
338  fp->is_prohibit = true;
339  break;
340  default:
341  break;
342  }
343  break;
344  default:
345  break;
346  }
347  fp->weight = htonl (api_rpath->rpath.frp_weight);
348  fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
349  copy_fib_next_hop (api_rpath, fp);
350  fp++;
351  }
352 
353  vl_msg_api_send_shmem (q, (u8 *) & mp);
354 }
355 
357 {
361 
362 static void
364 {
365  api_ip6_fib_show_ctx_t *ctx = arg;
366 
367  if ((kvp->key[2] >> 32) == ctx->fib_index)
368  {
369  vec_add1 (ctx->entries, kvp->value);
370  }
371 }
372 
373 static void
376  fib_table_t * fib_table)
377 {
379  ip6_main_t *im6 = &ip6_main;
380  ip6_fib_t *fib = &fib_table->v6;
381  fib_node_index_t *fib_entry_index;
382  api_ip6_fib_show_ctx_t ctx = {
383  .fib_index = fib->index,.entries = NULL,
384  };
385  fib_route_path_encode_t *api_rpaths;
386  fib_prefix_t pfx;
387 
389  ((BVT (clib_bihash) *) & im6->ip6_table[IP6_FIB_TABLE_NON_FWDING].
390  ip6_hash, api_ip6_fib_table_put_entries, &ctx);
391 
393 
394  vec_foreach (fib_entry_index, ctx.entries)
395  {
396  fib_entry_get_prefix (*fib_entry_index, &pfx);
397  api_rpaths = NULL;
398  fib_entry_encode (*fib_entry_index, &api_rpaths);
399  send_ip6_fib_details (am, q,
400  fib_table->ft_table_id,
401  &pfx, api_rpaths, mp->context);
402  vec_free (api_rpaths);
403  }
404 
405  vec_free (ctx.entries);
406 }
407 
408 static void
410 {
412  ip6_main_t *im6 = &ip6_main;
413  fib_table_t *fib_table;
414 
416  if (q == 0)
417  return;
418 
419  /* *INDENT-OFF* */
420  pool_foreach (fib_table, im6->fibs,
421  ({
422  api_ip6_fib_table_get_all(q, mp, fib_table);
423  }));
424  /* *INDENT-ON* */
425 }
426 
427 static void
430  u32 table_id,
431  mfib_prefix_t * pfx,
432  fib_route_path_encode_t * api_rpaths, u32 context)
433 {
435  fib_route_path_encode_t *api_rpath;
436  vl_api_fib_path_t *fp;
437  int path_count;
438 
439  path_count = vec_len (api_rpaths);
440  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
441  if (!mp)
442  return;
443  memset (mp, 0, sizeof (*mp));
444  mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
445  mp->context = context;
446 
447  mp->table_id = htonl (table_id);
448  mp->address_length = pfx->fp_len;
449  memcpy (mp->grp_address, &pfx->fp_grp_addr.ip4,
450  sizeof (pfx->fp_grp_addr.ip4));
451  memcpy (mp->src_address, &pfx->fp_src_addr.ip4,
452  sizeof (pfx->fp_src_addr.ip4));
453 
454  mp->count = htonl (path_count);
455  fp = mp->path;
456  vec_foreach (api_rpath, api_rpaths)
457  {
458  memset (fp, 0, sizeof (*fp));
459 
460  fp->weight = 0;
461  fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
462  copy_fib_next_hop (api_rpath, fp);
463  fp++;
464  }
465 
466  vl_msg_api_send_shmem (q, (u8 *) & mp);
467 }
468 
470 {
473 
474 static int
476 {
477  vl_api_ip_mfib_dump_ctc_t *ctx = arg;
478 
479  vec_add1 (ctx->entries, fei);
480 
481  return (0);
482 }
483 
484 static void
486 {
489  ip4_main_t *im = &ip4_main;
490  mfib_table_t *mfib_table;
491  fib_node_index_t *mfeip;
492  mfib_prefix_t pfx;
493  fib_route_path_encode_t *api_rpaths = NULL;
495  .entries = NULL,
496  };
497 
499  if (q == 0)
500  return;
501 
502 
503  /* *INDENT-OFF* */
504  pool_foreach (mfib_table, im->mfibs,
505  ({
506  ip4_mfib_table_walk(&mfib_table->v4,
507  vl_api_ip_mfib_table_dump_walk,
508  &ctx);
509 
510  vec_sort_with_function (ctx.entries, mfib_entry_cmp_for_sort);
511 
512  vec_foreach (mfeip, ctx.entries)
513  {
514  mfib_entry_get_prefix (*mfeip, &pfx);
515  mfib_entry_encode (*mfeip, &api_rpaths);
516  send_ip_mfib_details (am, q,
517  mfib_table->mft_table_id,
518  &pfx, api_rpaths,
519  mp->context);
520  }
521  vec_reset_length (api_rpaths);
523 
524  }));
525  /* *INDENT-ON* */
526 
527  vec_free (ctx.entries);
528  vec_free (api_rpaths);
529 }
530 
531 static void
534  u32 table_id,
535  mfib_prefix_t * pfx,
536  fib_route_path_encode_t * api_rpaths, u32 context)
537 {
539  fib_route_path_encode_t *api_rpath;
540  vl_api_fib_path_t *fp;
541  int path_count;
542 
543  path_count = vec_len (api_rpaths);
544  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
545  if (!mp)
546  return;
547  memset (mp, 0, sizeof (*mp));
548  mp->_vl_msg_id = ntohs (VL_API_IP6_FIB_DETAILS);
549  mp->context = context;
550 
551  mp->table_id = htonl (table_id);
552  mp->address_length = pfx->fp_len;
553  memcpy (mp->grp_address, &pfx->fp_grp_addr.ip6,
554  sizeof (pfx->fp_grp_addr.ip6));
555  memcpy (mp->src_address, &pfx->fp_src_addr.ip6,
556  sizeof (pfx->fp_src_addr.ip6));
557 
558  mp->count = htonl (path_count);
559  fp = mp->path;
560  vec_foreach (api_rpath, api_rpaths)
561  {
562  memset (fp, 0, sizeof (*fp));
563 
564  fp->weight = 0;
565  fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
566  copy_fib_next_hop (api_rpath, fp);
567  fp++;
568  }
569 
570  vl_msg_api_send_shmem (q, (u8 *) & mp);
571 }
572 
574 {
577 
578 static int
580 {
581  vl_api_ip6_mfib_dump_ctc_t *ctx = arg;
582 
583  vec_add1 (ctx->entries, fei);
584 
585  return (0);
586 }
587 
588 static void
590 {
593  ip6_main_t *im = &ip6_main;
594  mfib_table_t *mfib_table;
595  fib_node_index_t *mfeip;
596  mfib_prefix_t pfx;
597  fib_route_path_encode_t *api_rpaths = NULL;
599  .entries = NULL,
600  };
601 
603  if (q == 0)
604  return;
605 
606 
607  /* *INDENT-OFF* */
608  pool_foreach (mfib_table, im->mfibs,
609  ({
610  ip6_mfib_table_walk(&mfib_table->v6,
611  vl_api_ip6_mfib_table_dump_walk,
612  &ctx);
613 
614  vec_sort_with_function (ctx.entries, mfib_entry_cmp_for_sort);
615 
616  vec_foreach(mfeip, ctx.entries)
617  {
618  mfib_entry_get_prefix (*mfeip, &pfx);
619  mfib_entry_encode (*mfeip, &api_rpaths);
620  send_ip6_mfib_details (am, q,
621  mfib_table->mft_table_id,
622  &pfx, api_rpaths,
623  mp->context);
624  }
625  vec_reset_length (api_rpaths);
627 
628  }));
629  /* *INDENT-ON* */
630 
631  vec_free (ctx.entries);
632  vec_free (api_rpaths);
633 }
634 
635 static void
637  vlib_main_t * vm)
638 {
640  vnet_main_t *vnm = vnet_get_main ();
641  int rv = 0;
642 
644 
645  stats_dslock_with_hint (1 /* release hint */ , 7 /* tag */ );
646 
647  /*
648  * there's no validation here of the ND/ARP entry being added.
649  * The expectation is that the FIB will ensure that nothing bad
650  * will come of adding bogus entries.
651  */
652  if (mp->is_ipv6)
653  {
654  if (mp->is_add)
656  (vm, ntohl (mp->sw_if_index),
657  (ip6_address_t *) (mp->dst_address),
658  mp->mac_address, sizeof (mp->mac_address), mp->is_static,
659  mp->is_no_adj_fib);
660  else
662  (vm, ntohl (mp->sw_if_index),
663  (ip6_address_t *) (mp->dst_address),
664  mp->mac_address, sizeof (mp->mac_address));
665  }
666  else
667  {
668  ethernet_arp_ip4_over_ethernet_address_t a;
669 
670  clib_memcpy (&a.ethernet, mp->mac_address, 6);
671  clib_memcpy (&a.ip4, mp->dst_address, 4);
672 
673  if (mp->is_add)
674  rv = vnet_arp_set_ip4_over_ethernet (vnm, ntohl (mp->sw_if_index),
675  &a, mp->is_static,
676  mp->is_no_adj_fib);
677  else
678  rv =
679  vnet_arp_unset_ip4_over_ethernet (vnm, ntohl (mp->sw_if_index), &a);
680  }
681 
683 
684  stats_dsunlock ();
685  REPLY_MACRO (VL_API_IP_NEIGHBOR_ADD_DEL_REPLY);
686 }
687 
688 int
690  u8 is_add,
691  u8 is_drop,
692  u8 is_unreach,
693  u8 is_prohibit,
694  u8 is_local,
695  u8 is_classify,
696  u32 classify_table_index,
697  u8 is_resolve_host,
698  u8 is_resolve_attached,
699  u32 fib_index,
700  const fib_prefix_t * prefix,
701  u8 next_hop_proto_is_ip4,
702  const ip46_address_t * next_hop,
703  u32 next_hop_sw_if_index,
704  u8 next_hop_fib_index,
705  u32 next_hop_weight,
706  mpls_label_t next_hop_via_label,
707  mpls_label_t * next_hop_out_label_stack)
708 {
711  fib_route_path_t path = {
712  .frp_proto = (next_hop_proto_is_ip4 ?
714  .frp_addr = (NULL == next_hop ? zero_addr : *next_hop),
715  .frp_sw_if_index = next_hop_sw_if_index,
716  .frp_fib_index = next_hop_fib_index,
717  .frp_weight = next_hop_weight,
718  .frp_label_stack = next_hop_out_label_stack,
719  };
720  fib_route_path_t *paths = NULL;
721 
722  if (MPLS_LABEL_INVALID != next_hop_via_label)
723  {
725  path.frp_local_label = next_hop_via_label;
726  }
727  if (is_resolve_host)
728  path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_HOST;
729  if (is_resolve_attached)
731 
732  path.frp_flags = path_flags;
733 
734  if (is_multipath)
735  {
736  stats_dslock_with_hint (1 /* release hint */ , 10 /* tag */ );
737 
738 
739  vec_add1 (paths, path);
740 
741  if (is_add)
742  fib_table_entry_path_add2 (fib_index,
743  prefix,
745  FIB_ENTRY_FLAG_NONE, paths);
746  else
747  fib_table_entry_path_remove2 (fib_index,
748  prefix, FIB_SOURCE_API, paths);
749 
750  vec_free (paths);
751  stats_dsunlock ();
752  return 0;
753  }
754 
755  stats_dslock_with_hint (1 /* release hint */ , 2 /* tag */ );
756 
757  if (is_drop || is_local || is_classify || is_unreach || is_prohibit)
758  {
759  /*
760  * special route types that link directly to the adj
761  */
762  if (is_add)
763  {
764  dpo_id_t dpo = DPO_INVALID;
765  dpo_proto_t dproto;
766 
767  dproto = fib_proto_to_dpo (prefix->fp_proto);
768 
769  if (is_drop)
771  else if (is_local)
772  receive_dpo_add_or_lock (dproto, ~0, NULL, &dpo);
773  else if (is_unreach)
774  ip_null_dpo_add_and_lock (dproto,
776  else if (is_prohibit)
777  ip_null_dpo_add_and_lock (dproto,
779  &dpo);
780  else if (is_classify)
781  {
782  if (pool_is_free_index (cm->tables,
783  ntohl (classify_table_index)))
784  {
785  stats_dsunlock ();
786  return VNET_API_ERROR_NO_SUCH_TABLE;
787  }
788 
789  dpo_set (&dpo, DPO_CLASSIFY, dproto,
790  classify_dpo_create (dproto,
791  ntohl (classify_table_index)));
792  }
793  else
794  {
795  stats_dsunlock ();
796  return VNET_API_ERROR_NO_SUCH_TABLE;
797  }
798 
800  prefix,
803  dpo_reset (&dpo);
804  }
805  else
806  {
807  fib_table_entry_special_remove (fib_index, prefix, FIB_SOURCE_API);
808  }
809  }
810  else
811  {
812  if (is_add)
813  {
814  vec_add1 (paths, path);
815  fib_table_entry_update (fib_index,
816  prefix,
818  vec_free (paths);
819  }
820  else
821  {
822  fib_table_entry_delete (fib_index, prefix, FIB_SOURCE_API);
823  }
824  }
825 
826  stats_dsunlock ();
827  return (0);
828 }
829 
830 int
832  u32 table_id,
833  u32 next_hop_sw_if_index,
834  fib_protocol_t next_hop_table_proto,
835  u32 next_hop_table_id,
836  u8 create_missing_tables,
837  u32 * fib_index, u32 * next_hop_fib_index)
838 {
839  vnet_main_t *vnm = vnet_get_main ();
840 
841  *fib_index = fib_table_find (table_proto, ntohl (table_id));
842  if (~0 == *fib_index)
843  {
844  if (create_missing_tables)
845  {
846  *fib_index = fib_table_find_or_create_and_lock (table_proto,
847  ntohl (table_id));
848  }
849  else
850  {
851  /* No such VRF, and we weren't asked to create one */
852  return VNET_API_ERROR_NO_SUCH_FIB;
853  }
854  }
855 
856  if (~0 != ntohl (next_hop_sw_if_index))
857  {
859  ntohl (next_hop_sw_if_index)))
860  {
861  return VNET_API_ERROR_NO_MATCHING_INTERFACE;
862  }
863  }
864  else
865  {
866  *next_hop_fib_index = fib_table_find (next_hop_table_proto,
867  ntohl (next_hop_table_id));
868 
869  if (~0 == *next_hop_fib_index)
870  {
871  if (create_missing_tables)
872  {
873  *next_hop_fib_index =
874  fib_table_find_or_create_and_lock (next_hop_table_proto,
875  ntohl (next_hop_table_id));
876  }
877  else
878  {
879  /* No such VRF, and we weren't asked to create one */
880  return VNET_API_ERROR_NO_SUCH_FIB;
881  }
882  }
883  }
884 
885  return (0);
886 }
887 
888 static int
890 {
891  u32 fib_index, next_hop_fib_index;
892  mpls_label_t *label_stack = NULL;
893  int rv, ii, n_labels;;
894 
896  mp->table_id,
899  mp->next_hop_table_id,
901  &fib_index, &next_hop_fib_index);
902 
903  if (0 != rv)
904  return (rv);
905 
906  fib_prefix_t pfx = {
907  .fp_len = mp->dst_address_length,
908  .fp_proto = FIB_PROTOCOL_IP4,
909  };
910  clib_memcpy (&pfx.fp_addr.ip4, mp->dst_address, sizeof (pfx.fp_addr.ip4));
911 
912  ip46_address_t nh;
913  memset (&nh, 0, sizeof (nh));
914  memcpy (&nh.ip4, mp->next_hop_address, sizeof (nh.ip4));
915 
916  n_labels = mp->next_hop_n_out_labels;
917  if (n_labels == 0)
918  ;
919  else if (1 == n_labels)
920  vec_add1 (label_stack, ntohl (mp->next_hop_out_label_stack[0]));
921  else
922  {
923  vec_validate (label_stack, n_labels - 1);
924  for (ii = 0; ii < n_labels; ii++)
925  label_stack[ii] = ntohl (mp->next_hop_out_label_stack[ii]);
926  }
927 
929  mp->is_add,
930  mp->is_drop,
931  mp->is_unreach,
932  mp->is_prohibit,
933  mp->is_local,
934  mp->is_classify,
936  mp->is_resolve_host,
938  fib_index, &pfx, 1,
939  &nh,
940  ntohl (mp->next_hop_sw_if_index),
941  next_hop_fib_index,
942  mp->next_hop_weight,
943  ntohl (mp->next_hop_via_label),
944  label_stack));
945 }
946 
947 static int
949 {
950  u32 fib_index, next_hop_fib_index;
951  mpls_label_t *label_stack = NULL;
952  int rv, ii, n_labels;;
953 
955  mp->table_id,
958  mp->next_hop_table_id,
960  &fib_index, &next_hop_fib_index);
961 
962  if (0 != rv)
963  return (rv);
964 
965  fib_prefix_t pfx = {
966  .fp_len = mp->dst_address_length,
967  .fp_proto = FIB_PROTOCOL_IP6,
968  };
969  clib_memcpy (&pfx.fp_addr.ip6, mp->dst_address, sizeof (pfx.fp_addr.ip6));
970 
971  ip46_address_t nh;
972  memset (&nh, 0, sizeof (nh));
973  memcpy (&nh.ip6, mp->next_hop_address, sizeof (nh.ip6));
974 
975  n_labels = mp->next_hop_n_out_labels;
976  if (n_labels == 0)
977  ;
978  else if (1 == n_labels)
979  vec_add1 (label_stack, ntohl (mp->next_hop_out_label_stack[0]));
980  else
981  {
982  vec_validate (label_stack, n_labels - 1);
983  for (ii = 0; ii < n_labels; ii++)
984  label_stack[ii] = ntohl (mp->next_hop_out_label_stack[ii]);
985  }
986 
988  mp->is_add,
989  mp->is_drop,
990  mp->is_unreach,
991  mp->is_prohibit,
992  mp->is_local,
993  mp->is_classify,
995  mp->is_resolve_host,
997  fib_index, &pfx, 0,
998  &nh, ntohl (mp->next_hop_sw_if_index),
999  next_hop_fib_index,
1000  mp->next_hop_weight,
1001  ntohl (mp->next_hop_via_label),
1002  label_stack));
1003 }
1004 
1005 void
1007 {
1009  int rv;
1010  vnet_main_t *vnm = vnet_get_main ();
1011 
1012  vnm->api_errno = 0;
1013 
1014  if (mp->is_ipv6)
1015  rv = ip6_add_del_route_t_handler (mp);
1016  else
1017  rv = ip4_add_del_route_t_handler (mp);
1018 
1019  rv = (rv == 0) ? vnm->api_errno : rv;
1020 
1021  REPLY_MACRO (VL_API_IP_ADD_DEL_ROUTE_REPLY);
1022 }
1023 
1024 static int
1026  u32 table_id,
1027  u32 next_hop_sw_if_index,
1028  u8 is_local, u8 create_missing_tables, u32 * fib_index)
1029 {
1030  vnet_main_t *vnm = vnet_get_main ();
1031 
1032  *fib_index = mfib_table_find (table_proto, ntohl (table_id));
1033  if (~0 == *fib_index)
1034  {
1035  if (create_missing_tables)
1036  {
1037  *fib_index = mfib_table_find_or_create_and_lock (table_proto,
1038  ntohl (table_id));
1039  }
1040  else
1041  {
1042  /* No such VRF, and we weren't asked to create one */
1043  return VNET_API_ERROR_NO_SUCH_FIB;
1044  }
1045  }
1046 
1047  if (~0 != ntohl (next_hop_sw_if_index))
1048  {
1050  ntohl (next_hop_sw_if_index)))
1051  {
1052  return VNET_API_ERROR_NO_MATCHING_INTERFACE;
1053  }
1054  }
1055 
1056  return (0);
1057 }
1058 
1059 static int
1061  u8 is_local,
1062  u32 fib_index,
1063  const mfib_prefix_t * prefix,
1064  u32 entry_flags,
1065  u32 next_hop_sw_if_index, u32 itf_flags)
1066 {
1067  stats_dslock_with_hint (1 /* release hint */ , 2 /* tag */ );
1068 
1069  fib_route_path_t path = {
1070  .frp_sw_if_index = next_hop_sw_if_index,
1071  .frp_proto = prefix->fp_proto,
1072  };
1073 
1074  if (is_local)
1076 
1077 
1078  if (!is_local && ~0 == next_hop_sw_if_index)
1079  {
1080  mfib_table_entry_update (fib_index, prefix,
1081  MFIB_SOURCE_API, entry_flags);
1082  }
1083  else
1084  {
1085  if (is_add)
1086  {
1087  mfib_table_entry_path_update (fib_index, prefix,
1088  MFIB_SOURCE_API, &path, itf_flags);
1089  }
1090  else
1091  {
1092  mfib_table_entry_path_remove (fib_index, prefix,
1093  MFIB_SOURCE_API, &path);
1094  }
1095  }
1096 
1097  stats_dsunlock ();
1098  return (0);
1099 }
1100 
1101 static int
1103 {
1104  fib_protocol_t fproto;
1105  u32 fib_index;
1106  int rv;
1107 
1108  fproto = (mp->is_ipv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1109  rv = add_del_mroute_check (fproto,
1110  mp->table_id,
1112  mp->is_local,
1113  mp->create_vrf_if_needed, &fib_index);
1114 
1115  if (0 != rv)
1116  return (rv);
1117 
1118  mfib_prefix_t pfx = {
1119  .fp_len = ntohs (mp->grp_address_length),
1120  .fp_proto = fproto,
1121  };
1122 
1123  if (FIB_PROTOCOL_IP4 == fproto)
1124  {
1125  clib_memcpy (&pfx.fp_grp_addr.ip4, mp->grp_address,
1126  sizeof (pfx.fp_grp_addr.ip4));
1127  clib_memcpy (&pfx.fp_src_addr.ip4, mp->src_address,
1128  sizeof (pfx.fp_src_addr.ip4));
1129  }
1130  else
1131  {
1132  clib_memcpy (&pfx.fp_grp_addr.ip6, mp->grp_address,
1133  sizeof (pfx.fp_grp_addr.ip6));
1134  clib_memcpy (&pfx.fp_src_addr.ip6, mp->src_address,
1135  sizeof (pfx.fp_src_addr.ip6));
1136  }
1137 
1138  return (mroute_add_del_handler (mp->is_add,
1139  mp->is_local,
1140  fib_index, &pfx,
1141  ntohl (mp->entry_flags),
1142  ntohl (mp->next_hop_sw_if_index),
1143  ntohl (mp->itf_flags)));
1144 }
1145 
1146 void
1148 {
1150  int rv;
1151  vnet_main_t *vnm = vnet_get_main ();
1152 
1153  vnm->api_errno = 0;
1154 
1155  rv = api_mroute_add_del_t_handler (mp);
1156 
1157  rv = (rv == 0) ? vnm->api_errno : rv;
1158 
1159  REPLY_MACRO (VL_API_IP_MROUTE_ADD_DEL_REPLY);
1160 }
1161 
1162 static void
1164  unix_shared_memory_queue_t * q, u32 sw_if_index,
1165  u8 is_ipv6, u32 context)
1166 {
1167  vl_api_ip_details_t *mp;
1168 
1169  mp = vl_msg_api_alloc (sizeof (*mp));
1170  memset (mp, 0, sizeof (*mp));
1171  mp->_vl_msg_id = ntohs (VL_API_IP_DETAILS);
1172 
1173  mp->sw_if_index = ntohl (sw_if_index);
1174  mp->is_ipv6 = is_ipv6;
1175  mp->context = context;
1176 
1177  vl_msg_api_send_shmem (q, (u8 *) & mp);
1178 }
1179 
1180 static void
1183  u8 * ip, u16 prefix_length,
1184  u32 sw_if_index, u8 is_ipv6, u32 context)
1185 {
1187 
1188  mp = vl_msg_api_alloc (sizeof (*mp));
1189  memset (mp, 0, sizeof (*mp));
1190  mp->_vl_msg_id = ntohs (VL_API_IP_ADDRESS_DETAILS);
1191 
1192  if (is_ipv6)
1193  {
1194  clib_memcpy (&mp->ip, ip, sizeof (mp->ip));
1195  }
1196  else
1197  {
1198  u32 *tp = (u32 *) mp->ip;
1199  *tp = *(u32 *) ip;
1200  }
1201  mp->prefix_length = prefix_length;
1202  mp->context = context;
1203  mp->sw_if_index = htonl (sw_if_index);
1204  mp->is_ipv6 = is_ipv6;
1205 
1206  vl_msg_api_send_shmem (q, (u8 *) & mp);
1207 }
1208 
1209 static void
1211 {
1214  ip6_address_t *r6;
1215  ip4_address_t *r4;
1216  ip6_main_t *im6 = &ip6_main;
1217  ip4_main_t *im4 = &ip4_main;
1218  ip_lookup_main_t *lm6 = &im6->lookup_main;
1219  ip_lookup_main_t *lm4 = &im4->lookup_main;
1220  ip_interface_address_t *ia = 0;
1221  u32 sw_if_index = ~0;
1222  int rv __attribute__ ((unused)) = 0;
1223 
1224  VALIDATE_SW_IF_INDEX (mp);
1225 
1226  sw_if_index = ntohl (mp->sw_if_index);
1227 
1229  if (q == 0)
1230  return;
1231 
1232  if (mp->is_ipv6)
1233  {
1234  /* *INDENT-OFF* */
1235  foreach_ip_interface_address (lm6, ia, sw_if_index,
1236  1 /* honor unnumbered */,
1237  ({
1238  r6 = ip_interface_address_get_address (lm6, ia);
1239  u16 prefix_length = ia->address_length;
1240  send_ip_address_details(am, q, (u8*)r6, prefix_length,
1241  sw_if_index, 1, mp->context);
1242  }));
1243  /* *INDENT-ON* */
1244  }
1245  else
1246  {
1247  /* *INDENT-OFF* */
1248  foreach_ip_interface_address (lm4, ia, sw_if_index,
1249  1 /* honor unnumbered */,
1250  ({
1251  r4 = ip_interface_address_get_address (lm4, ia);
1252  u16 prefix_length = ia->address_length;
1253  send_ip_address_details(am, q, (u8*)r4, prefix_length,
1254  sw_if_index, 0, mp->context);
1255  }));
1256  /* *INDENT-ON* */
1257  }
1259 }
1260 
1261 static void
1263 {
1265  vnet_main_t *vnm = vnet_get_main ();
1269  vnet_sw_interface_t *si, *sorted_sis;
1270  u32 sw_if_index = ~0;
1271 
1273  if (q == 0)
1274  {
1275  return;
1276  }
1277 
1278  /* Gather interfaces. */
1279  sorted_sis = vec_new (vnet_sw_interface_t, pool_elts (im->sw_interfaces));
1280  _vec_len (sorted_sis) = 0;
1281  /* *INDENT-OFF* */
1282  pool_foreach (si, im->sw_interfaces,
1283  ({
1284  vec_add1 (sorted_sis, si[0]);
1285  }));
1286  /* *INDENT-ON* */
1287 
1288  vec_foreach (si, sorted_sis)
1289  {
1291  {
1292  if (mp->is_ipv6 && !ip6_interface_enabled (vm, si->sw_if_index))
1293  {
1294  continue;
1295  }
1296  sw_if_index = si->sw_if_index;
1297  send_ip_details (am, q, sw_if_index, mp->is_ipv6, mp->context);
1298  }
1299  }
1300 }
1301 
1302 static void
1304 {
1306  int rv = VNET_API_ERROR_UNIMPLEMENTED;
1307 
1308  clib_warning ("unimplemented...");
1309 
1310  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
1311 }
1312 
1313 static void
1315 {
1317  int rv;
1318  u32 table_id;
1319  flow_hash_config_t flow_hash_config = 0;
1320 
1321  table_id = ntohl (mp->vrf_id);
1322 
1323 #define _(a,b) if (mp->a) flow_hash_config |= b;
1325 #undef _
1326 
1327  rv = vnet_set_ip4_flow_hash (table_id, flow_hash_config);
1328 
1329  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
1330 }
1331 
1332 
1333 static void
1335 {
1336  if (mp->is_ipv6 == 0)
1337  set_ip4_flow_hash (mp);
1338  else
1339  set_ip6_flow_hash (mp);
1340 }
1341 
1342 static void
1345 {
1348  int rv = 0;
1349  u8 is_no, suppress, managed, other, ll_option, send_unicast, cease,
1350  default_router;
1351 
1352  is_no = mp->is_no == 1;
1353  suppress = mp->suppress == 1;
1354  managed = mp->managed == 1;
1355  other = mp->other == 1;
1356  ll_option = mp->ll_option == 1;
1357  send_unicast = mp->send_unicast == 1;
1358  cease = mp->cease == 1;
1359  default_router = mp->default_router == 1;
1360 
1361  VALIDATE_SW_IF_INDEX (mp);
1362 
1363  rv = ip6_neighbor_ra_config (vm, ntohl (mp->sw_if_index),
1364  suppress, managed, other,
1365  ll_option, send_unicast, cease,
1366  default_router, ntohl (mp->lifetime),
1367  ntohl (mp->initial_count),
1368  ntohl (mp->initial_interval),
1369  ntohl (mp->max_interval),
1370  ntohl (mp->min_interval), is_no);
1371 
1373 
1374  REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG_REPLY);
1375 }
1376 
1377 static void
1380 {
1383  int rv = 0;
1384  u8 is_no, use_default, no_advertise, off_link, no_autoconfig, no_onlink;
1385 
1386  VALIDATE_SW_IF_INDEX (mp);
1387 
1388  is_no = mp->is_no == 1;
1389  use_default = mp->use_default == 1;
1390  no_advertise = mp->no_advertise == 1;
1391  off_link = mp->off_link == 1;
1392  no_autoconfig = mp->no_autoconfig == 1;
1393  no_onlink = mp->no_onlink == 1;
1394 
1395  rv = ip6_neighbor_ra_prefix (vm, ntohl (mp->sw_if_index),
1396  (ip6_address_t *) mp->address,
1397  mp->address_length, use_default,
1398  ntohl (mp->val_lifetime),
1399  ntohl (mp->pref_lifetime), no_advertise,
1400  off_link, no_autoconfig, no_onlink, is_no);
1401 
1403  REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX_REPLY);
1404 }
1405 
1406 static void
1408  u32 context,
1409  const ip46_address_t * addr, u32 sw_if_index)
1410 {
1412 
1413  mp = vl_msg_api_alloc (sizeof (*mp));
1414  memset (mp, 0, sizeof (*mp));
1415  mp->_vl_msg_id = ntohs (VL_API_IP6ND_PROXY_DETAILS);
1416  mp->context = context;
1417  mp->sw_if_index = htonl (sw_if_index);
1418  memcpy (mp->address, addr, 16);
1419 
1420  vl_msg_api_send_shmem (q, (u8 *) & mp);
1421 }
1422 
1424 {
1427 
1428 static int
1430 {
1432 
1434  {
1435  vec_add1 (ctx->indices, fei);
1436  }
1437 
1438  return (1);
1439 }
1440 
1441 static void
1443 {
1444  ip6_main_t *im6 = &ip6_main;
1445  fib_table_t *fib_table;
1447  .indices = NULL,
1448  };
1449  fib_node_index_t *feip;
1450  fib_prefix_t pfx;
1452 
1454  if (q == 0)
1455  {
1456  return;
1457  }
1458 
1459  /* *INDENT-OFF* */
1460  pool_foreach (fib_table, im6->fibs,
1461  ({
1462  fib_table_walk(fib_table->ft_index,
1463  FIB_PROTOCOL_IP6,
1464  api_ip6nd_proxy_fib_table_walk,
1465  &ctx);
1466  }));
1467  /* *INDENT-ON* */
1468 
1470 
1471  vec_foreach (feip, ctx.indices)
1472  {
1473  fib_entry_get_prefix (*feip, &pfx);
1474 
1476  mp->context,
1477  &pfx.fp_addr,
1479  }
1480 
1481  vec_free (ctx.indices);
1482 }
1483 
1484 static void
1486 {
1488  int rv = 0;
1489 
1490  VALIDATE_SW_IF_INDEX (mp);
1491 
1492  rv = ip6_neighbor_proxy_add_del (ntohl (mp->sw_if_index),
1493  (ip6_address_t *) mp->address, mp->is_del);
1494 
1496  REPLY_MACRO (VL_API_IP6ND_PROXY_ADD_DEL_REPLY);
1497 }
1498 
1499 static void
1502 {
1505  vnet_main_t *vnm = vnet_get_main ();
1506  int rv = 0;
1507  clib_error_t *error;
1508 
1509  vnm->api_errno = 0;
1510 
1511  VALIDATE_SW_IF_INDEX (mp);
1512 
1513  error =
1514  (mp->enable == 1) ? enable_ip6_interface (vm,
1515  ntohl (mp->sw_if_index)) :
1516  disable_ip6_interface (vm, ntohl (mp->sw_if_index));
1517 
1518  if (error)
1519  {
1520  clib_error_report (error);
1521  rv = VNET_API_ERROR_UNSPECIFIED;
1522  }
1523  else
1524  {
1525  rv = vnm->api_errno;
1526  }
1527 
1529 
1530  REPLY_MACRO (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY);
1531 }
1532 
1533 static void
1536 {
1539  int rv = 0;
1540  clib_error_t *error;
1541  vnet_main_t *vnm = vnet_get_main ();
1542 
1543  vnm->api_errno = 0;
1544 
1545  VALIDATE_SW_IF_INDEX (mp);
1546 
1547  error = set_ip6_link_local_address (vm,
1548  ntohl (mp->sw_if_index),
1549  (ip6_address_t *) mp->address);
1550  if (error)
1551  {
1552  clib_error_report (error);
1553  rv = VNET_API_ERROR_UNSPECIFIED;
1554  }
1555  else
1556  {
1557  rv = vnm->api_errno;
1558  }
1559 
1561 
1562  REPLY_MACRO (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY);
1563 }
1564 
1565 void
1567  u32 context, const mfib_signal_t * mfs)
1568 {
1570  mfib_prefix_t prefix;
1571  mfib_table_t *mfib;
1572  mfib_itf_t *mfi;
1573 
1574  mp = vl_msg_api_alloc (sizeof (*mp));
1575 
1576  memset (mp, 0, sizeof (*mp));
1577  mp->_vl_msg_id = ntohs (VL_API_MFIB_SIGNAL_DETAILS);
1578  mp->context = context;
1579 
1580  mfi = mfib_itf_get (mfs->mfs_itf);
1581  mfib_entry_get_prefix (mfs->mfs_entry, &prefix);
1583  prefix.fp_proto);
1584  mp->table_id = ntohl (mfib->mft_table_id);
1585  mp->sw_if_index = ntohl (mfi->mfi_sw_if_index);
1586 
1587  if (FIB_PROTOCOL_IP4 == prefix.fp_proto)
1588  {
1589  mp->grp_address_len = ntohs (prefix.fp_len);
1590 
1591  memcpy (mp->grp_address, &prefix.fp_grp_addr.ip4, 4);
1592  if (prefix.fp_len > 32)
1593  {
1594  memcpy (mp->src_address, &prefix.fp_src_addr.ip4, 4);
1595  }
1596  }
1597  else
1598  {
1599  mp->grp_address_len = ntohs (prefix.fp_len);
1600 
1601  ASSERT (0);
1602  }
1603 
1604  if (0 != mfs->mfs_buffer_len)
1605  {
1606  mp->ip_packet_len = ntohs (mfs->mfs_buffer_len);
1607 
1608  memcpy (mp->ip_packet_data, mfs->mfs_buffer, mfs->mfs_buffer_len);
1609  }
1610  else
1611  {
1612  mp->ip_packet_len = 0;
1613  }
1614 
1615  vl_msg_api_send_shmem (q, (u8 *) & mp);
1616 }
1617 
1618 static void
1620 {
1622 
1624  if (q == 0)
1625  {
1626  return;
1627  }
1628 
1629  while (q->cursize < q->maxsize && mfib_signal_send_one (q, mp->context))
1630  ;
1631 }
1632 
1633 #define vl_msg_name_crc_list
1634 #include <vnet/ip/ip.api.h>
1635 #undef vl_msg_name_crc_list
1636 
1637 static void
1639 {
1640 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1641  foreach_vl_msg_name_crc_ip;
1642 #undef _
1643 }
1644 
1645 static clib_error_t *
1647 {
1648  api_main_t *am = &api_main;
1649 
1650 #define _(N,n) \
1651  vl_msg_api_set_handlers(VL_API_##N, #n, \
1652  vl_api_##n##_t_handler, \
1653  vl_noop_handler, \
1654  vl_api_##n##_t_endian, \
1655  vl_api_##n##_t_print, \
1656  sizeof(vl_api_##n##_t), 1);
1658 #undef _
1659 
1660  /*
1661  * Set up the (msg_name, crc, message-id) table
1662  */
1664 
1665  return 0;
1666 }
1667 
1669 
1670 /*
1671  * fd.io coding-style-patch-verification: ON
1672  *
1673  * Local Variables:
1674  * eval: (c-set-style "gnu")
1675  * End:
1676  */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:436
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
Definition: lookup.h:417
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:169
#define VNET_SW_INTERFACE_FLAG_UNNUMBERED
Definition: interface.h:543
static int mroute_add_del_handler(u8 is_add, u8 is_local, u32 fib_index, const mfib_prefix_t *prefix, u32 entry_flags, u32 next_hop_sw_if_index, u32 itf_flags)
Definition: ip_api.c:1060
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1466
fib_protocol_t frp_proto
The protocol of the address below.
Definition: fib_types.h:313
void ip_null_dpo_add_and_lock(dpo_proto_t proto, ip_null_dpo_action_t action, dpo_id_t *dpo)
Definition: ip_null_dpo.c:78
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:322
ip46_address_t fp_src_addr
Definition: mfib_types.h:47
static void vl_api_ip6nd_proxy_add_del_t_handler(vl_api_ip6nd_proxy_add_del_t *mp)
Definition: ip_api.c:1485
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
Definition: receive_dpo.c:56
A representation of a fib path for fib_path_encode to convey the information to the caller...
Definition: fib_types.h:358
int vnet_set_ip4_flow_hash(u32 table_id, flow_hash_config_t flow_hash_config)
Definition: ip4_forward.c:2997
u8 next_hop[16]
Definition: ip.api:52
Dump IP neighboors.
Definition: ip.api:104
Dump IP fib table.
Definition: ip.api:25
a
Definition: bitmap.h:516
vl_api_fib_path_t path[count]
Definition: ip.api:525
vl_api_fib_path_t path[count]
Definition: ip.api:69
int ip6_neighbor_ra_prefix(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *prefix_addr, u8 prefix_len, u8 use_default, u32 val_lifetime, u32 pref_lifetime, u8 no_advertise, u8 off_link, u8 no_autoconfig, u8 no_onlink, u8 is_no)
A representation of a path as described by a route producer.
Definition: fib_types.h:308
static void vl_api_ip_neighbor_add_del_t_handler(vl_api_ip_neighbor_add_del_t *mp, vlib_main_t *vm)
Definition: ip_api.c:636
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static void send_ip6_mfib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, mfib_prefix_t *pfx, fib_route_path_encode_t *api_rpaths, u32 context)
Definition: ip_api.c:532
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
vnet_interface_main_t interface_main
Definition: vnet.h:57
IP FIB table response.
Definition: ip.api:62
The table that stores ALL routes learned by the DP.
Definition: ip6.h:125
u8 as_u8[16]
Definition: ip6_packet.h:48
A pair of indicies, for the entry and interface resp.
Definition: mfib_signal.h:29
void fib_entry_get_prefix(fib_node_index_t fib_entry_index, fib_prefix_t *pfx)
Definition: fib_entry.c:1456
Dump IP multicast fib table.
Definition: ip.api:503
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
Definition: fib_table.c:667
#define NULL
Definition: clib.h:55
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
Definition: fib_table.c:511
ip6_neighbor_t * ip6_neighbors_entries(u32 sw_if_index)
Definition: ip6_neighbor.c:783
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
#define IP_NULL_DPO_ACTION_NUM
Definition: ip_null_dpo.h:48
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
int ip6_neighbor_proxy_add_del(u32 sw_if_index, ip6_address_t *addr, u8 is_del)
ip_lookup_main_t lookup_main
Definition: ip4.h:109
IPv6 router advertisement config request.
Definition: ip.api:216
int add_del_route_check(fib_protocol_t table_proto, u32 table_id, u32 next_hop_sw_if_index, fib_protocol_t next_hop_table_proto, u32 next_hop_table_id, u8 create_missing_tables, u32 *fib_index, u32 *next_hop_fib_index)
Definition: ip_api.c:831
static void send_ip6nd_proxy_details(unix_shared_memory_queue_t *q, u32 context, const ip46_address_t *addr, u32 sw_if_index)
Definition: ip_api.c:1407
struct api_ip6nd_proxy_fib_table_walk_ctx_t_ api_ip6nd_proxy_fib_table_walk_ctx_t
static void vl_api_ip6nd_proxy_dump_t_handler(vl_api_ip6nd_proxy_dump_t *mp)
Definition: ip_api.c:1442
static void api_ip6_fib_table_put_entries(clib_bihash_kv_24_8_t *kvp, void *arg)
Definition: ip_api.c:363
Dump IP6 fib table.
Definition: ip.api:75
int mfib_signal_send_one(struct _unix_shared_memory_queue *q, u32 context)
Definition: mfib_signal.c:94
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static int add_del_mroute_check(fib_protocol_t table_proto, u32 table_id, u32 next_hop_sw_if_index, u8 is_local, u8 create_missing_tables, u32 *fib_index)
Definition: ip_api.c:1025
static void vl_api_ip_mfib_dump_t_handler(vl_api_ip_mfib_dump_t *mp)
Definition: ip_api.c:485
api_main_t api_main
Definition: api_shared.c:35
ip6_neighbor_flags_t flags
Definition: ip6_neighbor.h:42
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:376
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:334
Dump IP6 multicast fib table.
Definition: ip.api:531
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a &#39;special&#39; entry from the FIB.
Definition: fib_table.c:388
vl_api_fib_path_t path[count]
Definition: ip.api:553
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
Definition: vec.h:310
static BVT(clib_bihash)
Definition: adj_nbr.c:26
Recursion constraint of via a host prefix.
Definition: fib_types.h:276
static void vl_api_ip6_mfib_dump_t_handler(vl_api_ip6_mfib_dump_t *mp)
Definition: ip_api.c:589
fib_node_index_t mfib_table_entry_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, mfib_entry_flags_t entry_flags)
Add a new (with no replication) or lock an existing entry.
Definition: mfib_table.c:165
int vnet_set_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *a, u8 *link_layer_address, uword n_bytes_link_layer_address, int is_static, int is_no_fib_entry)
Definition: ip6_neighbor.c:569
Aggregrate type for a prefix.
Definition: fib_types.h:160
int ip6_interface_enabled(vlib_main_t *vm, u32 sw_if_index)
static void vl_api_ip_dump_t_handler(vl_api_ip_dump_t *mp)
Definition: ip_api.c:1262
struct vl_api_ip_mfib_dump_ctc_t_ vl_api_ip_mfib_dump_ctc_t
static int ip6_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
Definition: ip_api.c:948
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath, mfib_itf_flags_t itf_flags)
Add n paths to an entry (aka route) in the FIB.
Definition: mfib_table.c:216
IPv6 interface enable / disable request.
Definition: ip.api:358
enum fib_route_path_flags_t_ fib_route_path_flags_t
Path flags from the control plane.
static void send_ip_address_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u8 *ip, u16 prefix_length, u32 sw_if_index, u8 is_ipv6, u32 context)
Definition: ip_api.c:1181
struct mfib_table_t_ * mfibs
Vector of MFIBs.
Definition: ip4.h:115
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:938
static void send_ip_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 sw_if_index, u8 is_ipv6, u32 context)
Definition: ip_api.c:1163
u16 fp_len
The mask length.
Definition: fib_types.h:164
static void vl_api_mfib_signal_dump_t_handler(vl_api_mfib_signal_dump_t *mp)
Definition: ip_api.c:1619
int fib_entry_cmp_for_sort(void *i1, void *i2)
Definition: fib_entry.c:1408
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg)
Control Plane hook to remove an ARP entry.
Definition: arp.c:1525
u32 mfib_entry_get_fib_index(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1082
Definition: fib_entry.h:227
vnet_api_error_t api_errno
Definition: vnet.h:77
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:146
static int vl_api_ip6_mfib_table_dump_walk(fib_node_index_t fei, void *arg)
Definition: ip_api.c:579
Definition: fib_entry.h:231
static mfib_itf_t * mfib_itf_get(index_t mi)
Definition: mfib_itf.h:53
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:183
index_t classify_dpo_create(dpo_proto_t proto, u32 classify_table_index)
Definition: classify_dpo.c:43
dpo_type_t dpoi_type
the type
Definition: dpo.h:150
ip4_address_t ip4_address
Definition: arp_packet.h:153
int vnet_unset_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *a, u8 *link_layer_address, uword n_bytes_link_layer_address)
Definition: ip6_neighbor.c:713
u8 ethernet_address[6]
Definition: arp_packet.h:155
static void vl_api_sw_interface_ip6nd_ra_prefix_t_handler(vl_api_sw_interface_ip6nd_ra_prefix_t *mp)
Definition: ip_api.c:1379
IP6 Multicast FIB table response.
Definition: ip.api:545
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
Definition: fib_table.c:555
vl_api_fib_path_t path[count]
Definition: ip.api:95
IPv6 router advertisement prefix config response.
Definition: ip.api:296
#define REPLY_MACRO(t)
static int api_ip6nd_proxy_fib_table_walk(fib_node_index_t fei, void *arg)
Definition: ip_api.c:1429
Recursion constraint of via an attahced prefix.
Definition: fib_types.h:280
u32 index
Definition: ip6.h:73
fib_node_index_t * entries
Definition: ip_api.c:359
VLIB_API_INIT_FUNCTION(ip_api_hookup)
static void vl_api_sw_interface_ip6_enable_disable_t_handler(vl_api_sw_interface_ip6_enable_disable_t *mp)
Definition: ip_api.c:1501
static void vl_api_set_ip_flow_hash_t_handler(vl_api_set_ip_flow_hash_t *mp)
Definition: ip_api.c:1334
static void send_ip_mfib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, mfib_prefix_t *pfx, fib_route_path_encode_t *api_rpaths, u32 context)
Definition: ip_api.c:428
void stats_dsunlock(void)
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
Definition: fib_entry.c:1321
#define ip46_address_is_ip4(ip46)
Definition: ip6_packet.h:76
void clib_bihash_foreach_key_value_pair(clib_bihash *h, void *callback, void *arg)
Visit active (key,value) pairs in a bi-hash table.
Reply for add / del mroute request.
Definition: ip.api:494
#define BAD_SW_IF_INDEX_LABEL
struct vl_api_ip6_mfib_dump_ctc_t_ vl_api_ip6_mfib_dump_ctc_t
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
Set the ip flow hash config for a fib request.
Definition: ip.api:175
fib_node_index_t fib_table_entry_special_dpo_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Update a &#39;special&#39; entry to the FIB that links to the DPO passed A special entry is an entry that the...
Definition: fib_table.c:327
void * vl_msg_api_alloc(int nbytes)
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:56
vlib_main_t * vm
Definition: buffer.c:276
#define MPLS_LABEL_INVALID
Definition: mpls_types.h:33
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:340
void copy_fib_next_hop(fib_route_path_encode_t *api_rpath, void *fp_arg)
Definition: ip_api.c:154
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:798
Definition: ip6.h:67
u32 frp_weight
[un]equal cost path weight
Definition: fib_types.h:343
#define clib_warning(format, args...)
Definition: error.h:59
fib_node_index_t * entries
Definition: ip_api.c:575
IPv6 interface enable / disable response.
Definition: ip.api:370
#define clib_memcpy(a, b, c)
Definition: string.h:69
static void send_ip_fib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, fib_prefix_t *pfx, fib_route_path_encode_t *api_rpaths, u32 context)
Definition: ip_api.c:180
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
Reply for IP Neighbor add / delete request.
Definition: ip.api:157
static void set_ip6_flow_hash(vl_api_set_ip_flow_hash_t *mp)
Definition: ip_api.c:1303
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:238
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:157
u32 sw_if_index
Definition: ip.api:45
clib_error_t * enable_ip6_interface(vlib_main_t *vm, u32 sw_if_index)
Aggregrate type for a prefix.
Definition: mfib_types.h:24
struct _vnet_classify_main vnet_classify_main_t
Definition: vnet_classify.h:69
#define foreach_flow_hash_bit
Definition: lookup.h:154
void vl_api_ip_mroute_add_del_t_handler(vl_api_ip_mroute_add_del_t *mp)
Definition: ip_api.c:1147
IP neighbor add / del request.
Definition: ip.api:139
void mfib_entry_get_prefix(fib_node_index_t mfib_entry_index, mfib_prefix_t *pfx)
Definition: mfib_entry.c:1072
#define ASSERT(truth)
IPv6 router advertisement config response.
Definition: ip.api:240
unsigned int u32
Definition: types.h:88
static int api_mroute_add_del_t_handler(vl_api_ip_mroute_add_del_t *mp)
Definition: ip_api.c:1102
IPv6 ND proxy response.
Definition: ip.api:322
IP Multicast FIB table response.
Definition: ip.api:517
ip6_address_t ip6_address
Definition: ip6_neighbor.h:26
ip6_main_t ip6_main
Definition: ip6_forward.c:2846
ip_lookup_main_t lookup_main
Definition: ip6.h:151
index_t mfs_itf
Definition: mfib_signal.h:32
fib_node_index_t * entries
Definition: ip_api.c:471
static int vl_api_ip_mfib_table_dump_walk(fib_node_index_t fei, void *arg)
Definition: ip_api.c:475
static int ip4_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
Definition: ip_api.c:889
FIB path.
Definition: ip.api:43
Reply for add / del route request.
Definition: ip.api:459
IPv6 router advertisement prefix config request.
Definition: ip.api:275
IPv6 ND proxy details returned after request.
Definition: ip.api:332
IPv4 main type.
Definition: ip4.h:107
static void set_ip4_flow_hash(vl_api_set_ip_flow_hash_t *mp)
Definition: ip_api.c:1314
An interface associated with a particular MFIB entry.
Definition: mfib_itf.h:25
IPv6 ND proxy dump request.
Definition: ip.api:346
fib_route_path_flags_t frp_flags
flags on the path
Definition: fib_types.h:347
struct mfib_table_t_ * mfibs
Vector of MFIBs.
Definition: ip6.h:157
#define clib_error_report(e)
Definition: error.h:125
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:954
vnet_classify_main_t vnet_classify_main
Definition: vnet_classify.c:22
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:220
u32 mft_table_id
Table ID (hash key) for this FIB.
Definition: mfib_table.h:55
From the control plane API.
Definition: fib_entry.h:58
static void send_ip6_fib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, fib_prefix_t *pfx, fib_route_path_encode_t *api_rpaths, u32 context)
Definition: ip_api.c:293
void stats_dslock_with_hint(int hint, int tag)
ethernet_arp_entry_flags_t flags
Definition: arp_packet.h:157
static clib_error_t * ip_api_hookup(vlib_main_t *vm)
Definition: ip_api.c:1646
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
Definition: lookup.h:165
static void vl_api_ip_fib_dump_t_handler(vl_api_ip_fib_dump_t *mp)
Definition: ip_api.c:244
ip6_fib_table_instance_t ip6_table[IP6_FIB_NUM_TABLES]
The two FIB tables; fwding and non-fwding.
Definition: ip6.h:149
IP neighboors dump response.
Definition: ip.api:117
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
void fib_entry_encode(fib_node_index_t fib_entry_index, fib_route_path_encode_t **api_rpaths)
Definition: fib_entry.c:1443
mpls_label_t frp_local_label
The MPLS local Label to reursively resolve through.
Definition: fib_types.h:328
Add / del route request.
Definition: ip.api:425
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
static void setup_message_id_table(api_main_t *am)
Definition: ip_api.c:1638
unsigned short u16
Definition: types.h:57
ip6_fib_t v6
Definition: fib_table.h:39
u32 mfib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: mfib_table.c:420
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:162
mfib_table_t * mfib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
Definition: mfib_table.c:26
ip6_neighbor_key_t key
Definition: ip6_neighbor.h:40
A for-us/local path.
Definition: fib_types.h:284
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
u32 mfib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: mfib_table.c:403
IPv6 ND proxy config.
Definition: ip.api:309
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:960
int ip6_neighbor_ra_config(vlib_main_t *vm, u32 sw_if_index, u8 suppress, u8 managed, u8 other, u8 ll_option, u8 send_unicast, u8 cease, u8 use_lifetime, u32 lifetime, u32 initial_count, u32 initial_interval, u32 max_interval, u32 min_interval, u8 is_no)
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:617
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:173
u32 next_hop_out_label_stack[next_hop_n_out_labels]
Definition: ip.api:452
u8 mfs_buffer[MFIB_SIGNAL_BUFFER_SIZE]
A buffer copied from the DP plane that triggered the signal.
Definition: mfib_signal.h:37
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
Definition: fib_table.c:27
clib_error_t * set_ip6_link_local_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address)
static void vl_api_sw_interface_ip6nd_ra_config_t_handler(vl_api_sw_interface_ip6nd_ra_config_t *mp)
Definition: ip_api.c:1344
u32 client_index
Definition: ip.api:583
int add_del_route_t_handler(u8 is_multipath, u8 is_add, u8 is_drop, u8 is_unreach, u8 is_prohibit, u8 is_local, u8 is_classify, u32 classify_table_index, u8 is_resolve_host, u8 is_resolve_attached, u32 fib_index, const fib_prefix_t *prefix, u8 next_hop_proto_is_ip4, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u8 next_hop_fib_index, u32 next_hop_weight, mpls_label_t next_hop_via_label, mpls_label_t *next_hop_out_label_stack)
Definition: ip_api.c:689
u32 mfi_sw_if_index
The SW IF index that this MFIB interface represents.
Definition: mfib_itf.h:35
A protocol Independent IP multicast FIB table.
Definition: mfib_table.h:29
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1117
IP6 FIB table response.
Definition: ip.api:88
struct fib_table_t_ * fibs
Vector of FIBs.
Definition: ip4.h:112
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:194
#define vec_foreach(var, vec)
Vector iterator.
fib_route_path_t rpath
Definition: fib_types.h:359
static void vl_api_sw_interface_ip6_set_link_local_address_t_handler(vl_api_sw_interface_ip6_set_link_local_address_t *mp)
Definition: ip_api.c:1535
static void vl_api_ip_address_dump_t_handler(vl_api_ip_address_dump_t *mp)
Definition: ip_api.c:1210
ethernet_arp_ip4_entry_t * ip4_neighbor_entries(u32 sw_if_index)
Definition: arp.c:1366
vhost_vring_addr_t addr
Definition: vhost-user.h:84
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg, int is_static, int is_no_fib_entry)
Definition: arp.c:1871
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
Definition: lookup.h:410
static void send_ip_neighbor_details(u8 is_ipv6, u8 is_static, u8 *mac_address, u8 *ip_address, unix_shared_memory_queue_t *q, u32 context)
Definition: ip_api.c:85
static void api_ip6_fib_table_get_all(unix_shared_memory_queue_t *q, vl_api_ip6_fib_dump_t *mp, fib_table_t *fib_table)
Definition: ip_api.c:374
struct apt_ip6_fib_show_ctx_t_ api_ip6_fib_show_ctx_t
u16 fp_len
The mask length.
Definition: mfib_types.h:28
void vl_mfib_signal_send_one(unix_shared_memory_queue_t *q, u32 context, const mfib_signal_t *mfs)
Definition: ip_api.c:1566
void mfib_table_entry_path_remove(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
Definition: mfib_table.c:247
clib_error_t * disable_ip6_interface(vlib_main_t *vm, u32 sw_if_index)
fib_node_index_t mfs_entry
Definition: mfib_signal.h:31
Add / del route request.
Definition: ip.api:473
vpe_api_main_t vpe_api_main
Definition: api.c:161
void vl_api_ip_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
Definition: ip_api.c:1006
struct fib_table_t_ * fibs
Definition: ip6.h:154
Definition: dpo.h:98
u8 link_layer_address[8]
Definition: ip6_neighbor.h:41
#define foreach_ip_api_msg
Definition: ip_api.c:60
const ip46_address_t zero_addr
Definition: lookup.c:354
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
Definition: mfib_types.h:46
u8 is_prohibit
Definition: ip.api:50
static void vl_api_ip6_fib_dump_t_handler(vl_api_ip6_fib_dump_t *mp)
Definition: ip_api.c:409
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.
Definition: fib_table.h:29
Definition: arp_packet.h:150
Set the ip flow hash config for a fib response.
Definition: ip.api:193
IPv6 Proxy ND.
Definition: fib_entry.h:86
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static void vl_api_ip_neighbor_dump_t_handler(vl_api_ip_neighbor_dump_t *mp)
Definition: ip_api.c:106
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:109