FD.io VPP  v21.10.1-2-g0a485f517
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>
27 #include <vnet/ip/ip.h>
28 #include <vnet/ip/ip_types_api.h>
29 #include <vnet/ip/ip_punt_drop.h>
30 #include <vnet/ip/ip_types_api.h>
31 #include <vnet/ip/ip_path_mtu.h>
32 #include <vnet/fib/fib_table.h>
33 #include <vnet/fib/fib_api.h>
35 #include <vnet/mfib/ip6_mfib.h>
36 #include <vnet/mfib/ip4_mfib.h>
37 #include <vnet/mfib/mfib_signal.h>
38 #include <vnet/mfib/mfib_entry.h>
39 #include <vnet/mfib/mfib_api.h>
41 #include <vnet/fib/fib_path_list.h>
42 #include <vnet/ip/ip6_hop_by_hop.h>
43 #include <vnet/ip/ip6_link.h>
48 #include <vnet/ip/ip_table.h>
50 
51 #include <vnet/format_fns.h>
52 #include <vnet/ip/ip.api_enum.h>
53 #include <vnet/ip/ip.api_types.h>
54 
55 #define REPLY_MSG_ID_BASE ip4_main.msg_id_base
57 
58 static void
61 {
62  vl_api_sw_interface_ip6_enable_disable_reply_t *rmp;
63  int rv = 0;
64 
66 
67  rv = ((mp->enable == 1) ?
68  ip6_link_enable (ntohl (mp->sw_if_index), NULL) :
69  ip6_link_disable (ntohl (mp->sw_if_index)));
70 
72 
73  REPLY_MACRO (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY);
74 }
75 
76 static void
79  u32 context, const fib_table_t * table)
80 {
82 
83  mp = vl_msg_api_alloc (sizeof (*mp));
84  if (!mp)
85  return;
86  clib_memset (mp, 0, sizeof (*mp));
87  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_TABLE_DETAILS);
88  mp->context = context;
89 
90  mp->table.is_ip6 = (table->ft_proto == FIB_PROTOCOL_IP6);
91  mp->table.table_id = htonl (table->ft_table_id);
92  memcpy (mp->table.name, table->ft_desc,
93  clib_min (vec_len (table->ft_desc), sizeof (mp->table.name)));
94 
95  vl_api_send_msg (reg, (u8 *) mp);
96 }
97 
98 static void
100 {
103  fib_table_t *fib_table;
104 
106  if (!reg)
107  return;
108 
109  /* *INDENT-OFF* */
110  pool_foreach (fib_table, ip4_main.fibs)
111  {
112  send_ip_table_details(am, reg, mp->context, fib_table);
113  }
114  pool_foreach (fib_table, ip6_main.fibs)
115  {
116  /* don't send link locals */
117  if (fib_table->ft_flags & FIB_TABLE_FLAG_IP6_LL)
118  continue;
119  send_ip_table_details(am, reg, mp->context, fib_table);
120  }
121  /* *INDENT-ON* */
122 }
123 
125 {
128 
129 static fib_table_walk_rc_t
131 {
133 
134  vec_add1 (ctx->feis, fei);
135 
136  return (FIB_TABLE_WALK_CONTINUE);
137 }
138 
139 static void
141  vl_api_registration_t * reg,
142  u32 context, fib_node_index_t fib_entry_index)
143 {
144  fib_route_path_t *rpaths, *rpath;
146  const fib_prefix_t *pfx;
147  vl_api_fib_path_t *fp;
148  int path_count;
149 
150  rpaths = NULL;
151  pfx = fib_entry_get_prefix (fib_entry_index);
152  rpaths = fib_entry_encode (fib_entry_index);
153 
154  path_count = vec_len (rpaths);
155  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
156  if (!mp)
157  return;
158  clib_memset (mp, 0, sizeof (*mp));
159  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_ROUTE_DETAILS);
160  mp->context = context;
161 
162  ip_prefix_encode (pfx, &mp->route.prefix);
163  mp->route.table_id =
165  (fib_entry_get_fib_index (fib_entry_index), pfx->fp_proto));
166  mp->route.n_paths = path_count;
167  mp->route.stats_index =
169  (fib_entry_get_fib_index (fib_entry_index), pfx));
170 
171  fp = mp->route.paths;
172  vec_foreach (rpath, rpaths)
173  {
174  fib_api_path_encode (rpath, fp);
175  fp++;
176  }
177 
178  vl_api_send_msg (reg, (u8 *) mp);
179  vec_free (rpaths);
180 }
181 
182 static void
184  u32 context, fib_node_index_t fib_entry_index)
185 {
186  fib_route_path_t *rpaths, *rpath;
188  const fib_prefix_t *pfx;
189  vl_api_fib_path_t *fp;
190  int path_count;
191 
192  rpaths = NULL;
193  pfx = fib_entry_get_prefix (fib_entry_index);
194  rpaths = fib_entry_encode (fib_entry_index);
195 
196  path_count = vec_len (rpaths);
197  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
198  if (!mp)
199  return;
200  clib_memset (mp, 0, sizeof (*mp));
201  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_ROUTE_V2_DETAILS);
202  mp->context = context;
203 
204  ip_prefix_encode (pfx, &mp->route.prefix);
205  mp->route.table_id = htonl (fib_table_get_table_id (
206  fib_entry_get_fib_index (fib_entry_index), pfx->fp_proto));
207  mp->route.n_paths = path_count;
208  mp->route.src = fib_entry_get_best_source (fib_entry_index);
209  mp->route.stats_index = htonl (fib_table_entry_get_stats_index (
210  fib_entry_get_fib_index (fib_entry_index), pfx));
211 
212  fp = mp->route.paths;
213  vec_foreach (rpath, rpaths)
214  {
215  fib_api_path_encode (rpath, fp);
216  fp++;
217  }
218 
219  vl_api_send_msg (reg, (u8 *) mp);
220  vec_free (rpaths);
221 }
222 
224 {
227 
228 static void
230 {
232  fib_node_index_t *fib_entry_index;
234  fib_protocol_t fproto;
235  u32 fib_index;
236 
238  if (!reg)
239  return;
240 
242  .feis = NULL,
243  };
244 
245  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
246  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
247 
248  if (INDEX_INVALID == fib_index)
249  return;
250 
251  fib_table_walk (fib_index, fproto, vl_api_ip_fib_dump_walk, &ctx);
252 
253  vec_foreach (fib_entry_index, ctx.feis)
254  {
255  send_ip_route_details (am, reg, mp->context, *fib_entry_index);
256  }
257 
258  vec_free (ctx.feis);
259 }
260 
261 static void
263 {
265  fib_node_index_t *fib_entry_index;
267  fib_protocol_t fproto;
269  u32 fib_index;
270 
272  if (!reg)
273  return;
274 
276  .feis = NULL,
277  };
278 
279  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
280  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
281  src = mp->src;
282 
283  if (INDEX_INVALID == fib_index)
284  return;
285 
286  if (src)
287  fib_table_walk_w_src (fib_index, fproto, src, vl_api_ip_fib_dump_walk,
288  &ctx);
289  else
290  fib_table_walk (fib_index, fproto, vl_api_ip_fib_dump_walk, &ctx);
291 
292  vec_foreach (fib_entry_index, ctx.feis)
293  {
294  send_ip_route_v2_details (am, reg, mp->context, *fib_entry_index);
295  }
296 
297  vec_free (ctx.feis);
298 }
299 
300 static void
302  u32 context, const mfib_table_t * mfib_table)
303 {
305 
306  mp = vl_msg_api_alloc (sizeof (*mp));
307  if (!mp)
308  return;
309  memset (mp, 0, sizeof (*mp));
310  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_MTABLE_DETAILS);
311  mp->context = context;
312 
313  mp->table.table_id = htonl (mfib_table->mft_table_id);
314  mp->table.is_ip6 = (FIB_PROTOCOL_IP6 == mfib_table->mft_proto);
315 
316  vl_api_send_msg (reg, (u8 *) mp);
317 }
318 
319 static void
321 {
323  mfib_table_t *mfib_table;
324 
326  if (!reg)
327  return;
328 
329  /* *INDENT-OFF* */
330  pool_foreach (mfib_table, ip4_main.mfibs)
331  {
332  send_ip_mtable_details (reg, mp->context, mfib_table);
333  }
334  pool_foreach (mfib_table, ip6_main.mfibs)
335  {
336  send_ip_mtable_details (reg, mp->context, mfib_table);
337  }
338  /* *INDENT-ON* */
339 }
340 
342 {
345 
346 static walk_rc_t
348 {
350 
351  vec_add1 (ctx->entries, fei);
352 
353  return (WALK_CONTINUE);
354 }
355 
356 static void
358  vl_api_registration_t * reg,
359  u32 context, fib_node_index_t mfib_entry_index)
360 {
361  fib_route_path_t *rpaths, *rpath;
363  const mfib_prefix_t *pfx;
364  vl_api_mfib_path_t *fp;
365  u8 path_count;
366 
367  rpaths = NULL;
368  pfx = mfib_entry_get_prefix (mfib_entry_index);
369  rpaths = mfib_entry_encode (mfib_entry_index);
370 
371  path_count = vec_len (rpaths);
372  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
373  if (!mp)
374  return;
375  clib_memset (mp, 0, sizeof (*mp));
376  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_MROUTE_DETAILS);
377  mp->context = context;
378 
379  ip_mprefix_encode (pfx, &mp->route.prefix);
380  mp->route.table_id =
382  (mfib_entry_get_fib_index (mfib_entry_index), pfx->fp_proto));
383  mp->route.n_paths = path_count;
384  fp = mp->route.paths;
385  vec_foreach (rpath, rpaths)
386  {
387  mfib_api_path_encode (rpath, fp);
388  fp++;
389  }
390 
391  vl_api_send_msg (reg, (u8 *) mp);
392  vec_free (rpaths);
393 }
394 
395 static void
397 {
400  fib_node_index_t *mfeip;
401  fib_protocol_t fproto;
402  u32 fib_index;
403 
405  .entries = NULL,
406  };
407 
409  if (!reg)
410  return;
411 
412  fproto = fib_ip_proto (mp->table.is_ip6);
413  fib_index = mfib_table_find (fproto, ntohl (mp->table.table_id));
414 
415  if (INDEX_INVALID == fib_index)
416  return;
417 
418  mfib_table_walk (fib_index, fproto, mfib_route_dump_walk, &ctx);
419 
421 
422  vec_foreach (mfeip, ctx.entries)
423  {
424  send_ip_mroute_details (am, reg, mp->context, *mfeip);
425  }
426 
427  vec_free (ctx.entries);
428 }
429 
430 static void
432  vlib_main_t * vm)
433 {
434  vl_api_ip_punt_police_reply_t *rmp;
435  int rv = 0;
436 
437  if (mp->is_ip6)
438  ip6_punt_policer_add_del (mp->is_add, ntohl (mp->policer_index));
439  else
440  ip4_punt_policer_add_del (mp->is_add, ntohl (mp->policer_index));
441 
442  REPLY_MACRO (VL_API_IP_PUNT_POLICE_REPLY);
443 }
444 
445 static void
446 ip_punt_redirect_t_handler_common (u8 is_add, u32 rx_sw_if_index,
448  const fib_route_path_t *rpaths)
449 {
450  if (is_add)
451  {
452  if (af == AF_IP6)
453  ip6_punt_redirect_add_paths (rx_sw_if_index, rpaths);
454  else if (af == AF_IP4)
455  ip4_punt_redirect_add_paths (rx_sw_if_index, rpaths);
456  }
457  else
458  {
459  if (af == AF_IP6)
460  ip6_punt_redirect_del (rx_sw_if_index);
461  else if (af == AF_IP4)
462  ip4_punt_redirect_del (rx_sw_if_index);
463  }
464 }
465 
466 static void
468  vlib_main_t *vm)
469 {
470  vl_api_ip_punt_redirect_reply_t *rmp;
471  fib_route_path_t *rpaths = NULL, rpath = {
472  .frp_weight = 1,
473  .frp_fib_index = ~0,
474  };
476  ip46_type_t ipv;
477  u32 rx_sw_if_index;
478  int rv = 0;
479 
480  if (!vnet_sw_if_index_is_api_valid (ntohl (mp->punt.tx_sw_if_index)))
481  goto bad_sw_if_index;
482 
483  ipv = ip_address_decode (&mp->punt.nh, &rpath.frp_addr);
484  af = (ipv == IP46_TYPE_IP6) ? AF_IP6 : AF_IP4;
485  rpath.frp_proto = (ipv == IP46_TYPE_IP6) ? DPO_PROTO_IP6 : DPO_PROTO_IP4;
486  rpath.frp_sw_if_index = ntohl (mp->punt.tx_sw_if_index);
487  rx_sw_if_index = ntohl (mp->punt.rx_sw_if_index);
488 
489  vec_add1 (rpaths, rpath);
490  ip_punt_redirect_t_handler_common (mp->is_add, rx_sw_if_index, af, rpaths);
491  vec_free (rpaths);
492 
494 
495  REPLY_MACRO (VL_API_IP_PUNT_REDIRECT_REPLY);
496 }
497 
498 static void
501 {
502  vl_api_add_del_ip_punt_redirect_v2_reply_t *rmp;
503  fib_route_path_t *rpaths = NULL, *rpath;
504  vl_api_fib_path_t *apath;
506  u32 rx_sw_if_index, n_paths;
507  int rv = 0, ii;
508 
509  rx_sw_if_index = ntohl (mp->punt.rx_sw_if_index);
510  n_paths = ntohl (mp->punt.n_paths);
511 
512  rv = ip_address_family_decode (mp->punt.af, &af);
513  if (rv != 0)
514  goto out;
515 
516  if (0 != n_paths)
517  vec_validate (rpaths, n_paths - 1);
518 
519  for (ii = 0; ii < n_paths; ii++)
520  {
521  apath = &mp->punt.paths[ii];
522  rpath = &rpaths[ii];
523 
524  rv = fib_api_path_decode (apath, rpath);
525 
526  if (rv != 0)
527  goto out;
528  }
529 
530  ip_punt_redirect_t_handler_common (mp->is_add, rx_sw_if_index, af, rpaths);
531 
532 out:
533  vec_free (rpaths);
534 
535  REPLY_MACRO (VL_API_ADD_DEL_IP_PUNT_REDIRECT_V2_REPLY);
536 }
537 
538 static clib_error_t *
540  u32 flags,
541  _vnet_ip_table_function_list_elt_t **
542  elts)
543 {
544  _vnet_ip_table_function_list_elt_t *elt;
546  clib_error_t *error = 0;
547 
549  prio <= VNET_IP_TABLE_FUNC_PRIORITY_HIGH; prio++)
550  {
551  elt = elts[prio];
552 
553  while (elt)
554  {
555  error = elt->fp (vnm, table_id, flags);
556  if (error)
557  return error;
558  elt = elt->next_ip_table_function;
559  }
560  }
561  return error;
562 }
563 
564 void
566 {
567  u32 fib_index, mfib_index;
568  vnet_main_t *vnm = vnet_get_main ();
569 
570  /*
571  * ignore action on the default table - this is always present
572  * and cannot be added nor deleted from the API
573  */
574  if (0 != table_id)
575  {
576  /*
577  * The API holds only one lock on the table.
578  * i.e. it can be added many times via the API but needs to be
579  * deleted only once.
580  * The FIB index for unicast and multicast is not necessarily the
581  * same, since internal VPP systesm (like LISP and SR) create
582  * their own unicast tables.
583  */
584  fib_index = fib_table_find (fproto, table_id);
585  mfib_index = mfib_table_find (fproto, table_id);
586 
587  if ((~0 != fib_index) || (~0 != mfib_index))
588  call_elf_section_ip_table_callbacks (vnm, table_id, 0 /* is_add */ ,
590 
591  if (~0 != fib_index)
592  {
593  fib_table_unlock (fib_index, fproto,
594  (is_api ? FIB_SOURCE_API : FIB_SOURCE_CLI));
595  }
596  if (~0 != mfib_index)
597  {
598  mfib_table_unlock (mfib_index, fproto,
599  (is_api ? MFIB_SOURCE_API : MFIB_SOURCE_CLI));
600  }
601  }
602 }
603 
604 /*
605  * Returns an unused table id, and ~0 if it can't find one.
606  */
607 u32
609 {
610  int i, j;
611  u32 seed = random_default_seed ();
612  /* limit to 1M tries */
613  for (j = 0; j < 1 << 10; j++)
614  {
615  seed = random_u32 (&seed);
616  for (i = 0; i < 1 << 10; i++)
617  {
618  /* look around randomly generated id */
619  seed += (2 * (i % 2) - 1) * i;
620  if (seed == ~0)
621  continue;
622  if (fib_table_find (fproto, seed) == ~0)
623  return seed;
624  }
625  }
626 
627  return ~0;
628 }
629 
630 void
632 {
633  vl_api_ip_table_add_del_reply_t *rmp;
634  fib_protocol_t fproto = (mp->table.is_ip6 ?
636  u32 table_id = ntohl (mp->table.table_id);
637  int rv = 0;
638 
639  if (mp->is_add)
640  {
641  ip_table_create (fproto, table_id, 1, mp->table.name);
642  }
643  else
644  {
645  ip_table_delete (fproto, table_id, 1);
646  }
647 
648  REPLY_MACRO (VL_API_IP_TABLE_ADD_DEL_REPLY);
649 }
650 
651 void
653 {
655  fib_protocol_t fproto =
656  (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
657  u32 table_id = ntohl (mp->table.table_id);
658  int rv = 0;
659 
660  if (~0 == table_id)
661  table_id = ip_table_get_unused_id (fproto);
662 
663  if (~0 == table_id)
664  rv = VNET_API_ERROR_EAGAIN;
665  else
666  ip_table_create (fproto, table_id, 1, mp->table.name);
667 
668  REPLY_MACRO2 (VL_API_IP_TABLE_ALLOCATE_REPLY, {
669  clib_memcpy_fast (&rmp->table, &mp->table, sizeof (mp->table));
670  rmp->table.table_id = htonl (table_id);
671  })
672 }
673 
674 static int
676 {
677  fib_route_path_t *rpaths = NULL, *rpath;
679  vl_api_fib_path_t *apath;
680  fib_prefix_t pfx;
681  u32 fib_index;
682  int rv, ii;
683 
685  ip_prefix_decode (&mp->route.prefix, &pfx);
686 
688  ntohl (mp->route.table_id), &fib_index);
689  if (0 != rv)
690  goto out;
691 
692  if (0 != mp->route.n_paths)
693  vec_validate (rpaths, mp->route.n_paths - 1);
694 
695  for (ii = 0; ii < mp->route.n_paths; ii++)
696  {
697  apath = &mp->route.paths[ii];
698  rpath = &rpaths[ii];
699 
700  rv = fib_api_path_decode (apath, rpath);
701 
702  if ((rpath->frp_flags & FIB_ROUTE_PATH_LOCAL) &&
703  (~0 == rpath->frp_sw_if_index))
705 
706  if (0 != rv)
707  goto out;
708  }
709 
710  rv = fib_api_route_add_del (mp->is_add, mp->is_multipath, fib_index, &pfx,
711  FIB_SOURCE_API, entry_flags, rpaths);
712 
713  if (mp->is_add && 0 == rv)
714  *stats_index = fib_table_entry_get_stats_index (fib_index, &pfx);
715 
716 out:
717  vec_free (rpaths);
718 
719  return (rv);
720 }
721 
722 static int
724  u32 *stats_index)
725 {
726  fib_route_path_t *rpaths = NULL, *rpath;
728  vl_api_fib_path_t *apath;
730  fib_prefix_t pfx;
731  u32 fib_index;
732  int rv, ii;
733 
735  ip_prefix_decode (&mp->route.prefix, &pfx);
736 
737  rv = fib_api_table_id_decode (pfx.fp_proto, ntohl (mp->route.table_id),
738  &fib_index);
739  if (0 != rv)
740  goto out;
741 
742  if (0 != mp->route.n_paths)
743  vec_validate (rpaths, mp->route.n_paths - 1);
744 
745  for (ii = 0; ii < mp->route.n_paths; ii++)
746  {
747  apath = &mp->route.paths[ii];
748  rpath = &rpaths[ii];
749 
750  rv = fib_api_path_decode (apath, rpath);
751 
752  if ((rpath->frp_flags & FIB_ROUTE_PATH_LOCAL) &&
753  (~0 == rpath->frp_sw_if_index))
755 
756  if (0 != rv)
757  goto out;
758  }
759 
760  src = (0 == mp->route.src ? FIB_SOURCE_API : mp->route.src);
761 
762  rv = fib_api_route_add_del (mp->is_add, mp->is_multipath, fib_index, &pfx,
763  src, entry_flags, rpaths);
764 
765  if (mp->is_add && 0 == rv)
766  *stats_index = fib_table_entry_get_stats_index (fib_index, &pfx);
767 
768 out:
769  vec_free (rpaths);
770 
771  return (rv);
772 }
773 
774 void
776 {
778  u32 stats_index = ~0;
779  int rv;
780 
782 
783  /* *INDENT-OFF* */
784  REPLY_MACRO2 (VL_API_IP_ROUTE_ADD_DEL_REPLY,
785  ({
786  rmp->stats_index = htonl (stats_index);
787  }))
788  /* *INDENT-ON* */
789 }
790 
791 void
793 {
795  u32 stats_index = ~0;
796  int rv;
797 
799 
800  /* clang-format off */
801  REPLY_MACRO2 (VL_API_IP_ROUTE_ADD_DEL_V2_REPLY,
802  ({
803  rmp->stats_index = htonl (stats_index);
804  }))
805  /* clang-format on */
806 }
807 
808 void
810 {
811  vl_api_ip_route_lookup_reply_t *rmp = NULL;
812  fib_route_path_t *rpaths = NULL, *rpath;
813  const fib_prefix_t *pfx = NULL;
815  vl_api_fib_path_t *fp;
816  fib_node_index_t fib_entry_index;
817  u32 fib_index;
818  int npaths = 0;
819  int rv;
820 
821  ip_prefix_decode (&mp->prefix, &lookup);
822  rv = fib_api_table_id_decode (lookup.fp_proto, ntohl (mp->table_id),
823  &fib_index);
824  if (PREDICT_TRUE (!rv))
825  {
826  if (mp->exact)
827  fib_entry_index = fib_table_lookup_exact_match (fib_index, &lookup);
828  else
829  fib_entry_index = fib_table_lookup (fib_index, &lookup);
830  if (fib_entry_index == FIB_NODE_INDEX_INVALID)
831  rv = VNET_API_ERROR_NO_SUCH_ENTRY;
832  else
833  {
834  pfx = fib_entry_get_prefix (fib_entry_index);
835  rpaths = fib_entry_encode (fib_entry_index);
836  npaths = vec_len (rpaths);
837  }
838  }
839 
840  /* *INDENT-OFF* */
841  REPLY_MACRO3_ZERO(VL_API_IP_ROUTE_LOOKUP_REPLY,
842  npaths * sizeof (*fp),
843  ({
844  if (!rv)
845  {
846  ip_prefix_encode (pfx, &rmp->route.prefix);
847  rmp->route.table_id = mp->table_id;
848  rmp->route.n_paths = npaths;
849  rmp->route.stats_index = fib_table_entry_get_stats_index (fib_index, pfx);
850  rmp->route.stats_index = htonl (rmp->route.stats_index);
851 
852  fp = rmp->route.paths;
853  vec_foreach (rpath, rpaths)
854  {
855  fib_api_path_encode (rpath, fp);
856  fp++;
857  }
858  }
859  }));
860  /* *INDENT-ON* */
861  vec_free (rpaths);
862 }
863 
864 void
866 {
868  fib_route_path_t *rpaths = NULL, *rpath;
869  const fib_prefix_t *pfx = NULL;
871  vl_api_fib_path_t *fp;
872  fib_node_index_t fib_entry_index;
873  u32 fib_index;
874  int npaths = 0;
875  fib_source_t src = 0;
876  int rv;
877 
878  ip_prefix_decode (&mp->prefix, &lookup);
879  rv = fib_api_table_id_decode (lookup.fp_proto, ntohl (mp->table_id),
880  &fib_index);
881  if (PREDICT_TRUE (!rv))
882  {
883  if (mp->exact)
884  fib_entry_index = fib_table_lookup_exact_match (fib_index, &lookup);
885  else
886  fib_entry_index = fib_table_lookup (fib_index, &lookup);
887  if (fib_entry_index == FIB_NODE_INDEX_INVALID)
888  rv = VNET_API_ERROR_NO_SUCH_ENTRY;
889  else
890  {
891  pfx = fib_entry_get_prefix (fib_entry_index);
892  rpaths = fib_entry_encode (fib_entry_index);
893  npaths = vec_len (rpaths);
894  src = fib_entry_get_best_source (fib_entry_index);
895  }
896  }
897 
898  /* clang-format off */
899  REPLY_MACRO3_ZERO(VL_API_IP_ROUTE_LOOKUP_V2_REPLY,
900  npaths * sizeof (*fp),
901  ({
902  if (!rv)
903  {
904  ip_prefix_encode (pfx, &rmp->route.prefix);
905  rmp->route.table_id = mp->table_id;
906  rmp->route.n_paths = npaths;
907  rmp->route.src = src;
908  rmp->route.stats_index = fib_table_entry_get_stats_index (fib_index, pfx);
909  rmp->route.stats_index = htonl (rmp->route.stats_index);
910 
911  fp = rmp->route.paths;
912  vec_foreach (rpath, rpaths)
913  {
914  fib_api_path_encode (rpath, fp);
915  fp++;
916  }
917  }
918  }));
919  /* clang-format on */
920  vec_free (rpaths);
921 }
922 
923 void
925  u32 table_id, u8 is_api, const u8 * name)
926 {
927  u32 fib_index, mfib_index;
928  vnet_main_t *vnm = vnet_get_main ();
929 
930  /*
931  * ignore action on the default table - this is always present
932  * and cannot be added nor deleted from the API
933  */
934  if (0 != table_id)
935  {
936  /*
937  * The API holds only one lock on the table.
938  * i.e. it can be added many times via the API but needs to be
939  * deleted only once.
940  * The FIB index for unicast and multicast is not necessarily the
941  * same, since internal VPP systesm (like LISP and SR) create
942  * their own unicast tables.
943  */
944  fib_index = fib_table_find (fproto, table_id);
945  mfib_index = mfib_table_find (fproto, table_id);
946 
947  if (~0 == fib_index)
948  {
950  (is_api ?
952  FIB_SOURCE_CLI), name);
953  }
954  if (~0 == mfib_index)
955  {
957  (is_api ?
960  }
961 
962  if ((~0 == fib_index) || (~0 == mfib_index))
963  call_elf_section_ip_table_callbacks (vnm, table_id, 1 /* is_add */ ,
965  }
966 }
967 
968 static u32
970  u8 is_multipath,
971  u32 fib_index,
972  const mfib_prefix_t * prefix,
974  u32 rpf_id, fib_route_path_t * rpaths)
975 {
976  u32 mfib_entry_index = ~0;
977 
978  if (0 == vec_len (rpaths))
979  {
980  mfib_entry_index = mfib_table_entry_update (fib_index, prefix,
983  }
984  else
985  {
986  if (is_add)
987  {
988  mfib_entry_index =
990  MFIB_SOURCE_API, rpaths);
991  }
992  else
993  {
995  MFIB_SOURCE_API, rpaths);
996  }
997  }
998 
999  return (mfib_entry_index);
1000 }
1001 
1002 static int
1004  u32 * stats_index)
1005 {
1006  fib_route_path_t *rpath, *rpaths = NULL;
1007  fib_node_index_t mfib_entry_index;
1008  mfib_entry_flags_t eflags;
1009  mfib_prefix_t pfx;
1010  u32 fib_index;
1011  int rv;
1012  u16 ii;
1013 
1014  ip_mprefix_decode (&mp->route.prefix, &pfx);
1015 
1017  ntohl (mp->route.table_id), &fib_index);
1018  if (0 != rv)
1019  goto out;
1020 
1021  vec_validate (rpaths, mp->route.n_paths - 1);
1022 
1023  for (ii = 0; ii < mp->route.n_paths; ii++)
1024  {
1025  rpath = &rpaths[ii];
1026 
1027  rv = mfib_api_path_decode (&mp->route.paths[ii], rpath);
1028 
1029  if (0 != rv)
1030  goto out;
1031  }
1032 
1033  eflags = mfib_api_path_entry_flags_decode (mp->route.entry_flags);
1034  mfib_entry_index = mroute_add_del_handler (mp->is_add,
1035  mp->is_add,
1036  fib_index, &pfx,
1037  eflags,
1038  ntohl (mp->route.rpf_id),
1039  rpaths);
1040 
1041  if (~0 != mfib_entry_index)
1042  *stats_index = mfib_entry_get_stats_index (mfib_entry_index);
1043 
1044 out:
1045  return (rv);
1046 }
1047 
1048 void
1050 {
1052  u32 stats_index = ~0;
1053  int rv;
1054 
1056 
1057  /* *INDENT-OFF* */
1058  REPLY_MACRO2 (VL_API_IP_MROUTE_ADD_DEL_REPLY,
1059  ({
1060  rmp->stats_index = htonl (stats_index);
1061  }));
1062  /* *INDENT-ON* */
1063 }
1064 
1065 static void
1068  u32 context)
1069 {
1070  vl_api_ip_details_t *mp;
1071 
1072  mp = vl_msg_api_alloc (sizeof (*mp));
1073  clib_memset (mp, 0, sizeof (*mp));
1074  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_DETAILS);
1075 
1076  mp->sw_if_index = ntohl (sw_if_index);
1077  mp->is_ipv6 = is_ipv6;
1078  mp->context = context;
1079 
1080  vl_api_send_msg (reg, (u8 *) mp);
1081 }
1082 
1083 static void
1085  vl_api_registration_t * reg,
1086  const fib_prefix_t * pfx,
1088 {
1090 
1091  mp = vl_msg_api_alloc (sizeof (*mp));
1092  clib_memset (mp, 0, sizeof (*mp));
1093  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_ADDRESS_DETAILS);
1094 
1095  ip_prefix_encode (pfx, &mp->prefix);
1096  mp->context = context;
1097  mp->sw_if_index = htonl (sw_if_index);
1098 
1099  vl_api_send_msg (reg, (u8 *) mp);
1100 }
1101 
1102 static void
1104 {
1106  vl_api_registration_t *reg;
1107  ip6_main_t *im6 = &ip6_main;
1108  ip4_main_t *im4 = &ip4_main;
1109  ip_lookup_main_t *lm6 = &im6->lookup_main;
1110  ip_lookup_main_t *lm4 = &im4->lookup_main;
1111  ip_interface_address_t *ia = 0;
1112  u32 sw_if_index = ~0;
1113  int rv __attribute__ ((unused)) = 0;
1114 
1115  VALIDATE_SW_IF_INDEX (mp);
1116 
1117  sw_if_index = ntohl (mp->sw_if_index);
1118 
1120  if (!reg)
1121  return;
1122 
1123  if (mp->is_ipv6)
1124  {
1125  /* *INDENT-OFF* */
1126  /* Do not send subnet details of the IP-interface for
1127  * unnumbered interfaces. otherwise listening clients
1128  * will be confused that the subnet is applied on more
1129  * than one interface */
1131  ({
1132  fib_prefix_t pfx = {
1133  .fp_addr.ip6 = *(ip6_address_t *)ip_interface_address_get_address (lm6, ia),
1134  .fp_len = ia->address_length,
1135  .fp_proto = FIB_PROTOCOL_IP6,
1136  };
1137  send_ip_address_details(am, reg, &pfx, sw_if_index, mp->context);
1138  }));
1139  /* *INDENT-ON* */
1140  }
1141  else
1142  {
1143  /* *INDENT-OFF* */
1145  ({
1146  fib_prefix_t pfx = {
1148  .fp_len = ia->address_length,
1149  .fp_proto = FIB_PROTOCOL_IP4,
1150  };
1151 
1152  send_ip_address_details(am, reg, &pfx, sw_if_index, mp->context);
1153  }));
1154  /* *INDENT-ON* */
1155  }
1156 
1158 }
1159 
1160 static void
1162  vl_api_registration_t * reg,
1163  u32 sw_if_index, u32 ip_sw_if_index, u32 context)
1164 {
1166 
1167  mp = vl_msg_api_alloc (sizeof (*mp));
1168  clib_memset (mp, 0, sizeof (*mp));
1169  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_UNNUMBERED_DETAILS);
1170 
1171  mp->context = context;
1172  mp->sw_if_index = htonl (sw_if_index);
1173  mp->ip_sw_if_index = htonl (ip_sw_if_index);
1174 
1175  vl_api_send_msg (reg, (u8 *) mp);
1176 }
1177 
1178 static void
1180 {
1181  vnet_main_t *vnm = vnet_get_main ();
1183  int rv __attribute__ ((unused)) = 0;
1185  vl_api_registration_t *reg;
1187  u32 sw_if_index;
1188 
1189  sw_if_index = ntohl (mp->sw_if_index);
1190 
1192  if (!reg)
1193  return;
1194 
1195  if (~0 != sw_if_index)
1196  {
1197  VALIDATE_SW_IF_INDEX (mp);
1198 
1199  si = vnet_get_sw_interface (vnm, ntohl (mp->sw_if_index));
1200 
1202  {
1204  sw_if_index,
1206  mp->context);
1207  }
1208  }
1209  else
1210  {
1211  /* *INDENT-OFF* */
1213  {
1215  {
1217  si->sw_if_index,
1219  mp->context);
1220  }
1221  }
1222  /* *INDENT-ON* */
1223  }
1224 
1226 }
1227 
1228 static void
1230 {
1232  vnet_main_t *vnm = vnet_get_main ();
1233  //vlib_main_t *vm = vlib_get_main ();
1235  vl_api_registration_t *reg;
1236  vnet_sw_interface_t *si, *sorted_sis;
1237  u32 sw_if_index = ~0;
1238 
1240  if (!reg)
1241  return;
1242 
1243  /* Gather interfaces. */
1245  _vec_len (sorted_sis) = 0;
1246  /* *INDENT-OFF* */
1248  {
1249  vec_add1 (sorted_sis, si[0]);
1250  }
1251  /* *INDENT-ON* */
1252 
1253  vec_foreach (si, sorted_sis)
1254  {
1256  {
1257  /* if (mp->is_ipv6 && !ip6_interface_enabled (vm, si->sw_if_index)) */
1258  /* { */
1259  /* continue; */
1260  /* } */
1262  send_ip_details (am, reg, sw_if_index, mp->is_ipv6, mp->context);
1263  }
1264  }
1265 
1266  vec_free (sorted_sis);
1267 }
1268 
1269 static void
1271 {
1272  vl_api_set_ip_flow_hash_reply_t *rmp;
1273  int rv;
1274  u32 table_id;
1275  flow_hash_config_t flow_hash_config = 0;
1276 
1277  table_id = ntohl (mp->vrf_id);
1278 
1279 #define _(a,b) if (mp->a) flow_hash_config |= b;
1281 #undef _
1282 
1284  flow_hash_config);
1285 
1286  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
1287 }
1288 
1289 static void
1291 {
1292  vl_api_set_ip_flow_hash_v2_reply_t *rmp;
1294  int rv;
1295 
1296  rv = ip_address_family_decode (mp->af, &af);
1297 
1298  if (!rv)
1299  rv = ip_flow_hash_set (af, htonl (mp->table_id),
1300  htonl (mp->flow_hash_config));
1301 
1302  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_V2_REPLY);
1303 }
1304 
1305 static void
1308 {
1309  vl_api_set_ip_flow_hash_router_id_reply_t *rmp;
1310  int rv = 0;
1311 
1312  ip_flow_hash_router_id_set (ntohl (mp->router_id));
1313 
1314  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_ROUTER_ID_REPLY);
1315 }
1316 
1317 void
1319  u32 context, const mfib_signal_t * mfs)
1320 {
1322  const mfib_prefix_t *prefix;
1323  mfib_table_t *mfib;
1324  mfib_itf_t *mfi;
1325 
1326  mp = vl_msg_api_alloc (sizeof (*mp));
1327 
1328  clib_memset (mp, 0, sizeof (*mp));
1329  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_MFIB_SIGNAL_DETAILS);
1330  mp->context = context;
1331 
1332  mfi = mfib_itf_get (mfs->mfs_itf);
1335  prefix->fp_proto);
1336  mp->table_id = ntohl (mfib->mft_table_id);
1337  mp->sw_if_index = ntohl (mfi->mfi_sw_if_index);
1338 
1340 
1341  if (0 != mfs->mfs_buffer_len)
1342  {
1343  mp->ip_packet_len = ntohs (mfs->mfs_buffer_len);
1344 
1345  memcpy (mp->ip_packet_data, mfs->mfs_buffer, mfs->mfs_buffer_len);
1346  }
1347  else
1348  {
1349  mp->ip_packet_len = 0;
1350  }
1351 
1352  vl_api_send_msg (reg, (u8 *) mp);
1353 }
1354 
1355 static void
1357 {
1358  vl_api_registration_t *reg;
1359 
1361  if (!reg)
1362  return;
1363 
1364  while (vl_api_can_send_msg (reg) && mfib_signal_send_one (reg, mp->context))
1365  ;
1366 }
1367 
1368 static void
1371 {
1372  vl_api_ip_container_proxy_add_del_reply_t *rmp;
1374  int rv = 0;
1376 
1377  clib_memset (&args, 0, sizeof (args));
1378 
1379  ip_prefix_decode (&mp->pfx, &args.prefix);
1380 
1381  args.sw_if_index = clib_net_to_host_u32 (mp->sw_if_index);
1382  args.is_add = mp->is_add;
1383  if ((error = vnet_ip_container_proxy_add_del (&args)))
1384  {
1387  }
1388 
1389  REPLY_MACRO (VL_API_IP_CONTAINER_PROXY_ADD_DEL_REPLY);
1390 }
1391 
1392 typedef struct ip_walk_ctx_t_
1393 {
1396 } ip_walk_ctx_t;
1397 
1398 static int
1400  void *args)
1401 {
1403  ip_walk_ctx_t *ctx = args;
1404 
1405  mp = vl_msg_api_alloc (sizeof (*mp));
1406  if (!mp)
1407  return 1;
1408 
1409  clib_memset (mp, 0, sizeof (*mp));
1410  mp->_vl_msg_id =
1411  ntohs (REPLY_MSG_ID_BASE + VL_API_IP_CONTAINER_PROXY_DETAILS);
1412  mp->context = ctx->context;
1413 
1414  mp->sw_if_index = ntohl (sw_if_index);
1415  ip_prefix_encode (pfx, &mp->prefix);
1416 
1417  vl_api_send_msg (ctx->reg, (u8 *) mp);
1418 
1419  return 1;
1420 }
1421 
1422 static void
1424  mp)
1425 {
1426  vl_api_registration_t *reg;
1427 
1429  if (!reg)
1430  return;
1431 
1432  ip_walk_ctx_t ctx = {
1433  .context = mp->context,
1434  .reg = reg,
1435  };
1436 
1438 }
1439 
1440 static void
1442 {
1443  int rv = 0;
1444  vl_api_ioam_enable_reply_t *rmp;
1446 
1447  /* Ignoring the profile id as currently a single profile
1448  * is supported */
1450  mp->seqno, mp->analyse);
1451  if (error)
1452  {
1455  }
1456 
1457  REPLY_MACRO (VL_API_IOAM_ENABLE_REPLY);
1458 }
1459 
1460 static void
1462 {
1463  int rv = 0;
1464  vl_api_ioam_disable_reply_t *rmp;
1466 
1468  if (error)
1469  {
1472  }
1473 
1474  REPLY_MACRO (VL_API_IOAM_DISABLE_REPLY);
1475 }
1476 
1477 static void
1480 {
1481  vl_api_ip_source_and_port_range_check_add_del_reply_t *rmp;
1482  int rv = 0;
1483 
1484  u8 is_add = mp->is_add;
1485  fib_prefix_t pfx;
1486  u16 *low_ports = 0;
1487  u16 *high_ports = 0;
1488  u32 vrf_id;
1489  u16 tmp_low, tmp_high;
1490  u8 num_ranges;
1491  int i;
1492 
1493  ip_prefix_decode (&mp->prefix, &pfx);
1494 
1495  // Validate port range
1496  num_ranges = mp->number_of_ranges;
1497  if (num_ranges > 32)
1498  { // This is size of array in VPE.API
1499  rv = VNET_API_ERROR_EXCEEDED_NUMBER_OF_RANGES_CAPACITY;
1500  goto reply;
1501  }
1502 
1503  vec_reset_length (low_ports);
1504  vec_reset_length (high_ports);
1505 
1506  for (i = 0; i < num_ranges; i++)
1507  {
1508  tmp_low = mp->low_ports[i];
1509  tmp_high = mp->high_ports[i];
1510  // If tmp_low <= tmp_high then only need to check tmp_low = 0
1511  // If tmp_low <= tmp_high then only need to check tmp_high > 65535
1512  if (tmp_low > tmp_high || tmp_low == 0 || tmp_high > 65535)
1513  {
1514  rv = VNET_API_ERROR_INVALID_VALUE;
1515  goto reply;
1516  }
1517  vec_add1 (low_ports, tmp_low);
1518  vec_add1 (high_ports, tmp_high + 1);
1519  }
1520 
1521  vrf_id = ntohl (mp->vrf_id);
1522 
1523  if (vrf_id < 1)
1524  {
1525  rv = VNET_API_ERROR_INVALID_VALUE;
1526  goto reply;
1527  }
1528 
1529 
1530  if (FIB_PROTOCOL_IP6 == pfx.fp_proto)
1531  {
1533  pfx.fp_len,
1534  vrf_id,
1535  low_ports,
1536  high_ports, is_add);
1537  }
1538  else
1539  {
1541  pfx.fp_len,
1542  vrf_id,
1543  low_ports,
1544  high_ports, is_add);
1545  }
1546 
1547 reply:
1548  vec_free (low_ports);
1549  vec_free (high_ports);
1550  REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY);
1551 }
1552 
1553 static void
1556 {
1558  vl_api_ip_source_and_port_range_check_interface_add_del_reply_t *rmp;
1559  ip4_main_t *im = &ip4_main;
1560  int rv;
1561  u32 sw_if_index;
1564  uword *p = 0;
1565  int i;
1566 
1568  ntohl (mp->tcp_out_vrf_id);
1570  ntohl (mp->udp_out_vrf_id);
1572  ntohl (mp->tcp_in_vrf_id);
1574  ntohl (mp->udp_in_vrf_id);
1575 
1576 
1578  {
1579  if (vrf_id[i] != 0 && vrf_id[i] != ~0)
1580  {
1581  p = hash_get (im->fib_index_by_table_id, vrf_id[i]);
1582 
1583  if (p == 0)
1584  {
1585  rv = VNET_API_ERROR_INVALID_VALUE;
1586  goto reply;
1587  }
1588 
1589  fib_index[i] = p[0];
1590  }
1591  else
1592  fib_index[i] = ~0;
1593  }
1594  sw_if_index = ntohl (mp->sw_if_index);
1595 
1596  VALIDATE_SW_IF_INDEX (mp);
1597 
1598  rv =
1600  mp->is_add);
1601 
1603 reply:
1604 
1605  REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY);
1606 }
1607 
1608 static void
1611 {
1612  vl_api_sw_interface_ip6_set_link_local_address_reply_t *rmp;
1613  ip6_address_t ip;
1614  int rv;
1615 
1616  VALIDATE_SW_IF_INDEX (mp);
1617 
1618  ip6_address_decode (mp->ip, &ip);
1619 
1620  rv = ip6_link_set_local_address (ntohl (mp->sw_if_index), &ip);
1621 
1623  REPLY_MACRO (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY);
1624 }
1625 
1626 static void
1629 {
1631  const ip6_address_t *ip = NULL;
1632  int rv = 0;
1633 
1634  VALIDATE_SW_IF_INDEX (mp);
1635 
1636  ip = ip6_get_link_local_address (ntohl (mp->sw_if_index));
1637  if (NULL == ip)
1638  rv = VNET_API_ERROR_IP6_NOT_ENABLED;
1639 
1641  /* clang-format off */
1642  REPLY_MACRO2 (VL_API_SW_INTERFACE_IP6_GET_LINK_LOCAL_ADDRESS_REPLY,
1643  ({
1644  if (!rv)
1645  ip6_address_encode (ip, rmp->ip);
1646  }))
1647  /* clang-format on */
1648 }
1649 
1650 static void
1652 {
1653  vl_api_ip_table_replace_begin_reply_t *rmp;
1654  fib_protocol_t fproto;
1655  u32 fib_index;
1656  int rv = 0;
1657 
1658  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1659  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
1660 
1661  if (INDEX_INVALID == fib_index)
1662  rv = VNET_API_ERROR_NO_SUCH_FIB;
1663  else
1664  {
1665  fib_table_mark (fib_index, fproto, FIB_SOURCE_API);
1666  mfib_table_mark (mfib_table_find (fproto, ntohl (mp->table.table_id)),
1667  fproto, MFIB_SOURCE_API);
1668  }
1669  REPLY_MACRO (VL_API_IP_TABLE_REPLACE_BEGIN_REPLY);
1670 }
1671 
1672 static void
1674 {
1675  vl_api_ip_table_replace_end_reply_t *rmp;
1676  fib_protocol_t fproto;
1677  u32 fib_index;
1678  int rv = 0;
1679 
1680  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1681  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
1682 
1683  if (INDEX_INVALID == fib_index)
1684  rv = VNET_API_ERROR_NO_SUCH_FIB;
1685  else
1686  {
1687  fib_table_sweep (fib_index, fproto, FIB_SOURCE_API);
1689  (fproto, ntohl (mp->table.table_id)), fproto,
1690  MFIB_SOURCE_API);
1691  }
1692  REPLY_MACRO (VL_API_IP_TABLE_REPLACE_END_REPLY);
1693 }
1694 
1695 static void
1697 {
1698  vl_api_ip_table_flush_reply_t *rmp;
1699  fib_protocol_t fproto;
1700  u32 fib_index;
1701  int rv = 0;
1702 
1703  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1704  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
1705 
1706  if (INDEX_INVALID == fib_index)
1707  rv = VNET_API_ERROR_NO_SUCH_FIB;
1708  else
1709  {
1710  vnet_main_t *vnm = vnet_get_main ();
1713 
1714  /* Shut down interfaces in this FIB / clean out intfc routes */
1715  /* *INDENT-OFF* */
1717  {
1718  if (fib_index == fib_table_get_index_for_sw_if_index (fproto,
1719  si->sw_if_index))
1720  {
1721  u32 flags = si->flags;
1724  }
1725  }
1726  /* *INDENT-ON* */
1727 
1728  fib_table_flush (fib_index, fproto, FIB_SOURCE_API);
1729  mfib_table_flush (mfib_table_find (fproto, ntohl (mp->table.table_id)),
1730  fproto, MFIB_SOURCE_API);
1731  }
1732 
1733  REPLY_MACRO (VL_API_IP_TABLE_FLUSH_REPLY);
1734 }
1735 
1736 void
1738 {
1739  vl_api_ip_reassembly_set_reply_t *rmp;
1740  int rv = 0;
1741  switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
1742  {
1743  case IP_REASS_TYPE_FULL:
1744  if (mp->is_ip6)
1745  {
1746  rv = ip6_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1747  clib_net_to_host_u32
1748  (mp->max_reassemblies),
1749  clib_net_to_host_u32
1750  (mp->max_reassembly_length),
1751  clib_net_to_host_u32
1752  (mp->expire_walk_interval_ms));
1753  }
1754  else
1755  {
1756  rv = ip4_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1757  clib_net_to_host_u32
1758  (mp->max_reassemblies),
1759  clib_net_to_host_u32
1760  (mp->max_reassembly_length),
1761  clib_net_to_host_u32
1762  (mp->expire_walk_interval_ms));
1763  }
1764  break;
1766  if (mp->is_ip6)
1767  {
1768  rv =
1769  ip6_sv_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1770  clib_net_to_host_u32 (mp->max_reassemblies),
1771  clib_net_to_host_u32
1772  (mp->max_reassembly_length),
1773  clib_net_to_host_u32
1774  (mp->expire_walk_interval_ms));
1775  }
1776  else
1777  {
1778  rv = ip4_sv_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1779  clib_net_to_host_u32 (mp->max_reassemblies),
1780  clib_net_to_host_u32
1781  (mp->max_reassembly_length),
1782  clib_net_to_host_u32
1783  (mp->expire_walk_interval_ms));
1784  }
1785  break;
1786  }
1787 
1788  REPLY_MACRO (VL_API_IP_REASSEMBLY_SET_REPLY);
1789 }
1790 
1791 void
1793 {
1795 
1797  if (rp == 0)
1798  return;
1799 
1800  vl_api_ip_reassembly_get_reply_t *rmp = vl_msg_api_alloc (sizeof (*rmp));
1801  clib_memset (rmp, 0, sizeof (*rmp));
1802  rmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_REASSEMBLY_GET_REPLY);
1803  rmp->context = mp->context;
1804  rmp->retval = 0;
1805  u32 timeout_ms;
1806  u32 max_reassemblies;
1807  u32 max_reassembly_length;
1808  u32 expire_walk_interval_ms;
1809  switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
1810  {
1811  case IP_REASS_TYPE_FULL:
1812  if (mp->is_ip6)
1813  {
1814  rmp->is_ip6 = 1;
1815  ip6_full_reass_get (&timeout_ms, &max_reassemblies,
1816  &max_reassembly_length,
1817  &expire_walk_interval_ms);
1818  }
1819  else
1820  {
1821  rmp->is_ip6 = 0;
1822  ip4_full_reass_get (&timeout_ms, &max_reassemblies,
1823  &max_reassembly_length,
1824  &expire_walk_interval_ms);
1825  }
1826  break;
1828  if (mp->is_ip6)
1829  {
1830  rmp->is_ip6 = 1;
1831  ip6_sv_reass_get (&timeout_ms, &max_reassemblies,
1832  &max_reassembly_length, &expire_walk_interval_ms);
1833  }
1834  else
1835  {
1836  rmp->is_ip6 = 0;
1837  ip4_sv_reass_get (&timeout_ms, &max_reassemblies,
1838  &max_reassembly_length, &expire_walk_interval_ms);
1839  }
1840  break;
1841  }
1842  rmp->timeout_ms = clib_host_to_net_u32 (timeout_ms);
1843  rmp->max_reassemblies = clib_host_to_net_u32 (max_reassemblies);
1844  rmp->max_reassembly_length = clib_host_to_net_u32 (max_reassembly_length);
1846  clib_host_to_net_u32 (expire_walk_interval_ms);
1847  vl_api_send_msg (rp, (u8 *) rmp);
1848 }
1849 
1850 void
1853 {
1854  vl_api_ip_reassembly_enable_disable_reply_t *rmp;
1855  int rv = 0;
1856  switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
1857  {
1858  case IP_REASS_TYPE_FULL:
1859  rv =
1860  ip4_full_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
1861  mp->enable_ip4);
1862  if (0 == rv)
1863  rv =
1864  ip6_full_reass_enable_disable (clib_net_to_host_u32
1865  (mp->sw_if_index), mp->enable_ip6);
1866  break;
1868  rv =
1869  ip4_sv_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
1870  mp->enable_ip4);
1871  if (0 == rv)
1872  {
1873  rv =
1874  ip6_sv_reass_enable_disable (clib_net_to_host_u32
1875  (mp->sw_if_index), mp->enable_ip6);
1876  }
1877  break;
1878  }
1879 
1880  REPLY_MACRO (VL_API_IP_REASSEMBLY_ENABLE_DISABLE_REPLY);
1881 }
1882 
1883 static walk_rc_t
1885  const ip_punt_redirect_rx_t * ipr, void *arg)
1886 {
1888  fib_path_encode_ctx_t path_ctx = {
1889  .rpaths = NULL,
1890  };
1891  ip_walk_ctx_t *ctx = arg;
1892 
1893  mp = vl_msg_api_alloc (sizeof (*mp));
1894  if (!mp)
1895  return (WALK_STOP);;
1896 
1897  clib_memset (mp, 0, sizeof (*mp));
1898  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IP_PUNT_REDIRECT_DETAILS);
1899  mp->context = ctx->context;
1900 
1901  fib_path_list_walk_w_ext (ipr->pl, NULL, fib_path_encode, &path_ctx);
1902 
1903  mp->punt.rx_sw_if_index = htonl (rx_sw_if_index);
1904  mp->punt.tx_sw_if_index = htonl (path_ctx.rpaths[0].frp_sw_if_index);
1905 
1906  ip_address_encode (&path_ctx.rpaths[0].frp_addr,
1907  fib_proto_to_ip46 (ipr->fproto), &mp->punt.nh);
1908 
1909  vl_api_send_msg (ctx->reg, (u8 *) mp);
1910 
1911  vec_free (path_ctx.rpaths);
1912 
1913  return (WALK_CONTINUE);
1914 }
1915 
1916 static walk_rc_t
1918  const ip_punt_redirect_rx_t *ipr, void *arg)
1919 {
1921  fib_path_encode_ctx_t path_ctx = {
1922  .rpaths = NULL,
1923  };
1924  fib_route_path_t *rpath;
1925  ip_walk_ctx_t *ctx = arg;
1926  vl_api_fib_path_t *fp;
1927  int n_paths;
1928 
1929  fib_path_list_walk_w_ext (ipr->pl, NULL, fib_path_encode, &path_ctx);
1930 
1931  n_paths = vec_len (path_ctx.rpaths);
1932  mp = vl_msg_api_alloc (sizeof (*mp) + n_paths * sizeof (*fp));
1933  if (!mp)
1934  return (WALK_STOP);
1935 
1936  clib_memset (mp, 0, sizeof (*mp));
1937  mp->_vl_msg_id =
1938  ntohs (REPLY_MSG_ID_BASE + VL_API_IP_PUNT_REDIRECT_V2_DETAILS);
1939  mp->context = ctx->context;
1940  mp->punt.rx_sw_if_index = htonl (rx_sw_if_index);
1941  mp->punt.n_paths = htonl (n_paths);
1942  fp = mp->punt.paths;
1943  vec_foreach (rpath, path_ctx.rpaths)
1944  {
1945  fib_api_path_encode (rpath, fp);
1946  fp++;
1947  }
1948  mp->punt.af = (ipr->fproto == FIB_PROTOCOL_IP6) ? ADDRESS_IP6 : ADDRESS_IP4;
1949 
1950  vl_api_send_msg (ctx->reg, (u8 *) mp);
1951 
1952  vec_free (path_ctx.rpaths);
1953 
1954  return (WALK_CONTINUE);
1955 }
1956 
1957 static void
1959  u32 rx_sw_if_index,
1961 {
1962 
1963  if ((u32) ~0 != rx_sw_if_index)
1964  {
1965  index_t pri;
1966  pri = ip_punt_redirect_find (fproto, rx_sw_if_index);
1967 
1968  if (INDEX_INVALID == pri)
1969  return;
1970 
1971  cb (rx_sw_if_index, ip_punt_redirect_get (pri), ctx);
1972  }
1973  else
1974  ip_punt_redirect_walk (fproto, cb, ctx);
1975 }
1976 
1977 static void
1979 {
1980  vl_api_registration_t *reg;
1981  fib_protocol_t fproto;
1982 
1984  if (!reg)
1985  return;
1986 
1987  fproto = (mp->is_ipv6 == 1) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4;
1988 
1989  ip_walk_ctx_t ctx = {
1990  .reg = reg,
1991  .context = mp->context,
1992  };
1993 
1994  vl_api_ip_punt_redirect_dump_common (&ctx, fproto, ntohl (mp->sw_if_index),
1996 }
1997 
1998 static void
2001 {
2002  vl_api_registration_t *reg;
2004  fib_protocol_t fproto;
2005  int rv = 0;
2006 
2008  if (!reg)
2009  return;
2010 
2011  rv = ip_address_family_decode (mp->af, &af);
2012  if (rv != 0)
2013  return;
2014 
2015  fproto = (af == AF_IP6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4;
2016 
2017  ip_walk_ctx_t ctx = {
2018  .reg = reg,
2019  .context = mp->context,
2020  };
2021 
2022  vl_api_ip_punt_redirect_dump_common (&ctx, fproto, ntohl (mp->sw_if_index),
2024 }
2025 
2026 void
2028 {
2029  vl_api_ip_path_mtu_update_reply_t *rmp;
2030  ip_address_t nh;
2031  int rv = 0;
2032 
2033  ip_address_decode2 (&mp->pmtu.nh, &nh);
2034 
2035  rv = ip_path_mtu_update (&nh, ntohl (mp->pmtu.table_id),
2036  ntohs (mp->pmtu.path_mtu));
2037 
2038  REPLY_MACRO (VL_API_IP_PATH_MTU_UPDATE_REPLY);
2039 }
2040 
2041 void
2044 {
2045  vl_api_ip_path_mtu_replace_begin_reply_t *rmp;
2046  int rv;
2047 
2049 
2050  REPLY_MACRO (VL_API_IP_PATH_MTU_REPLACE_BEGIN_REPLY);
2051 }
2052 
2053 void
2055 {
2056  vl_api_ip_path_mtu_replace_end_reply_t *rmp;
2057  int rv;
2058 
2060 
2061  REPLY_MACRO (VL_API_IP_PATH_MTU_REPLACE_END_REPLY);
2062 }
2063 
2064 static void
2066 {
2068  ip_address_t ip;
2069  ip_pmtu_t *ipt;
2070 
2071  ipt = ip_path_mtu_get (ipti);
2072 
2073  REPLY_MACRO_DETAILS4 (VL_API_IP_PATH_MTU_DETAILS, rp, context, ({
2074  ip_pmtu_get_ip (ipt, &ip);
2075  ip_address_encode2 (&ip, &rmp->pmtu.nh);
2076  rmp->pmtu.table_id =
2077  htonl (ip_pmtu_get_table_id (ipt));
2078  rmp->pmtu.path_mtu = htons (ipt->ipt_cfg_pmtu);
2079  }));
2080 }
2081 
2082 static void
2084 {
2086  i32 rv = 0;
2087 
2089  VL_API_IP_PATH_MTU_GET_REPLY, ip_pmtu_pool,
2090  ({ send_ip_path_mtu_details (cursor, rp, mp->context); }));
2091 }
2092 
2093 #include <vnet/ip/ip.api.c>
2094 
2095 static clib_error_t *
2097 {
2099 
2100  /*
2101  * Mark the route add/del API as MP safe
2102  */
2103  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL] = 1;
2104  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_REPLY] = 1;
2105  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_V2] = 1;
2106  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_V2_REPLY] = 1;
2107 
2108  /*
2109  * Set up the (msg_name, crc, message-id) table
2110  */
2112 
2113  return 0;
2114 }
2115 
2117 
2118 /*
2119  * fd.io coding-style-patch-verification: ON
2120  *
2121  * Local Variables:
2122  * eval: (c-set-style "gnu")
2123  * End:
2124  */
vec_reset_length
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Definition: vec_bootstrap.h:194
stats_index
u32 stats_index
Definition: ip.api:174
vl_api_ip_dump_t
Definition: ip.api:527
api_ip6_fib_show_ctx_t
struct apt_ip6_fib_show_ctx_t_ api_ip6_fib_show_ctx_t
ip_address
Definition: ip_types.h:79
vl_api_ip_route_lookup_v2_t
Definition: ip.api:280
vl_api_ip_address_dump_t::client_index
u32 client_index
Definition: ip.api:493
vl_api_ip_source_and_port_range_check_add_del_t::vrf_id
u32 vrf_id
Definition: ip.api:695
vl_api_ip_table_allocate_t_handler
void vl_api_ip_table_allocate_t_handler(vl_api_ip_table_allocate_t *mp)
Definition: ip_api.c:652
im
vnet_interface_main_t * im
Definition: interface_output.c:415
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_ip_reassembly_set_t_handler
void vl_api_ip_reassembly_set_t_handler(vl_api_ip_reassembly_set_t *mp)
Definition: ip_api.c:1737
vl_api_ip_punt_redirect_v2_dump_t::af
vl_api_address_family_t af
Definition: ip.api:643
vl_api_ip_table_dump_t::context
u32 context
Definition: ip.api:96
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
vl_api_mfib_signal_details_t::context
u32 context
Definition: ip.api:542
vl_api_ip_route_add_del_reply_t
Definition: ip.api:215
vl_api_ip_path_mtu_get_reply_t
Definition: ip.api:869
vl_api_ip_punt_redirect_dump_t
Definition: ip.api:596
api.h
vnet_sw_interface_set_flags
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
Definition: interface.c:523
mfib_signal_send_one
int mfib_signal_send_one(struct vl_api_registration_ *reg, u32 context)
Definition: mfib_signal.c:94
vl_api_sw_interface_ip6_enable_disable_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:393
ip_interface_address_get_address
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
Definition: ip_interface.h:43
vl_api_ip_path_mtu_update_t::pmtu
vl_api_ip_path_mtu_t pmtu
Definition: ip.api:861
vl_api_ip_mroute_add_del_reply_t::stats_index
u32 stats_index
Definition: ip.api:462
IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_UDP_IN
@ IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_UDP_IN
Definition: ip_source_and_port_range_check.h:34
vl_api_ip_container_proxy_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:658
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_ip_path_mtu_replace_end_t
Definition: ip.api:890
vl_api_ip_mtable_dump_t_handler
static void vl_api_ip_mtable_dump_t_handler(vl_api_ip_mtable_dump_t *mp)
Definition: ip_api.c:320
ip6_sv_reass_set
vnet_api_error_t ip6_sv_reass_set(u32 timeout_ms, u32 max_reassemblies, u32 max_reassembly_length, u32 expire_walk_interval_ms)
set ip6 reassembly configuration
Definition: ip6_sv_reass.c:868
vl_api_ip_unnumbered_dump_t
Dump IP unnumbered configurations.
Definition: ip.api:513
send_ip_table_details
static void send_ip_table_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 context, const fib_table_t *table)
Definition: ip_api.c:77
ip_walk_ctx_t_
Definition: ip_api.c:1392
foreach_ip_interface_address
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
Definition: ip_interface.h:57
vnet_sw_interface_t
Definition: interface.h:869
ip_walk_ctx_t_::reg
vl_api_registration_t * reg
Definition: ip_api.c:1394
ip6_full_reass.h
IPv6 Reassembly.
vl_api_mfib_signal_details_t::ip_packet_data
u8 ip_packet_data[256]
Definition: ip.api:547
fib_ip_proto
static fib_protocol_t fib_ip_proto(bool is_ip6)
Convert from boolean is_ip6 to FIB protocol.
Definition: fib_types.h:79
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
ip6_punt_redirect_del
void ip6_punt_redirect_del(u32 rx_sw_if_index)
Definition: ip6_punt_drop.c:320
vl_api_ip_table_replace_end_t_handler
static void vl_api_ip_table_replace_end_t_handler(vl_api_ip_table_replace_end_t *mp)
Definition: ip_api.c:1673
vl_api_ip_address_dump_t
Definition: ip.api:491
ip_path_mtu_replace_end
int ip_path_mtu_replace_end(void)
Definition: ip_path_mtu.c:728
is_ipv6
bool is_ipv6
Definition: dhcp.api:202
vl_api_ip_reassembly_set_t::timeout_ms
u32 timeout_ms
Definition: ip.api:795
fib_entry_get_prefix
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1728
ip6_source_and_port_range_check_add_del
int ip6_source_and_port_range_check_add_del(ip6_address_t *address, u32 length, u32 vrf_id, u16 *low_ports, u16 *high_ports, int is_add)
Definition: ip4_source_and_port_range_check.c:1093
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
ip4_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip4.h:109
vnet_main_t::ip_table_add_del_functions
_vnet_ip_table_function_list_elt_t * ip_table_add_del_functions[VNET_ITF_FUNC_N_PRIO]
Definition: vnet.h:100
mfib_api_path_entry_flags_decode
mfib_entry_flags_t mfib_api_path_entry_flags_decode(vl_api_mfib_entry_flags_t in)
Definition: mfib_api.c:80
fib_table_sweep
void fib_table_sweep(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Signal that the table has converged, i.e.
Definition: fib_table.c:1518
vec_new
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
Definition: vec.h:365
vl_api_ip_fib_dump_walk_ctx_t_::feis
fib_node_index_t * feis
Definition: ip_api.c:126
fib_table_get_table_id
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
Definition: fib_table.c:1100
vl_api_ip_route_dump_t::context
u32 context
Definition: ip.api:238
vl_api_ip_fib_dump_walk_ctx_t_
Definition: ip_api.c:124
fib_path_encode_ctx_t_
Path encode context to use when walking a path-list to encode paths.
Definition: fib_path.h:219
vl_api_ip_path_mtu_update_t
Definition: ip.api:857
vl_api_ip_punt_police_t::policer_index
u32 policer_index
Definition: ip.api:561
fib_table_mark
void fib_table_mark(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Resync all entries from a table for the source this is the mark part of the mark and sweep algorithm.
Definition: fib_table.c:1485
fib_route_path_t_::frp_weight
u8 frp_weight
[un]equal cost path weight
Definition: fib_types.h:599
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1104
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_ip_table_allocate_reply_t
Definition: ip.api:81
ip_mprefix_decode
void ip_mprefix_decode(const vl_api_mprefix_t *in, mfib_prefix_t *out)
Definition: ip_types_api.c:314
vl_api_ip_punt_police_t
IP punt policer.
Definition: ip.api:557
vl_api_ip_address_details_t
Definition: ip.api:484
vl_api_set_ip_flow_hash_v2_t
Definition: ip.api:360
vl_api_ip_mroute_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:454
vl_api_ip_address_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:487
clib_error_get_code
#define clib_error_get_code(err)
Definition: error.h:77
vl_api_ip_path_mtu_replace_begin_t_handler
void vl_api_ip_path_mtu_replace_begin_t_handler(vl_api_ip_path_mtu_replace_begin_t *mp)
Definition: ip_api.c:2042
fib_table_find_or_create_and_lock_w_name
u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto, u32 table_id, fib_source_t src, const u8 *name)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1179
vl_api_ip_mtable_dump_t::client_index
u32 client_index
Definition: ip.api:402
entry_flags
vl_api_mfib_entry_flags_t entry_flags
Definition: ip.api:443
IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_TCP_OUT
@ IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_TCP_OUT
Definition: ip_source_and_port_range_check.h:31
ip_container_proxy_walk
void ip_container_proxy_walk(ip_container_proxy_cb_t cb, void *ctx)
Definition: ip_container_proxy.c:133
send_ip_mroute_details
static void send_ip_mroute_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 context, fib_node_index_t mfib_entry_index)
Definition: ip_api.c:357
vl_api_ip_mfib_dump_ctx_t_::entries
fib_node_index_t * entries
Definition: ip_api.c:343
vl_api_set_ip_flow_hash_v2_t_handler
static void vl_api_set_ip_flow_hash_v2_t_handler(vl_api_set_ip_flow_hash_v2_t *mp)
Definition: ip_api.c:1290
name
string name[64]
Definition: fib.api:25
vl_api_ip_route_dump_t::client_index
u32 client_index
Definition: ip.api:237
ip_path_mtu_replace_begin
int ip_path_mtu_replace_begin(void)
Definition: ip_path_mtu.c:718
MFIB_SOURCE_API
@ MFIB_SOURCE_API
Definition: mfib_types.h:165
vl_api_ip_path_mtu_details_t::pmtu
vl_api_ip_path_mtu_t pmtu
Definition: ip.api:878
lookup
static hash_pair_t * lookup(void *v, uword key, enum lookup_opcode op, void *new_value, void *old_value)
Definition: hash.c:545
mfib_prefix_t_
Aggregate type for a prefix.
Definition: mfib_types.h:24
vl_api_ip_punt_redirect_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:600
MFIB_SOURCE_CLI
@ MFIB_SOURCE_CLI
Definition: mfib_types.h:166
ip_interface_address_t::address_length
u16 address_length
Definition: lookup.h:98
vl_api_ip_unnumbered_dump_t::context
u32 context
Definition: ip.api:516
vl_api_ioam_disable_t
iOAM disable
Definition: ip.api:778
vl_api_ip_punt_redirect_v2_dump_t::client_index
u32 client_index
Definition: ip.api:640
vl_api_ip_punt_redirect_v2_details_t
Definition: ip.api:646
vpe_api_main_t
Definition: api_helper_macros.h:414
vl_api_ip_table_replace_begin_t_handler
static void vl_api_ip_table_replace_begin_t_handler(vl_api_ip_table_replace_begin_t *mp)
Definition: ip_api.c:1651
vl_api_ip_reassembly_get_reply_t::max_reassemblies
u32 max_reassemblies
Definition: ip.api:816
vl_api_ip_route_lookup_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:278
vl_api_ip_reassembly_enable_disable_t_handler
void vl_api_ip_reassembly_enable_disable_t_handler(vl_api_ip_reassembly_enable_disable_t *mp)
Definition: ip_api.c:1852
send_ip_path_mtu_details
static void send_ip_path_mtu_details(index_t ipti, vl_api_registration_t *rp, u32 context)
Definition: ip_api.c:2065
vl_api_ip_reassembly_get_t_handler
void vl_api_ip_reassembly_get_t_handler(vl_api_ip_reassembly_get_t *mp)
Definition: ip_api.c:1792
send_ip_unnumbered_details
static void send_ip_unnumbered_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 sw_if_index, u32 ip_sw_if_index, u32 context)
Definition: ip_api.c:1161
vl_api_ip_route_v2_dump_t::table
vl_api_ip_table_t table
Definition: ip.api:248
ip4_sv_reass_get
vnet_api_error_t ip4_sv_reass_get(u32 *timeout_ms, u32 *max_reassemblies, u32 *max_reassembly_length, u32 *expire_walk_interval_ms)
get ip4 reassembly configuration
Definition: ip4_sv_reass.c:1106
vl_api_ip_mroute_dump_t
Dump IP multicast fib table.
Definition: ip.api:468
ip_mprefix_encode
void ip_mprefix_encode(const mfib_prefix_t *in, vl_api_mprefix_t *out)
Definition: ip_types_api.c:304
vl_api_ip_address_details_t::context
u32 context
Definition: ip.api:486
vnet_interface_main_t
Definition: interface.h:990
mfib_entry.h
ip6_sv_reass_enable_disable
vnet_api_error_t ip6_sv_reass_enable_disable(u32 sw_if_index, u8 enable_disable)
Definition: ip6_sv_reass.c:1159
mfib_api_path_decode
int mfib_api_path_decode(vl_api_mfib_path_t *in, fib_route_path_t *out)
Definition: mfib_api.c:100
FIB_NODE_INDEX_INVALID
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
fib_table.h
fib_route_path_t_::frp_addr
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:516
ip_pmtu_get_ip
void ip_pmtu_get_ip(const ip_pmtu_t *ipt, ip_address_t *ip)
Definition: ip_path_mtu.c:126
vl_api_set_ip_flow_hash_t::is_ipv6
bool is_ipv6
Definition: ip.api:327
vl_api_ip_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:523
VNET_IP_TABLE_FUNC_PRIORITY_HIGH
@ VNET_IP_TABLE_FUNC_PRIORITY_HIGH
Definition: ip_table.h:24
u16
unsigned short u16
Definition: types.h:57
vl_api_mfib_signal_details_t::prefix
vl_api_mprefix_t prefix
Definition: ip.api:545
am
app_main_t * am
Definition: application.c:489
vl_api_ip_route_v2_dump_t
Definition: ip.api:241
vl_api_ip_source_and_port_range_check_add_del_t::low_ports
u16 low_ports[32]
Definition: ip.api:693
fib_prefix_t_::fp_len
u16 fp_len
The mask length.
Definition: fib_types.h:206
ip6_address_decode
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
Definition: ip_types_api.c:129
ip_path_mtu_get
static_always_inline ip_pmtu_t * ip_path_mtu_get(index_t index)
Definition: ip_path_mtu.h:115
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:844
vl_api_ip_route_dump_t_handler
static void vl_api_ip_route_dump_t_handler(vl_api_ip_route_dump_t *mp)
Definition: ip_api.c:229
vl_api_ip_mroute_dump_t::context
u32 context
Definition: ip.api:471
vl_api_mfib_signal_dump_t::client_index
u32 client_index
Definition: ip.api:536
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_ip_unnumbered_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index[default=0xffffffff]
Definition: ip.api:517
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
vl_api_ip_route_dump_t
Dump IP routes from a table.
Definition: ip.api:235
vl_api_ip_route_details_t
IP FIB table entry response.
Definition: ip.api:254
fib_route_path_t_::frp_sw_if_index
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:545
vl_api_ip_punt_redirect_v2_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:642
ip6_sv_reass_get
vnet_api_error_t ip6_sv_reass_get(u32 *timeout_ms, u32 *max_reassemblies, u32 *max_reassembly_length, u32 *expire_walk_interval_ms)
get ip6 reassembly configuration
Definition: ip6_sv_reass.c:906
vnet_get_sw_interface
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:58
ip_pmtu_t_
Remote Path MTU tracking object.
Definition: ip_path_mtu.h:72
vl_api_set_ip_flow_hash_t
Set the ip flow hash config for a fib request.
Definition: ip.api:321
ip_walk_ctx_t
struct ip_walk_ctx_t_ ip_walk_ctx_t
mfib_table_entry_paths_update
fib_node_index_t mfib_table_entry_paths_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpaths)
Definition: mfib_table.c:343
vl_api_ip_table_replace_begin_t::table
vl_api_ip_table_t table
Definition: ip.api:121
mfib_entry_flags_t
enum mfib_entry_flags_t_ mfib_entry_flags_t
vl_api_ip_mtable_dump_t
Dump IP multicast fib table.
Definition: ip.api:400
fib_table_lookup
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
Definition: fib_table.c:68
vl_api_ip_table_dump_t::client_index
u32 client_index
Definition: ip.api:95
fib_table_walk
void fib_table_walk(u32 fib_index, fib_protocol_t proto, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
Definition: fib_table.c:1244
ip4_full_reass.h
IPv4 Reassembly.
vl_api_ip_reassembly_set_t::max_reassembly_length
u32 max_reassembly_length
Definition: ip.api:797
clib_error_report
#define clib_error_report(e)
Definition: error.h:113
vl_api_ip_fib_dump_walk_ctx_t
struct vl_api_ip_fib_dump_walk_ctx_t_ vl_api_ip_fib_dump_walk_ctx_t
ip_punt_drop.h
mfib_itf_t_::mfi_sw_if_index
u32 mfi_sw_if_index
The SW IF index that this MFIB interface represents.
Definition: mfib_itf.h:40
vl_api_ip_route_v2_dump_t_handler
static void vl_api_ip_route_v2_dump_t_handler(vl_api_ip_route_v2_dump_t *mp)
Definition: ip_api.c:262
ip4_full_reass_get
vnet_api_error_t ip4_full_reass_get(u32 *timeout_ms, u32 *max_reassemblies, u32 *max_reassembly_length, u32 *expire_walk_interval_ms)
get ip4 reassembly configuration
Definition: ip4_full_reass.c:1457
vl_api_ip_table_details_t::context
u32 context
Definition: ip.api:158
ADDRESS_IP6
@ ADDRESS_IP6
Definition: ip_types.api:23
vl_api_ip_source_and_port_range_check_interface_add_del_t::tcp_in_vrf_id
u32 tcp_in_vrf_id
Definition: ip.api:711
ip4_mfib.h
mfib_table_walk
void mfib_table_walk(u32 fib_index, fib_protocol_t proto, mfib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
Definition: mfib_table.c:829
apt_ip6_fib_show_ctx_t_::entries
fib_node_index_t * entries
Definition: ip_api.c:225
vl_api_ip_punt_redirect_dump_t::is_ipv6
bool is_ipv6
Definition: ip.api:601
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
fib_api_path_encode
void fib_api_path_encode(const fib_route_path_t *rpath, vl_api_fib_path_t *out)
Encode and decode functions from the API types to internal types.
Definition: fib_api.c:349
vl_api_ip_punt_redirect_v2_details_t::context
u32 context
Definition: ip.api:648
mfib_table_t_
A protocol Independent IP multicast FIB table.
Definition: mfib_table.h:71
vl_api_ip_reassembly_enable_disable_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:833
ip_container_proxy.h
ethernet.h
vl_api_ip_container_proxy_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:670
vl_api_ip_mroute_details_t::context
u32 context
Definition: ip.api:480
error
Definition: cJSON.c:88
vl_api_ip_route_v2_dump_t::context
u32 context
Definition: ip.api:245
vl_api_ip_container_proxy_dump_t::context
u32 context
Definition: ip.api:664
ip_prefix_encode
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
Definition: ip_types_api.c:273
i32
signed int i32
Definition: types.h:77
vl_api_ip_reassembly_get_reply_t::context
u32 context
Definition: ip.api:813
ip4_sv_reass_set
vnet_api_error_t ip4_sv_reass_set(u32 timeout_ms, u32 max_reassemblies, u32 max_reassembly_length, u32 expire_walk_interval_ms)
set ip4 reassembly configuration
Definition: ip4_sv_reass.c:1068
mfib_signal_t_
A pair of indicies, for the entry and interface resp.
Definition: mfib_signal.h:29
vl_api_ip_table_add_del_t::table
vl_api_ip_table_t table
Definition: ip.api:57
vnet_sw_interface_t::flags
vnet_sw_interface_flags_t flags
Definition: interface.h:873
fib_path_encode_ctx_t_::rpaths
fib_route_path_t * rpaths
Definition: fib_path.h:221
random_u32
static u32 random_u32(u32 *seed)
32-bit random number generator
Definition: random.h:69
mfib_entry_encode
fib_route_path_t * mfib_entry_encode(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1453
ip_address_encode2
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
Definition: ip_types_api.c:228
mfib_table_entry_paths_remove
void mfib_table_entry_paths_remove(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpaths)
Definition: mfib_table.c:395
ip6_mfib.h
vl_api_ip_route_lookup_reply_t
IP FIB table lookup response.
Definition: ip.api:294
ip_address_decode
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Decode/Encode for struct/union types.
Definition: ip_types_api.c:172
vl_api_mfib_signal_dump_t_handler
static void vl_api_mfib_signal_dump_t_handler(vl_api_mfib_signal_dump_t *mp)
Definition: ip_api.c:1356
vl_api_ip_table_details_t::table
vl_api_ip_table_t table
Definition: ip.api:159
vl_api_set_ip_flow_hash_router_id_t
Set the ip flow hash router ID.
Definition: ip.api:376
ip_source_and_port_range_check.h
vl_api_sw_interface_ip6_enable_disable_t_handler
static void vl_api_sw_interface_ip6_enable_disable_t_handler(vl_api_sw_interface_ip6_enable_disable_t *mp)
Definition: ip_api.c:60
vl_api_ip_reassembly_set_t::type
vl_api_ip_reass_type_t type
Definition: ip.api:800
vnet_sw_interface_t::sw_if_index
u32 sw_if_index
Definition: interface.h:876
vl_api_ip_punt_redirect_v2_dump_t::context
u32 context
Definition: ip.api:641
vl_api_ip_source_and_port_range_check_interface_add_del_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:710
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
vl_api_ip_reassembly_enable_disable_t
Enable/disable reassembly feature.
Definition: ip.api:829
ip_punt_redirect_rx_t_::fproto
fib_protocol_t fproto
Definition: ip_punt_drop.h:219
ip6_full_reass_enable_disable
vnet_api_error_t ip6_full_reass_enable_disable(u32 sw_if_index, u8 enable_disable)
Definition: ip6_full_reass.c:1689
ip_route_add_del_v2_t_handler
static int ip_route_add_del_v2_t_handler(vl_api_ip_route_add_del_v2_t *mp, u32 *stats_index)
Definition: ip_api.c:723
vl_api_ip_reassembly_get_t
Definition: ip.api:803
vl_api_ioam_enable_t::analyse
bool analyse
Definition: ip.api:767
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
ip_table_delete
void ip_table_delete(fib_protocol_t fproto, u32 table_id, u8 is_api)
Definition: ip_api.c:565
vl_api_ip_source_and_port_range_check_add_del_t
Configure IP source and L4 port-range check.
Definition: ip.api:686
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(ip_api_hookup)
fib_entry_flag_t
enum fib_entry_flag_t_ fib_entry_flag_t
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_ioam_enable_t::pot_enable
bool pot_enable
Definition: ip.api:768
vl_api_ip_mroute_add_del_t::route
vl_api_ip_mroute_t route
Definition: ip.api:456
ip6_sv_reass.h
IPv6 shallow virtual reassembly.
ip4_sv_reass.h
IPv4 shallow virtual reassembly.
ip_address_family_decode
int ip_address_family_decode(vl_api_address_family_t af, ip_address_family_t *out)
Conversion functions to/from (decode/encode) API types to VPP internal types.
Definition: ip_types_api.c:20
ip6_hop_by_hop.h
vl_api_ip_dump_t_handler
static void vl_api_ip_dump_t_handler(vl_api_ip_dump_t *mp)
Definition: ip_api.c:1229
vl_api_ip_mroute_add_del_t
Definition: ip.api:450
vl_api_ip_punt_redirect_v2_dump_t
Definition: ip.api:638
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
vl_api_ip_route_add_del_t_handler
void vl_api_ip_route_add_del_t_handler(vl_api_ip_route_add_del_t *mp)
Definition: ip_api.c:775
vl_api_ip_table_replace_end_t::table
vl_api_ip_table_t table
Definition: ip.api:136
vl_api_ip_fib_dump_walk
static fib_table_walk_rc_t vl_api_ip_fib_dump_walk(fib_node_index_t fei, void *arg)
Definition: ip_api.c:130
ip6_address_encode
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
Definition: ip_types_api.c:123
vl_api_ip_route_add_del_v2_t
Definition: ip.api:206
ip_path_mtu_update
int ip_path_mtu_update(const ip_address_t *nh, u32 table_id, u16 pmtu)
Definition: ip_path_mtu.c:647
vl_api_add_del_ip_punt_redirect_v2_t
Add IP punt redirect rule.
Definition: ip.api:630
vl_api_ip_route_lookup_reply_t::route
vl_api_ip_route_t route
Definition: ip.api:298
vl_api_ip_route_v2_dump_t::src
u8 src
Definition: ip.api:247
set_ip_source_and_port_range_check
int set_ip_source_and_port_range_check(vlib_main_t *vm, u32 *fib_index, u32 sw_if_index, u32 is_add)
Definition: ip4_source_and_port_range_check.c:592
vl_api_ip_source_and_port_range_check_interface_add_del_t::tcp_out_vrf_id
u32 tcp_out_vrf_id
Definition: ip.api:712
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
vl_api_ip_container_proxy_details_t::context
u32 context
Definition: ip.api:669
vl_api_ip_details_t
Definition: ip.api:520
fib_table_t_::ft_table_id
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
vl_api_ip_container_proxy_add_del_t
Definition: ip.api:652
vl_api_ip_punt_redirect_details_t
Definition: ip.api:604
vl_api_mfib_signal_dump_t
Definition: ip.api:534
ip_table.h
send_ip_details
static void send_ip_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 sw_if_index, u8 is_ipv6, u32 context)
Definition: ip_api.c:1066
mfib_entry_get_fib_index
u32 mfib_entry_get_fib_index(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1499
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
vl_api_set_ip_flow_hash_router_id_t_handler
static void vl_api_set_ip_flow_hash_router_id_t_handler(vl_api_set_ip_flow_hash_router_id_t *mp)
Definition: ip_api.c:1306
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
hash_get
#define hash_get(h, key)
Definition: hash.h:249
fib_table_t_::ft_desc
u8 * ft_desc
Table description.
Definition: fib_table.h:122
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
vl_api_add_del_ip_punt_redirect_v2_t_handler
static void vl_api_add_del_ip_punt_redirect_v2_t_handler(vl_api_add_del_ip_punt_redirect_v2_t *mp, vlib_main_t *vm)
Definition: ip_api.c:499
mfib_api_table_id_decode
int mfib_api_table_id_decode(fib_protocol_t fproto, u32 table_id, u32 *fib_index)
Definition: mfib_api.c:109
ip6_punt_policer_add_del
void ip6_punt_policer_add_del(u8 is_add, u32 policer_index)
Definition: ip6_punt_drop.c:186
vnet_ip_table_function_priority_t
enum vnet_ip_table_function_priority_t_ vnet_ip_table_function_priority_t
flow_hash_config_t
enum flow_hash_config_t_ flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
vl_api_ip_route_lookup_t
Lookup IP route from a table.
Definition: ip.api:272
IP_SOURCE_AND_PORT_RANGE_CHECK_N_PROTOCOLS
@ IP_SOURCE_AND_PORT_RANGE_CHECK_N_PROTOCOLS
Definition: ip_source_and_port_range_check.h:35
vl_api_set_ip_flow_hash_v2_t::af
vl_api_address_family_t af
Definition: ip.api:365
vl_api_ip_mtable_dump_t::context
u32 context
Definition: ip.api:403
FIB_ENTRY_FLAG_NONE
@ FIB_ENTRY_FLAG_NONE
Definition: fib_entry.h:112
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
ip_flow_hash_set
int ip_flow_hash_set(ip_address_family_t af, u32 table_id, u32 flow_hash_config)
Definition: ip.c:192
vl_api_ip_route_add_del_v2_t_handler
void vl_api_ip_route_add_del_v2_t_handler(vl_api_ip_route_add_del_v2_t *mp)
Definition: ip_api.c:792
ip_punt_redirect_walk_cb_t
walk_rc_t(* ip_punt_redirect_walk_cb_t)(u32 rx_sw_if_index, const ip_punt_redirect_rx_t *redirect, void *arg)
Definition: ip_punt_drop.h:281
vl_api_ip_mtable_details_t
Definition: ip.api:405
ip_prefix_decode
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
Definition: ip_types_api.c:245
vl_api_ip_reassembly_enable_disable_t::type
vl_api_ip_reass_type_t type
Definition: ip.api:836
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
REPLY_MACRO_DETAILS4
#define REPLY_MACRO_DETAILS4(t, rp, context, body)
Definition: api_helper_macros.h:132
fib_api_route_add_del
int fib_api_route_add_del(u8 is_add, u8 is_multipath, u32 fib_index, const fib_prefix_t *prefix, fib_source_t src, fib_entry_flag_t entry_flags, fib_route_path_t *rpaths)
Adding routes from the API.
Definition: fib_api.c:450
vl_api_set_ip_flow_hash_t_handler
static void vl_api_set_ip_flow_hash_t_handler(vl_api_set_ip_flow_hash_t *mp)
Definition: ip_api.c:1270
uword
u64 uword
Definition: types.h:112
vl_api_ip_route_v2_dump_t::client_index
u32 client_index
Definition: ip.api:244
mfib_route_dump_walk
static walk_rc_t mfib_route_dump_walk(fib_node_index_t fei, void *arg)
Definition: ip_api.c:347
fib_table_flush
void fib_table_flush(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Flush all entries from a table for the source.
Definition: fib_table.c:1449
vl_api_set_ip_flow_hash_v2_t::flow_hash_config
vl_api_ip_flow_hash_config_t flow_hash_config
Definition: ip.api:366
vl_api_ip_route_v2_details_t::context
u32 context
Definition: ip.api:262
ip6_main_t::mfibs
struct mfib_table_t_ * mfibs
Vector of MFIBs.
Definition: ip6.h:121
vl_api_ip_route_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:202
vl_api_ip_table_replace_end_t
IP table replace end.
Definition: ip.api:132
REPLY_MSG_ID_BASE
#define REPLY_MSG_ID_BASE
Definition: ip_api.c:55
vl_api_ip_punt_redirect_v2_dump_t_handler
static void vl_api_ip_punt_redirect_v2_dump_t_handler(vl_api_ip_punt_redirect_v2_dump_t *mp)
Definition: ip_api.c:1999
vlibapi_get_main
static api_main_t * vlibapi_get_main(void)
Definition: api_common.h:390
mfib_table_flush
void mfib_table_flush(u32 mfib_index, fib_protocol_t proto, mfib_source_t source)
Flush all entries from a table for the source.
Definition: mfib_table.c:662
vl_api_ip_reassembly_get_reply_t::is_ip6
bool is_ip6
Definition: ip.api:819
interface.h
vl_api_ip_punt_redirect_t::is_add
bool is_add[default=true]
Definition: ip.api:593
ip_table_get_unused_id
u32 ip_table_get_unused_id(fib_protocol_t fproto)
Definition: ip_api.c:608
vl_api_ip_route_lookup_v2_t::exact
u8 exact
Definition: ip.api:286
ip6_punt_redirect_add_paths
void ip6_punt_redirect_add_paths(u32 rx_sw_if_index, const fib_route_path_t *paths)
Definition: ip6_punt_drop.c:309
vl_api_ip_route_add_del_reply_t::stats_index
u32 stats_index
Definition: ip.api:219
mroute_add_del_handler
static u32 mroute_add_del_handler(u8 is_add, u8 is_multipath, u32 fib_index, const mfib_prefix_t *prefix, u32 entry_flags, u32 rpf_id, fib_route_path_t *rpaths)
Definition: ip_api.c:969
vl_api_ip_punt_redirect_t_handler
static void vl_api_ip_punt_redirect_t_handler(vl_api_ip_punt_redirect_t *mp, vlib_main_t *vm)
Definition: ip_api.c:467
vl_api_ip_table_add_del_t_handler
void vl_api_ip_table_add_del_t_handler(vl_api_ip_table_add_del_t *mp)
Definition: ip_api.c:631
mfib_table_mark
void mfib_table_mark(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Resync all entries from a table for the source this is the mark part of the mark and sweep algorithm.
Definition: mfib_table.c:698
vl_api_mfib_signal_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:543
mfib_table_sweep
void mfib_table_sweep(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Signal that the table has converged, i.e.
Definition: mfib_table.c:731
vl_api_ip_unnumbered_details_t::ip_sw_if_index
vl_api_interface_index_t ip_sw_if_index
Definition: ip.api:507
mfib_table_get
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:30
vl_api_ip_address_details_t::prefix
vl_api_address_with_prefix_t prefix
Definition: ip.api:488
vl_api_ip_container_proxy_dump_t::client_index
u32 client_index
Definition: ip.api:663
REPLY_AND_DETAILS_MACRO
#define REPLY_AND_DETAILS_MACRO(t, p, body)
Definition: api_helper_macros.h:204
fib_table_t_::ft_flags
fib_table_flags_t ft_flags
Table flags.
Definition: fib_table.h:81
vl_api_ip_container_proxy_details_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:671
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
FIB_TABLE_FLAG_IP6_LL
@ FIB_TABLE_FLAG_IP6_LL
Definition: fib_table.h:61
vl_api_ip_address_dump_t::context
u32 context
Definition: ip.api:494
VNET_SW_INTERFACE_FLAG_UNNUMBERED
@ VNET_SW_INTERFACE_FLAG_UNNUMBERED
Definition: interface.h:851
ip6_main_t::fibs
struct fib_table_t_ * fibs
Definition: ip6.h:115
vl_api_ip_mfib_dump_ctx_t_
Definition: ip_api.c:341
vl_api_sw_interface_ip6_enable_disable_t::enable
bool enable
Definition: ip.api:394
vl_api_ip_mroute_add_del_t_handler
void vl_api_ip_mroute_add_del_t_handler(vl_api_ip_mroute_add_del_t *mp)
Definition: ip_api.c:1049
vl_api_ip_route_lookup_v2_t::table_id
u32 table_id
Definition: ip.api:285
vl_api_ip_reassembly_set_t::max_reassemblies
u32 max_reassemblies
Definition: ip.api:796
vl_api_ip_table_allocate_reply_t::table
vl_api_ip_table_t table
Definition: ip.api:86
src
vl_api_address_t src
Definition: gre.api:54
nh
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
vl_api_ip_table_dump_t_handler
static void vl_api_ip_table_dump_t_handler(vl_api_ip_table_dump_t *mp)
Definition: ip_api.c:99
vl_api_ip_unnumbered_dump_t::client_index
u32 client_index
Definition: ip.api:515
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
ip_punt_redirect_rx_t_
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location.
Definition: ip_punt_drop.h:212
mfib_signal_t_::mfs_itf
index_t mfs_itf
Definition: mfib_signal.h:32
ip4_full_reass_enable_disable
vnet_api_error_t ip4_full_reass_enable_disable(u32 sw_if_index, u8 enable_disable)
Definition: ip4_full_reass.c:1705
call_elf_section_ip_table_callbacks
static clib_error_t * call_elf_section_ip_table_callbacks(vnet_main_t *vnm, u32 table_id, u32 flags, _vnet_ip_table_function_list_elt_t **elts)
Definition: ip_api.c:539
ip4_address_t
Definition: ip4_packet.h:50
vl_api_ip_unnumbered_details_t::context
u32 context
Definition: ip.api:505
vl_api_ip_punt_redirect_t::punt
vl_api_punt_redirect_t punt
Definition: ip.api:592
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
clib_min
#define clib_min(x, y)
Definition: clib.h:342
IP46_TYPE_IP6
@ IP46_TYPE_IP6
Definition: ip46_address.h:27
vl_api_ip_route_add_del_v2_reply_t::stats_index
u32 stats_index
Definition: ip.api:226
FIB_ENTRY_FLAG_LOCAL
@ FIB_ENTRY_FLAG_LOCAL
Definition: fib_entry.h:117
api_mroute_add_del_t_handler
static int api_mroute_add_del_t_handler(vl_api_ip_mroute_add_del_t *mp, u32 *stats_index)
Definition: ip_api.c:1003
vl_api_ip_mtable_details_t::context
u32 context
Definition: ip.api:408
mfib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
ip_punt_redirect_walk
void ip_punt_redirect_walk(fib_protocol_t fproto, ip_punt_redirect_walk_cb_t cb, void *ctx)
Definition: ip_punt_drop.c:158
fib_api.h
vnet_interface_main_t::sw_interfaces
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:1015
vl_api_ip_punt_police_t::is_add
bool is_add[default=true]
Definition: ip.api:562
fib_prefix_t_::fp_addr
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:225
mfib_table_unlock
void mfib_table_unlock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Take a reference counting lock on the table.
Definition: mfib_table.c:777
vl_api_ip_punt_redirect_details_t::punt
vl_api_punt_redirect_t punt
Definition: ip.api:607
vl_api_mfib_signal_details_t::ip_packet_len
u16 ip_packet_len
Definition: ip.api:546
vl_api_ip_route_lookup_v2_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:287
fib_api_table_id_decode
int fib_api_table_id_decode(fib_protocol_t fproto, u32 table_id, u32 *fib_index)
Definition: fib_api.c:35
ip4_punt_policer_add_del
void ip4_punt_policer_add_del(u8 is_add, u32 policer_index)
Definition: ip4_punt_drop.c:244
ip_address_decode2
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
Definition: ip_types_api.c:178
mfib_api_path_encode
void mfib_api_path_encode(const fib_route_path_t *in, vl_api_mfib_path_t *out)
Encode and decode functions from the API types to internal types.
Definition: mfib_api.c:53
vl_api_ip_punt_redirect_dump_t::context
u32 context
Definition: ip.api:599
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
vnet_sw_interface_t::unnumbered_sw_if_index
u32 unnumbered_sw_if_index
Definition: interface.h:884
vl_api_ip_reassembly_get_reply_t::retval
i32 retval
Definition: ip.api:814
n_paths
u8 n_paths
Definition: ip.api:176
ip6_full_reass_set
vnet_api_error_t ip6_full_reass_set(u32 timeout_ms, u32 max_reassemblies, u32 max_reassembly_length, u32 expire_walk_interval_ms)
set ip6 reassembly configuration
Definition: ip6_full_reass.c:1369
ip_punt_redirect_rx_t_::pl
fib_node_index_t pl
Definition: ip_punt_drop.h:221
fib_path_list_walk_w_ext
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
Definition: fib_path_list.c:1401
vl_api_ip_table_flush_t_handler
static void vl_api_ip_table_flush_t_handler(vl_api_ip_table_flush_t *mp)
Definition: ip_api.c:1696
vl_api_ioam_disable_t_handler
static void vl_api_ioam_disable_t_handler(vl_api_ioam_disable_t *mp)
Definition: ip_api.c:1461
ip6_main
ip6_main_t ip6_main
Definition: ip6_forward.c:2785
api_main_t
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:228
vl_api_ip_reassembly_get_reply_t::timeout_ms
u32 timeout_ms
Definition: ip.api:815
ip_punt_redirect_find
index_t ip_punt_redirect_find(fib_protocol_t fproto, u32 rx_sw_if_index)
Definition: ip_punt_drop.c:59
vnet_sw_if_index_is_api_valid
static uword vnet_sw_if_index_is_api_valid(u32 sw_if_index)
Definition: api_helper_macros.h:276
mfib_table_find_or_create_and_lock_w_name
u32 mfib_table_find_or_create_and_lock_w_name(fib_protocol_t proto, u32 table_id, mfib_source_t src, const u8 *name)
Get the index of the FIB for a Table-ID.
Definition: mfib_table.c:622
ip6_full_reass_get
vnet_api_error_t ip6_full_reass_get(u32 *timeout_ms, u32 *max_reassemblies, u32 *max_reassembly_length, u32 *expire_walk_interval_ms)
get ip6 reassembly configuration
Definition: ip6_full_reass.c:1407
vl_api_ip_unnumbered_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:506
vl_api_ip_mroute_dump_t_handler
static void vl_api_ip_mroute_dump_t_handler(vl_api_ip_mroute_dump_t *mp)
Definition: ip_api.c:396
fib_table_lookup_exact_match
fib_node_index_t fib_table_lookup_exact_match(u32 fib_index, const fib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
Definition: fib_table.c:97
ip6_ioam_enable
clib_error_t * ip6_ioam_enable(int has_trace_option, int has_pot_option, int has_seqno_option, int has_analyse_option)
Definition: ip6_hop_by_hop.c:1276
vl_api_ip_unnumbered_details_t
IP unnumbered configurations.
Definition: ip.api:503
vl_api_ioam_enable_t
IOAM enable : Enable in-band OAM.
Definition: ip.api:761
ip_pmtu_get_table_id
u32 ip_pmtu_get_table_id(const ip_pmtu_t *ipt)
Definition: ip_path_mtu.c:114
vl_api_ip_reassembly_enable_disable_t::enable_ip4
bool enable_ip4
Definition: ip.api:834
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vl_api_ip_reassembly_set_t::is_ip6
bool is_ip6
Definition: ip.api:799
mfib_entry_cmp_for_sort
int mfib_entry_cmp_for_sort(void *i1, void *i2)
Definition: mfib_entry.c:1313
mfib_itf_get
static mfib_itf_t * mfib_itf_get(index_t mi)
Get the MFIB interface representation.
Definition: mfib_itf.h:83
vl_api_ip_mroute_dump_t::client_index
u32 client_index
Definition: ip.api:470
vl_api_ip_punt_redirect_v2_details_t::punt
vl_api_punt_redirect_v2_t punt
Definition: ip.api:649
vl_api_ip_path_mtu_get_t
Definition: ip.api:863
ip_pmtu_pool
ip_pmtu_t * ip_pmtu_pool
Path MTU tracker pool.
Definition: ip_path_mtu.c:67
vl_api_set_ip_flow_hash_t::vrf_id
u32 vrf_id
Definition: ip.api:326
vl_api_ioam_enable_t_handler
static void vl_api_ioam_enable_t_handler(vl_api_ioam_enable_t *mp)
Definition: ip_api.c:1441
fib_path_list.h
vl_api_mfib_signal_details_t::table_id
u32 table_id
Definition: ip.api:544
vl_api_set_ip_flow_hash_v2_t::table_id
u32 table_id
Definition: ip.api:364
FIB_ENTRY_FLAG_CONNECTED
@ FIB_ENTRY_FLAG_CONNECTED
Definition: fib_entry.h:113
vl_api_ip_mfib_dump_ctx_t
struct vl_api_ip_mfib_dump_ctx_t_ vl_api_ip_mfib_dump_ctx_t
format_fns.h
mfib_table_t_::mft_proto
fib_protocol_t mft_proto
Which protocol this table serves.
Definition: mfib_table.h:92
mfib_table_find
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:555
vl_api_ip_route_lookup_v2_reply_t::route
vl_api_ip_route_v2_t route
Definition: ip.api:305
vl_api_ip_dump_t::context
u32 context
Definition: ip.api:530
vl_api_can_send_msg
static int vl_api_can_send_msg(vl_api_registration_t *rp)
Definition: api.h:48
vl_api_ip_route_dump_t::table
vl_api_ip_table_t table
Definition: ip.api:239
ip_api_hookup
static clib_error_t * ip_api_hookup(vlib_main_t *vm)
Definition: ip_api.c:2096
mfib_table_get_table_id
u32 mfib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
Definition: mfib_table.c:544
vl_api_ip_container_proxy_add_del_t::pfx
vl_api_prefix_t pfx
Definition: ip.api:656
fib_table_get_index_for_sw_if_index
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
Definition: fib_table.c:1003
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
foreach_flow_hash_bit_v1
#define foreach_flow_hash_bit_v1
Definition: ip_flow_hash.h:24
vl_api_ioam_enable_t::trace_enable
bool trace_enable
Definition: ip.api:769
vl_api_ip_table_allocate_t::table
vl_api_ip_table_t table
Definition: ip.api:78
vl_api_ip_route_v2_details_t
Definition: ip.api:259
mfib_table_t_::mft_table_id
u32 mft_table_id
Table ID (hash key) for this FIB.
Definition: mfib_table.h:107
vl_api_ip_unnumbered_dump_t_handler
static void vl_api_ip_unnumbered_dump_t_handler(vl_api_ip_unnumbered_dump_t *mp)
Definition: ip_api.c:1179
mfib_signal_t_::mfs_buffer_len
u8 mfs_buffer_len
Definition: mfib_signal.h:39
ip.h
vl_api_ip_source_and_port_range_check_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:690
u32
unsigned int u32
Definition: types.h:88
vl_api_ip_container_proxy_details_t
Definition: ip.api:667
vl_api_ip_reassembly_get_t::type
vl_api_ip_reass_type_t type
Definition: ip.api:808
vl_api_ip_mroute_add_del_reply_t
Definition: ip.api:458
af
vl_api_address_family_t af
Definition: ip.api:619
vl_api_ip_table_allocate_t
Allocate an unused table A table can be added multiple times.
Definition: ip.api:73
vl_api_ip_address_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:495
fib_table_walk_rc_t
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
vl_api_ip_mroute_details_t
IP Multicast Route Details.
Definition: ip.api:478
ip4_main_t::fibs
struct fib_table_t_ * fibs
Vector of FIBs.
Definition: ip4.h:112
table_id
u32 table_id
Definition: wireguard.api:102
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
vl_api_ioam_enable_t::seqno
bool seqno
Definition: ip.api:766
vl_api_ip_reassembly_get_t::client_index
u32 client_index
Definition: ip.api:805
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
ethernet_types_api.h
vl_api_ip_route_lookup_v2_t_handler
void vl_api_ip_route_lookup_v2_t_handler(vl_api_ip_route_lookup_v2_t *mp)
Definition: ip_api.c:865
fib_path_encode
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, const fib_path_ext_t *path_ext, void *args)
Definition: fib_path.c:2710
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
si
vnet_sw_interface_t * si
Definition: interface_output.c:418
vl_api_ip_route_details_t::context
u32 context
Definition: ip.api:256
vl_api_ip_route_add_del_v2_t::route
vl_api_ip_route_v2_t route
Definition: ip.api:213
ip_container_proxy_send_details
static int ip_container_proxy_send_details(const fib_prefix_t *pfx, u32 sw_if_index, void *args)
Definition: ip_api.c:1399
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
FIB_SOURCE_CLI
@ FIB_SOURCE_CLI
From the CLI.
Definition: fib_source.h:79
vl_api_ip_route_add_del_t::route
vl_api_ip_route_t route
Definition: ip.api:204
send_ip_route_v2_details
static void send_ip_route_v2_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 context, fib_node_index_t fib_entry_index)
Definition: ip_api.c:183
vl_api_set_ip_flow_hash_router_id_t::router_id
u32 router_id
Definition: ip.api:380
vl_api_ip_path_mtu_replace_begin_t
Definition: ip.api:885
vl_api_ip_container_proxy_dump_t_handler
static void vl_api_ip_container_proxy_dump_t_handler(vl_api_ip_container_proxy_dump_t *mp)
Definition: ip_api.c:1423
vl_api_ip_punt_police_t_handler
static void vl_api_ip_punt_police_t_handler(vl_api_ip_punt_police_t *mp, vlib_main_t *vm)
Definition: ip_api.c:431
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
vl_api_sw_interface_ip6_enable_disable_t
IPv6 interface enable / disable request.
Definition: ip.api:389
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
ip_walk_ctx_t_::context
u32 context
Definition: ip_api.c:1395
vl_api_ip_details_t::is_ipv6
bool is_ipv6
Definition: ip.api:524
FIB_SOURCE_API
@ FIB_SOURCE_API
From the control plane API.
Definition: fib_source.h:75
mfib_entry_get_stats_index
u32 mfib_entry_get_stats_index(fib_node_index_t fib_entry_index)
Definition: mfib_entry.c:1345
vnet_ip_container_proxy_add_del
clib_error_t * vnet_ip_container_proxy_add_del(vnet_ip_container_proxy_args_t *args)
Definition: ip_container_proxy.c:47
ip6_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip6.h:112
ip_flow_hash_router_id_set
void ip_flow_hash_router_id_set(u32 router_id)
Definition: ip.c:209
ip_table_create
void ip_table_create(fib_protocol_t fproto, u32 table_id, u8 is_api, const u8 *name)
Definition: ip_api.c:924
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
elt
app_rx_mq_elt_t * elt
Definition: application.c:488
ip6_main_t
Definition: ip6.h:110
ip_punt_redirect_get
static_always_inline ip_punt_redirect_rx_t * ip_punt_redirect_get(index_t rrxi)
Definition: ip_punt_drop.h:288
vl_api_ip_dump_t::client_index
u32 client_index
Definition: ip.api:529
vl_api_ip_punt_redirect_dump_common
static void vl_api_ip_punt_redirect_dump_common(ip_walk_ctx_t *ctx, fib_protocol_t fproto, u32 rx_sw_if_index, ip_punt_redirect_walk_cb_t cb)
Definition: ip_api.c:1958
fib_entry_get_fib_index
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1738
vl_api_ip_dump_t::is_ipv6
bool is_ipv6
Definition: ip.api:531
ip_punt_redirect_t_handler_common
static void ip_punt_redirect_t_handler_common(u8 is_add, u32 rx_sw_if_index, ip_address_family_t af, const fib_route_path_t *rpaths)
Definition: ip_api.c:446
mfib_itf_t_
An interface associated with a particular MFIB entry.
Definition: mfib_itf.h:25
mfib_entry_get_prefix
const mfib_prefix_t * mfib_entry_get_prefix(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1489
ip_lookup_main_t
Definition: lookup.h:121
vl_api_sw_interface_ip6_get_link_local_address_t_handler
static void vl_api_sw_interface_ip6_get_link_local_address_t_handler(vl_api_sw_interface_ip6_get_link_local_address_t *mp)
Definition: ip_api.c:1627
vl_api_ip_address_dump_t_handler
static void vl_api_ip_address_dump_t_handler(vl_api_ip_address_dump_t *mp)
Definition: ip_api.c:1103
vec_sort_with_function
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:1097
vl_api_ip_source_and_port_range_check_add_del_t_handler
static void vl_api_ip_source_and_port_range_check_add_del_t_handler(vl_api_ip_source_and_port_range_check_add_del_t *mp)
Definition: ip_api.c:1479
vl_api_ip_table_details_t
IP FIB table response.
Definition: ip.api:156
ip4_main_t::mfibs
struct mfib_table_t_ * mfibs
Vector of MFIBs.
Definition: ip4.h:115
fib_entry_encode
fib_route_path_t * fib_entry_encode(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1698
FIB_TABLE_WALK_CONTINUE
@ FIB_TABLE_WALK_CONTINUE
Continue on to the next entry.
Definition: fib_table.h:916
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_ip_route_add_del_v2_t::is_add
bool is_add[default=true]
Definition: ip.api:211
vl_api_ip_path_mtu_replace_end_t_handler
void vl_api_ip_path_mtu_replace_end_t_handler(vl_api_ip_path_mtu_replace_end_t *mp)
Definition: ip_api.c:2054
ip_address_encode
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
Definition: ip_types_api.c:206
vl_api_ip_reassembly_set_t
Definition: ip.api:791
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
ip4_punt_redirect_del
void ip4_punt_redirect_del(u32 rx_sw_if_index)
Definition: ip4_punt_drop.c:327
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vl_api_ip_source_and_port_range_check_add_del_t::number_of_ranges
u8 number_of_ranges
Definition: ip.api:692
vl_api_ip_source_and_port_range_check_interface_add_del_t_handler
static void vl_api_ip_source_and_port_range_check_interface_add_del_t_handler(vl_api_ip_source_and_port_range_check_interface_add_del_t *mp)
Definition: ip_api.c:1555
vl_api_ip_punt_police_t::is_ip6
bool is_ip6
Definition: ip.api:563
IP_REASS_TYPE_FULL
@ IP_REASS_TYPE_FULL
Definition: ip.api:787
mfib_signal.h
ip
vl_api_address_t ip
Definition: l2.api:558
vl_api_ip_route_lookup_v2_reply_t
Definition: ip.api:300
send_ip_mtable_details
static void send_ip_mtable_details(vl_api_registration_t *reg, u32 context, const mfib_table_t *mfib_table)
Definition: ip_api.c:301
vl_api_ip_mroute_dump_t::table
vl_api_ip_table_t table
Definition: ip.api:472
vl_api_add_del_ip_punt_redirect_v2_t::punt
vl_api_punt_redirect_v2_t punt
Definition: ip.api:635
vl_api_ip_reassembly_get_reply_t::expire_walk_interval_ms
u32 expire_walk_interval_ms
Definition: ip.api:818
mfib_table_entry_update
fib_node_index_t mfib_table_entry_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
Add a new (with no replication) or lock an existing entry.
Definition: mfib_table.c:237
arp_packet.h
vl_api_ip_path_mtu_update_t_handler
void vl_api_ip_path_mtu_update_t_handler(vl_api_ip_path_mtu_update_t *mp)
Definition: ip_api.c:2027
vl_api_ip_route_lookup_t_handler
void vl_api_ip_route_lookup_t_handler(vl_api_ip_route_lookup_t *mp)
Definition: ip_api.c:809
vl_api_ip_mtable_details_t::table
vl_api_ip_table_t table
Definition: ip.api:409
vl_api_ip_route_add_del_t
Add / del route request.
Definition: ip.api:198
fib_table_unlock
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
Definition: fib_table.c:1342
vl_api_ip_table_flush_t
IP table flush Flush a table of all routes.
Definition: ip.api:145
ip46_type_t
ip46_type_t
Definition: ip46_address.h:22
i
int i
Definition: flowhash_template.h:376
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
vl_api_ip_source_and_port_range_check_interface_add_del_t
Set interface source and L4 port-range request.
Definition: ip.api:705
ip_pmtu_t_::ipt_cfg_pmtu
u16 ipt_cfg_pmtu
Configured MTU.
Definition: ip_path_mtu.h:83
vl_api_ip_punt_redirect_details_t::context
u32 context
Definition: ip.api:606
vl_api_sw_interface_ip6_set_link_local_address_t_handler
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:1610
vl_api_ip_route_add_del_v2_t::is_multipath
bool is_multipath
Definition: ip.api:212
vl_api_ip_reassembly_get_t::context
u32 context
Definition: ip.api:806
vl_api_mfib_signal_details_t
Definition: ip.api:540
vl_api_ip_reassembly_set_t::expire_walk_interval_ms
u32 expire_walk_interval_ms
Definition: ip.api:798
vl_api_ip_path_mtu_get_t::context
u32 context
Definition: ip.api:866
vl_api_ip_source_and_port_range_check_interface_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:709
fib_source_t
enum fib_source_t_ fib_source_t
The different sources that can create a route.
context
u32 context
Definition: ip.api:852
vl_api_ip_punt_redirect_dump_t_handler
static void vl_api_ip_punt_redirect_dump_t_handler(vl_api_ip_punt_redirect_dump_t *mp)
Definition: ip_api.c:1978
rv
int __clib_unused rv
Definition: application.c:491
vl_api_ip_table_flush_t::table
vl_api_ip_table_t table
Definition: ip.api:149
vl_api_ip_punt_redirect_t
IP punt redirect.
Definition: ip.api:587
VNET_IP_TABLE_FUNC_PRIORITY_LOW
@ VNET_IP_TABLE_FUNC_PRIORITY_LOW
Definition: ip_table.h:23
IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_UDP_OUT
@ IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_UDP_OUT
Definition: ip_source_and_port_range_check.h:32
vl_api_ip_container_proxy_dump_t
Definition: ip.api:661
vrf_id
u32 vrf_id
Definition: nat44_ed.api:1053
vl_api_ip_details_t::context
u32 context
Definition: ip.api:522
vl_api_ip_mroute_details_t::route
vl_api_ip_mroute_t route
Definition: ip.api:481
ip_interface_address_t
Definition: lookup.h:89
vl_api_ip_source_and_port_range_check_add_del_t::high_ports
u16 high_ports[32]
Definition: ip.api:694
mfib_signal_t_::mfs_entry
fib_node_index_t mfs_entry
Definition: mfib_signal.h:31
ip4_full_reass_set
vnet_api_error_t ip4_full_reass_set(u32 timeout_ms, u32 max_reassemblies, u32 max_reassembly_length, u32 expire_walk_interval_ms)
set ip4 reassembly configuration
Definition: ip4_full_reass.c:1419
mfib_api.h
vnet.h
fib_table_t_::ft_proto
fib_protocol_t ft_proto
Which protocol this table serves.
Definition: fib_table.h:76
api_errno.h
apt_ip6_fib_show_ctx_t_
Definition: ip_api.c:223
vl_api_ip_route_v2_details_t::route
vl_api_ip_route_v2_t route
Definition: ip.api:263
vl_api_ip_address_dump_t::is_ipv6
bool is_ipv6
Definition: ip.api:496
mfib_signal_t_::mfs_buffer
u8 mfs_buffer[MFIB_SIGNAL_BUFFER_SIZE]
A buffer copied from the DP plane that triggered the signal.
Definition: mfib_signal.h:37
vl_api_ip_table_dump_t
Dump IP all fib tables.
Definition: ip.api:93
vl_api_ip_container_proxy_add_del_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:657
fib_table_entry_get_stats_index
u32 fib_table_entry_get_stats_index(u32 fib_index, const fib_prefix_t *prefix)
Return the stats index for a FIB entry.
Definition: fib_table.c:936
vl_api_ip_route_add_del_v2_reply_t
Definition: ip.api:221
vl_api_ip_source_and_port_range_check_add_del_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:691
vl_api_ip_reassembly_get_reply_t::max_reassembly_length
u32 max_reassembly_length
Definition: ip.api:817
vl_api_ip_table_replace_begin_t
IP table replace being.
Definition: ip.api:117
vl_api_ip_route_lookup_t::exact
u8 exact
Definition: ip.api:277
ip4_source_and_port_range_check_add_del
int ip4_source_and_port_range_check_add_del(ip4_address_t *address, u32 length, u32 vrf_id, u16 *low_ports, u16 *high_ports, int is_add)
Definition: ip4_source_and_port_range_check.c:1111
ADDRESS_IP4
@ ADDRESS_IP4
Definition: ip_types.api:22
ip4_punt_redirect_add_paths
void ip4_punt_redirect_add_paths(u32 rx_sw_if_index, const fib_route_path_t *paths)
Definition: ip4_punt_drop.c:316
send_ip_route_details
static void send_ip_route_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 context, fib_node_index_t fib_entry_index)
Definition: ip_api.c:140
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
PREDICT_TRUE
#define PREDICT_TRUE(x)
Definition: clib.h:125
ip4_main_t
IPv4 main type.
Definition: ip4.h:107
vl_api_ip_container_proxy_add_del_t_handler
static void vl_api_ip_container_proxy_add_del_t_handler(vl_api_ip_container_proxy_add_del_t *mp)
Definition: ip_api.c:1370
fib_api_path_decode
int fib_api_path_decode(vl_api_fib_path_t *in, fib_route_path_t *out)
Definition: fib_api.c:141
fib_table_find
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:1111
vl_api_ip_route_lookup_t::table_id
u32 table_id
Definition: ip.api:276
vl_api_ip_reassembly_enable_disable_t::enable_ip6
bool enable_ip6
Definition: ip.api:835
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
clear_ioam_rewrite_fn
clib_error_t * clear_ioam_rewrite_fn(void)
Definition: ip6_hop_by_hop.c:1224
vl_api_mfib_signal_dump_t::context
u32 context
Definition: ip.api:537
vl_api_ip_source_and_port_range_check_interface_add_del_t::udp_out_vrf_id
u32 udp_out_vrf_id
Definition: ip.api:714
vl_api_ip_punt_redirect_dump_t::client_index
u32 client_index
Definition: ip.api:598
ip_types_api.h
ip_path_mtu.h
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
send_ip_punt_redirect_details
static walk_rc_t send_ip_punt_redirect_details(u32 rx_sw_if_index, const ip_punt_redirect_rx_t *ipr, void *arg)
Definition: ip_api.c:1884
ip4_sv_reass_enable_disable
vnet_api_error_t ip4_sv_reass_enable_disable(u32 sw_if_index, u8 enable_disable)
Definition: ip4_sv_reass.c:1354
rpf_id
u32 rpf_id
Definition: fib_types.api:119
vl_api_ip_table_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:56
vl_api_ip_route_details_t::route
vl_api_ip_route_t route
Definition: ip.api:257
fib_proto_to_ip46
ip46_type_t fib_proto_to_ip46(fib_protocol_t fproto)
Convert from fib_protocol to ip46_type.
Definition: fib_types.c:393
WALK_STOP
@ WALK_STOP
Definition: interface_funcs.h:173
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
vl_api_ip_path_mtu_get_t_handler
static void vl_api_ip_path_mtu_get_t_handler(vl_api_ip_path_mtu_get_t *mp)
Definition: ip_api.c:2083
fib_entry_get_best_source
fib_source_t fib_entry_get_best_source(fib_node_index_t entry_index)
Definition: fib_entry.c:1505
FIB_ROUTE_PATH_LOCAL
@ FIB_ROUTE_PATH_LOCAL
A for-us/local path.
Definition: fib_types.h:344
vl_api_ip_reassembly_get_t::is_ip6
bool is_ip6
Definition: ip.api:807
vl_api_ip_path_mtu_details_t
Definition: ip.api:875
ip_route_add_del_t_handler
static int ip_route_add_del_t_handler(vl_api_ip_route_add_del_t *mp, u32 *stats_index)
Definition: ip_api.c:675
IP_REASS_TYPE_SHALLOW_VIRTUAL
@ IP_REASS_TYPE_SHALLOW_VIRTUAL
Definition: ip.api:788
fib_table_walk_w_src
void fib_table_walk_w_src(u32 fib_index, fib_protocol_t proto, fib_source_t src, fib_table_walk_fn_t fn, void *data)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
Definition: fib_table.c:1284
vl_api_ip_table_add_del_t
Add / del table request A table can be added multiple times, but need be deleted only once.
Definition: ip.api:52
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
vl_api_ip_route_add_del_t::is_multipath
bool is_multipath
Definition: ip.api:203
send_ip_address_details
static void send_ip_address_details(vpe_api_main_t *am, vl_api_registration_t *reg, const fib_prefix_t *pfx, u32 sw_if_index, u32 context)
Definition: ip_api.c:1084
vl_api_add_del_ip_punt_redirect_v2_t::is_add
bool is_add[default=true]
Definition: ip.api:634
vl_api_ip_source_and_port_range_check_interface_add_del_t::udp_in_vrf_id
u32 udp_in_vrf_id
Definition: ip.api:713
REPLY_MACRO3_ZERO
#define REPLY_MACRO3_ZERO(t, n, body)
Definition: api_helper_macros.h:157
vnet_ip_container_proxy_args_t
struct _vnet_ip_container_proxy_args vnet_ip_container_proxy_args_t
vl_api_ip_reassembly_get_reply_t
Definition: ip.api:811
prefix
vl_api_prefix_t prefix
Definition: ip.api:175
send_ip_punt_redirect_v2_details
static walk_rc_t send_ip_punt_redirect_v2_details(u32 rx_sw_if_index, const ip_punt_redirect_rx_t *ipr, void *arg)
Definition: ip_api.c:1917
vpe_api_main
vpe_api_main_t vpe_api_main
Definition: interface_api.c:47
IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_TCP_IN
@ IP_SOURCE_AND_PORT_RANGE_CHECK_PROTOCOL_TCP_IN
Definition: ip_source_and_port_range_check.h:33
ip_address_family_t
enum ip_address_family_t_ ip_address_family_t
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
random_default_seed
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
Definition: random.h:91
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
vl_mfib_signal_send_one
void vl_mfib_signal_send_one(vl_api_registration_t *reg, u32 context, const mfib_signal_t *mfs)
Definition: ip_api.c:1318