FD.io VPP  v21.06-3-gbb25fbf28
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/vnet_msg_enum.h>
52 
53 #define vl_typedefs /* define message structures */
54 #include <vnet/vnet_all_api_h.h>
55 #undef vl_typedefs
56 
57 #define vl_endianfun /* define message structures */
58 #include <vnet/vnet_all_api_h.h>
59 #undef vl_endianfun
60 
61 /* instantiate all the print functions we know about */
62 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
63 #define vl_printfun
64 #include <vnet/vnet_all_api_h.h>
65 #undef vl_printfun
66 
68 
69 #include <vnet/format_fns.h>
70 
71 #define foreach_ip_api_msg \
72  _ (SW_INTERFACE_IP6_ENABLE_DISABLE, sw_interface_ip6_enable_disable) \
73  _ (IP_TABLE_DUMP, ip_table_dump) \
74  _ (IP_ROUTE_DUMP, ip_route_dump) \
75  _ (IP_ROUTE_V2_DUMP, ip_route_v2_dump) \
76  _ (IP_MTABLE_DUMP, ip_mtable_dump) \
77  _ (IP_MROUTE_DUMP, ip_mroute_dump) \
78  _ (IP_MROUTE_ADD_DEL, ip_mroute_add_del) \
79  _ (MFIB_SIGNAL_DUMP, mfib_signal_dump) \
80  _ (IP_ADDRESS_DUMP, ip_address_dump) \
81  _ (IP_UNNUMBERED_DUMP, ip_unnumbered_dump) \
82  _ (IP_DUMP, ip_dump) \
83  _ (IP_TABLE_REPLACE_BEGIN, ip_table_replace_begin) \
84  _ (IP_TABLE_REPLACE_END, ip_table_replace_end) \
85  _ (IP_TABLE_FLUSH, ip_table_flush) \
86  _ (IP_ROUTE_ADD_DEL, ip_route_add_del) \
87  _ (IP_ROUTE_ADD_DEL_V2, ip_route_add_del_v2) \
88  _ (IP_ROUTE_LOOKUP, ip_route_lookup) \
89  _ (IP_ROUTE_LOOKUP_V2, ip_route_lookup_v2) \
90  _ (IP_TABLE_ADD_DEL, ip_table_add_del) \
91  _ (IP_PUNT_POLICE, ip_punt_police) \
92  _ (IP_PUNT_REDIRECT, ip_punt_redirect) \
93  _ (SET_IP_FLOW_HASH, set_ip_flow_hash) \
94  _ (SET_IP_FLOW_HASH_V2, set_ip_flow_hash_v2) \
95  _ (SET_IP_FLOW_HASH_ROUTER_ID, set_ip_flow_hash_router_id) \
96  _ (IP_CONTAINER_PROXY_ADD_DEL, ip_container_proxy_add_del) \
97  _ (IP_CONTAINER_PROXY_DUMP, ip_container_proxy_dump) \
98  _ (IOAM_ENABLE, ioam_enable) \
99  _ (IOAM_DISABLE, ioam_disable) \
100  _ (IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
101  ip_source_and_port_range_check_add_del) \
102  _ (IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
103  ip_source_and_port_range_check_interface_add_del) \
104  _ (SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
105  sw_interface_ip6_set_link_local_address) \
106  _ (SW_INTERFACE_IP6_GET_LINK_LOCAL_ADDRESS, \
107  sw_interface_ip6_get_link_local_address) \
108  _ (IP_REASSEMBLY_SET, ip_reassembly_set) \
109  _ (IP_REASSEMBLY_GET, ip_reassembly_get) \
110  _ (IP_REASSEMBLY_ENABLE_DISABLE, ip_reassembly_enable_disable) \
111  _ (IP_PUNT_REDIRECT_DUMP, ip_punt_redirect_dump) \
112  _ (IP_PATH_MTU_UPDATE, ip_path_mtu_update) \
113  _ (IP_PATH_MTU_REPLACE_BEGIN, ip_path_mtu_replace_begin) \
114  _ (IP_PATH_MTU_REPLACE_END, ip_path_mtu_replace_end) \
115  _ (IP_PATH_MTU_GET, ip_path_mtu_get)
116 
117 static void
120 {
121  vl_api_sw_interface_ip6_enable_disable_reply_t *rmp;
122  int rv = 0;
123 
125 
126  rv = ((mp->enable == 1) ?
127  ip6_link_enable (ntohl (mp->sw_if_index), NULL) :
128  ip6_link_disable (ntohl (mp->sw_if_index)));
129 
131 
132  REPLY_MACRO (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY);
133 }
134 
135 static void
137  vl_api_registration_t * reg,
138  u32 context, const fib_table_t * table)
139 {
141 
142  mp = vl_msg_api_alloc (sizeof (*mp));
143  if (!mp)
144  return;
145  clib_memset (mp, 0, sizeof (*mp));
146  mp->_vl_msg_id = ntohs (VL_API_IP_TABLE_DETAILS);
147  mp->context = context;
148 
149  mp->table.is_ip6 = (table->ft_proto == FIB_PROTOCOL_IP6);
150  mp->table.table_id = htonl (table->ft_table_id);
151  memcpy (mp->table.name, table->ft_desc,
152  clib_min (vec_len (table->ft_desc), sizeof (mp->table.name)));
153 
154  vl_api_send_msg (reg, (u8 *) mp);
155 }
156 
157 static void
159 {
162  fib_table_t *fib_table;
163 
165  if (!reg)
166  return;
167 
168  /* *INDENT-OFF* */
169  pool_foreach (fib_table, ip4_main.fibs)
170  {
171  send_ip_table_details(am, reg, mp->context, fib_table);
172  }
173  pool_foreach (fib_table, ip6_main.fibs)
174  {
175  /* don't send link locals */
176  if (fib_table->ft_flags & FIB_TABLE_FLAG_IP6_LL)
177  continue;
178  send_ip_table_details(am, reg, mp->context, fib_table);
179  }
180  /* *INDENT-ON* */
181 }
182 
184 {
187 
188 static fib_table_walk_rc_t
190 {
192 
193  vec_add1 (ctx->feis, fei);
194 
195  return (FIB_TABLE_WALK_CONTINUE);
196 }
197 
198 static void
200  vl_api_registration_t * reg,
201  u32 context, fib_node_index_t fib_entry_index)
202 {
203  fib_route_path_t *rpaths, *rpath;
205  const fib_prefix_t *pfx;
206  vl_api_fib_path_t *fp;
207  int path_count;
208 
209  rpaths = NULL;
210  pfx = fib_entry_get_prefix (fib_entry_index);
211  rpaths = fib_entry_encode (fib_entry_index);
212 
213  path_count = vec_len (rpaths);
214  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
215  if (!mp)
216  return;
217  clib_memset (mp, 0, sizeof (*mp));
218  mp->_vl_msg_id = ntohs (VL_API_IP_ROUTE_DETAILS);
219  mp->context = context;
220 
221  ip_prefix_encode (pfx, &mp->route.prefix);
222  mp->route.table_id =
224  (fib_entry_get_fib_index (fib_entry_index), pfx->fp_proto));
225  mp->route.n_paths = path_count;
226  mp->route.stats_index =
228  (fib_entry_get_fib_index (fib_entry_index), pfx));
229 
230  fp = mp->route.paths;
231  vec_foreach (rpath, rpaths)
232  {
233  fib_api_path_encode (rpath, fp);
234  fp++;
235  }
236 
237  vl_api_send_msg (reg, (u8 *) mp);
238  vec_free (rpaths);
239 }
240 
241 static void
243  u32 context, fib_node_index_t fib_entry_index)
244 {
245  fib_route_path_t *rpaths, *rpath;
247  const fib_prefix_t *pfx;
248  vl_api_fib_path_t *fp;
249  int path_count;
250 
251  rpaths = NULL;
252  pfx = fib_entry_get_prefix (fib_entry_index);
253  rpaths = fib_entry_encode (fib_entry_index);
254 
255  path_count = vec_len (rpaths);
256  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
257  if (!mp)
258  return;
259  clib_memset (mp, 0, sizeof (*mp));
260  mp->_vl_msg_id = ntohs (VL_API_IP_ROUTE_V2_DETAILS);
261  mp->context = context;
262 
263  ip_prefix_encode (pfx, &mp->route.prefix);
264  mp->route.table_id = htonl (fib_table_get_table_id (
265  fib_entry_get_fib_index (fib_entry_index), pfx->fp_proto));
266  mp->route.n_paths = path_count;
267  mp->route.src = fib_entry_get_best_source (fib_entry_index);
268  mp->route.stats_index = htonl (fib_table_entry_get_stats_index (
269  fib_entry_get_fib_index (fib_entry_index), pfx));
270 
271  fp = mp->route.paths;
272  vec_foreach (rpath, rpaths)
273  {
274  fib_api_path_encode (rpath, fp);
275  fp++;
276  }
277 
278  vl_api_send_msg (reg, (u8 *) mp);
279  vec_free (rpaths);
280 }
281 
283 {
286 
287 static void
289 {
291  fib_node_index_t *fib_entry_index;
293  fib_protocol_t fproto;
294  u32 fib_index;
295 
297  if (!reg)
298  return;
299 
301  .feis = NULL,
302  };
303 
304  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
305  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
306 
307  if (INDEX_INVALID == fib_index)
308  return;
309 
310  fib_table_walk (fib_index, fproto, vl_api_ip_fib_dump_walk, &ctx);
311 
312  vec_foreach (fib_entry_index, ctx.feis)
313  {
314  send_ip_route_details (am, reg, mp->context, *fib_entry_index);
315  }
316 
317  vec_free (ctx.feis);
318 }
319 
320 static void
322 {
324  fib_node_index_t *fib_entry_index;
326  fib_protocol_t fproto;
328  u32 fib_index;
329 
331  if (!reg)
332  return;
333 
335  .feis = NULL,
336  };
337 
338  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
339  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
340  src = mp->src;
341 
342  if (INDEX_INVALID == fib_index)
343  return;
344 
345  if (src)
346  fib_table_walk_w_src (fib_index, fproto, src, vl_api_ip_fib_dump_walk,
347  &ctx);
348  else
349  fib_table_walk (fib_index, fproto, vl_api_ip_fib_dump_walk, &ctx);
350 
351  vec_foreach (fib_entry_index, ctx.feis)
352  {
353  send_ip_route_v2_details (am, reg, mp->context, *fib_entry_index);
354  }
355 
356  vec_free (ctx.feis);
357 }
358 
359 static void
361  u32 context, const mfib_table_t * mfib_table)
362 {
364 
365  mp = vl_msg_api_alloc (sizeof (*mp));
366  if (!mp)
367  return;
368  memset (mp, 0, sizeof (*mp));
369  mp->_vl_msg_id = ntohs (VL_API_IP_MTABLE_DETAILS);
370  mp->context = context;
371 
372  mp->table.table_id = htonl (mfib_table->mft_table_id);
373  mp->table.is_ip6 = (FIB_PROTOCOL_IP6 == mfib_table->mft_proto);
374 
375  vl_api_send_msg (reg, (u8 *) mp);
376 }
377 
378 static void
380 {
382  mfib_table_t *mfib_table;
383 
385  if (!reg)
386  return;
387 
388  /* *INDENT-OFF* */
389  pool_foreach (mfib_table, ip4_main.mfibs)
390  {
391  send_ip_mtable_details (reg, mp->context, mfib_table);
392  }
393  pool_foreach (mfib_table, ip6_main.mfibs)
394  {
395  send_ip_mtable_details (reg, mp->context, mfib_table);
396  }
397  /* *INDENT-ON* */
398 }
399 
401 {
404 
405 static walk_rc_t
407 {
409 
410  vec_add1 (ctx->entries, fei);
411 
412  return (WALK_CONTINUE);
413 }
414 
415 static void
417  vl_api_registration_t * reg,
418  u32 context, fib_node_index_t mfib_entry_index)
419 {
420  fib_route_path_t *rpaths, *rpath;
422  const mfib_prefix_t *pfx;
423  vl_api_mfib_path_t *fp;
424  u8 path_count;
425 
426  rpaths = NULL;
427  pfx = mfib_entry_get_prefix (mfib_entry_index);
428  rpaths = mfib_entry_encode (mfib_entry_index);
429 
430  path_count = vec_len (rpaths);
431  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
432  if (!mp)
433  return;
434  clib_memset (mp, 0, sizeof (*mp));
435  mp->_vl_msg_id = ntohs (VL_API_IP_MROUTE_DETAILS);
436  mp->context = context;
437 
438  ip_mprefix_encode (pfx, &mp->route.prefix);
439  mp->route.table_id =
441  (mfib_entry_get_fib_index (mfib_entry_index), pfx->fp_proto));
442  mp->route.n_paths = path_count;
443  fp = mp->route.paths;
444  vec_foreach (rpath, rpaths)
445  {
446  mfib_api_path_encode (rpath, fp);
447  fp++;
448  }
449 
450  vl_api_send_msg (reg, (u8 *) mp);
451  vec_free (rpaths);
452 }
453 
454 static void
456 {
459  fib_node_index_t *mfeip;
460  fib_protocol_t fproto;
461  u32 fib_index;
462 
464  .entries = NULL,
465  };
466 
468  if (!reg)
469  return;
470 
471  fproto = fib_ip_proto (mp->table.is_ip6);
472  fib_index = mfib_table_find (fproto, ntohl (mp->table.table_id));
473 
474  if (INDEX_INVALID == fib_index)
475  return;
476 
477  mfib_table_walk (fib_index, fproto, mfib_route_dump_walk, &ctx);
478 
480 
481  vec_foreach (mfeip, ctx.entries)
482  {
483  send_ip_mroute_details (am, reg, mp->context, *mfeip);
484  }
485 
486  vec_free (ctx.entries);
487 }
488 
489 static void
491  vlib_main_t * vm)
492 {
493  vl_api_ip_punt_police_reply_t *rmp;
494  int rv = 0;
495 
496  if (mp->is_ip6)
497  ip6_punt_policer_add_del (mp->is_add, ntohl (mp->policer_index));
498  else
499  ip4_punt_policer_add_del (mp->is_add, ntohl (mp->policer_index));
500 
501  REPLY_MACRO (VL_API_IP_PUNT_POLICE_REPLY);
502 }
503 
504 static void
506  vlib_main_t * vm)
507 {
508  vl_api_ip_punt_redirect_reply_t *rmp;
509  int rv = 0;
510  ip46_type_t ipv;
511  ip46_address_t nh;
512 
513  if (!vnet_sw_if_index_is_api_valid (ntohl (mp->punt.tx_sw_if_index)))
514  goto bad_sw_if_index;
515 
516  ipv = ip_address_decode (&mp->punt.nh, &nh);
517  if (mp->is_add)
518  {
519  if (ipv == IP46_TYPE_IP6)
520  {
521  ip6_punt_redirect_add (ntohl (mp->punt.rx_sw_if_index),
522  ntohl (mp->punt.tx_sw_if_index), &nh);
523  }
524  else if (ipv == IP46_TYPE_IP4)
525  {
526  ip4_punt_redirect_add (ntohl (mp->punt.rx_sw_if_index),
527  ntohl (mp->punt.tx_sw_if_index), &nh);
528  }
529  }
530  else
531  {
532  if (ipv == IP46_TYPE_IP6)
533  {
534  ip6_punt_redirect_del (ntohl (mp->punt.rx_sw_if_index));
535  }
536  else if (ipv == IP46_TYPE_IP4)
537  {
538  ip4_punt_redirect_del (ntohl (mp->punt.rx_sw_if_index));
539  }
540  }
541 
543 
544  REPLY_MACRO (VL_API_IP_PUNT_REDIRECT_REPLY);
545 }
546 
547 static clib_error_t *
549  u32 flags,
550  _vnet_ip_table_function_list_elt_t **
551  elts)
552 {
553  _vnet_ip_table_function_list_elt_t *elt;
555  clib_error_t *error = 0;
556 
558  prio <= VNET_IP_TABLE_FUNC_PRIORITY_HIGH; prio++)
559  {
560  elt = elts[prio];
561 
562  while (elt)
563  {
564  error = elt->fp (vnm, table_id, flags);
565  if (error)
566  return error;
567  elt = elt->next_ip_table_function;
568  }
569  }
570  return error;
571 }
572 
573 void
575 {
576  u32 fib_index, mfib_index;
577  vnet_main_t *vnm = vnet_get_main ();
578 
579  /*
580  * ignore action on the default table - this is always present
581  * and cannot be added nor deleted from the API
582  */
583  if (0 != table_id)
584  {
585  /*
586  * The API holds only one lock on the table.
587  * i.e. it can be added many times via the API but needs to be
588  * deleted only once.
589  * The FIB index for unicast and multicast is not necessarily the
590  * same, since internal VPP systesm (like LISP and SR) create
591  * their own unicast tables.
592  */
593  fib_index = fib_table_find (fproto, table_id);
594  mfib_index = mfib_table_find (fproto, table_id);
595 
596  if ((~0 != fib_index) || (~0 != mfib_index))
597  call_elf_section_ip_table_callbacks (vnm, table_id, 0 /* is_add */ ,
599 
600  if (~0 != fib_index)
601  {
602  fib_table_unlock (fib_index, fproto,
603  (is_api ? FIB_SOURCE_API : FIB_SOURCE_CLI));
604  }
605  if (~0 != mfib_index)
606  {
607  mfib_table_unlock (mfib_index, fproto,
608  (is_api ? MFIB_SOURCE_API : MFIB_SOURCE_CLI));
609  }
610  }
611 }
612 
613 void
615 {
616  vl_api_ip_table_add_del_reply_t *rmp;
617  fib_protocol_t fproto = (mp->table.is_ip6 ?
619  u32 table_id = ntohl (mp->table.table_id);
620  int rv = 0;
621 
622  if (mp->is_add)
623  {
624  ip_table_create (fproto, table_id, 1, mp->table.name);
625  }
626  else
627  {
628  ip_table_delete (fproto, table_id, 1);
629  }
630 
631  REPLY_MACRO (VL_API_IP_TABLE_ADD_DEL_REPLY);
632 }
633 
634 static int
636 {
637  fib_route_path_t *rpaths = NULL, *rpath;
639  vl_api_fib_path_t *apath;
640  fib_prefix_t pfx;
641  u32 fib_index;
642  int rv, ii;
643 
645  ip_prefix_decode (&mp->route.prefix, &pfx);
646 
648  ntohl (mp->route.table_id), &fib_index);
649  if (0 != rv)
650  goto out;
651 
652  if (0 != mp->route.n_paths)
653  vec_validate (rpaths, mp->route.n_paths - 1);
654 
655  for (ii = 0; ii < mp->route.n_paths; ii++)
656  {
657  apath = &mp->route.paths[ii];
658  rpath = &rpaths[ii];
659 
660  rv = fib_api_path_decode (apath, rpath);
661 
662  if ((rpath->frp_flags & FIB_ROUTE_PATH_LOCAL) &&
663  (~0 == rpath->frp_sw_if_index))
665 
666  if (0 != rv)
667  goto out;
668  }
669 
670  rv = fib_api_route_add_del (mp->is_add, mp->is_multipath, fib_index, &pfx,
671  FIB_SOURCE_API, entry_flags, rpaths);
672 
673  if (mp->is_add && 0 == rv)
674  *stats_index = fib_table_entry_get_stats_index (fib_index, &pfx);
675 
676 out:
677  vec_free (rpaths);
678 
679  return (rv);
680 }
681 
682 static int
684  u32 *stats_index)
685 {
686  fib_route_path_t *rpaths = NULL, *rpath;
688  vl_api_fib_path_t *apath;
690  fib_prefix_t pfx;
691  u32 fib_index;
692  int rv, ii;
693 
695  ip_prefix_decode (&mp->route.prefix, &pfx);
696 
697  rv = fib_api_table_id_decode (pfx.fp_proto, ntohl (mp->route.table_id),
698  &fib_index);
699  if (0 != rv)
700  goto out;
701 
702  if (0 != mp->route.n_paths)
703  vec_validate (rpaths, mp->route.n_paths - 1);
704 
705  for (ii = 0; ii < mp->route.n_paths; ii++)
706  {
707  apath = &mp->route.paths[ii];
708  rpath = &rpaths[ii];
709 
710  rv = fib_api_path_decode (apath, rpath);
711 
712  if ((rpath->frp_flags & FIB_ROUTE_PATH_LOCAL) &&
713  (~0 == rpath->frp_sw_if_index))
715 
716  if (0 != rv)
717  goto out;
718  }
719 
720  src = (0 == mp->route.src ? FIB_SOURCE_API : mp->route.src);
721 
722  rv = fib_api_route_add_del (mp->is_add, mp->is_multipath, fib_index, &pfx,
723  src, entry_flags, rpaths);
724 
725  if (mp->is_add && 0 == rv)
726  *stats_index = fib_table_entry_get_stats_index (fib_index, &pfx);
727 
728 out:
729  vec_free (rpaths);
730 
731  return (rv);
732 }
733 
734 void
736 {
738  u32 stats_index = ~0;
739  int rv;
740 
742 
743  /* *INDENT-OFF* */
744  REPLY_MACRO2 (VL_API_IP_ROUTE_ADD_DEL_REPLY,
745  ({
746  rmp->stats_index = htonl (stats_index);
747  }))
748  /* *INDENT-ON* */
749 }
750 
751 void
753 {
755  u32 stats_index = ~0;
756  int rv;
757 
759 
760  /* clang-format off */
761  REPLY_MACRO2 (VL_API_IP_ROUTE_ADD_DEL_V2_REPLY,
762  ({
763  rmp->stats_index = htonl (stats_index);
764  }))
765  /* clang-format on */
766 }
767 
768 void
770 {
771  vl_api_ip_route_lookup_reply_t *rmp = NULL;
772  fib_route_path_t *rpaths = NULL, *rpath;
773  const fib_prefix_t *pfx = NULL;
775  vl_api_fib_path_t *fp;
776  fib_node_index_t fib_entry_index;
777  u32 fib_index;
778  int npaths = 0;
779  int rv;
780 
781  ip_prefix_decode (&mp->prefix, &lookup);
782  rv = fib_api_table_id_decode (lookup.fp_proto, ntohl (mp->table_id),
783  &fib_index);
784  if (PREDICT_TRUE (!rv))
785  {
786  if (mp->exact)
787  fib_entry_index = fib_table_lookup_exact_match (fib_index, &lookup);
788  else
789  fib_entry_index = fib_table_lookup (fib_index, &lookup);
790  if (fib_entry_index == FIB_NODE_INDEX_INVALID)
791  rv = VNET_API_ERROR_NO_SUCH_ENTRY;
792  else
793  {
794  pfx = fib_entry_get_prefix (fib_entry_index);
795  rpaths = fib_entry_encode (fib_entry_index);
796  npaths = vec_len (rpaths);
797  }
798  }
799 
800  /* *INDENT-OFF* */
801  REPLY_MACRO3_ZERO(VL_API_IP_ROUTE_LOOKUP_REPLY,
802  npaths * sizeof (*fp),
803  ({
804  if (!rv)
805  {
806  ip_prefix_encode (pfx, &rmp->route.prefix);
807  rmp->route.table_id = mp->table_id;
808  rmp->route.n_paths = npaths;
809  rmp->route.stats_index = fib_table_entry_get_stats_index (fib_index, pfx);
810  rmp->route.stats_index = htonl (rmp->route.stats_index);
811 
812  fp = rmp->route.paths;
813  vec_foreach (rpath, rpaths)
814  {
815  fib_api_path_encode (rpath, fp);
816  fp++;
817  }
818  }
819  }));
820  /* *INDENT-ON* */
821  vec_free (rpaths);
822 }
823 
824 void
826 {
828  fib_route_path_t *rpaths = NULL, *rpath;
829  const fib_prefix_t *pfx = NULL;
831  vl_api_fib_path_t *fp;
832  fib_node_index_t fib_entry_index;
833  u32 fib_index;
834  int npaths = 0;
835  fib_source_t src = 0;
836  int rv;
837 
838  ip_prefix_decode (&mp->prefix, &lookup);
839  rv = fib_api_table_id_decode (lookup.fp_proto, ntohl (mp->table_id),
840  &fib_index);
841  if (PREDICT_TRUE (!rv))
842  {
843  if (mp->exact)
844  fib_entry_index = fib_table_lookup_exact_match (fib_index, &lookup);
845  else
846  fib_entry_index = fib_table_lookup (fib_index, &lookup);
847  if (fib_entry_index == FIB_NODE_INDEX_INVALID)
848  rv = VNET_API_ERROR_NO_SUCH_ENTRY;
849  else
850  {
851  pfx = fib_entry_get_prefix (fib_entry_index);
852  rpaths = fib_entry_encode (fib_entry_index);
853  npaths = vec_len (rpaths);
854  src = fib_entry_get_best_source (fib_entry_index);
855  }
856  }
857 
858  /* clang-format off */
859  REPLY_MACRO3_ZERO(VL_API_IP_ROUTE_LOOKUP_V2_REPLY,
860  npaths * sizeof (*fp),
861  ({
862  if (!rv)
863  {
864  ip_prefix_encode (pfx, &rmp->route.prefix);
865  rmp->route.table_id = mp->table_id;
866  rmp->route.n_paths = npaths;
867  rmp->route.src = src;
868  rmp->route.stats_index = fib_table_entry_get_stats_index (fib_index, pfx);
869  rmp->route.stats_index = htonl (rmp->route.stats_index);
870 
871  fp = rmp->route.paths;
872  vec_foreach (rpath, rpaths)
873  {
874  fib_api_path_encode (rpath, fp);
875  fp++;
876  }
877  }
878  }));
879  /* clang-format on */
880  vec_free (rpaths);
881 }
882 
883 void
885  u32 table_id, u8 is_api, const u8 * name)
886 {
887  u32 fib_index, mfib_index;
888  vnet_main_t *vnm = vnet_get_main ();
889 
890  /*
891  * ignore action on the default table - this is always present
892  * and cannot be added nor deleted from the API
893  */
894  if (0 != table_id)
895  {
896  /*
897  * The API holds only one lock on the table.
898  * i.e. it can be added many times via the API but needs to be
899  * deleted only once.
900  * The FIB index for unicast and multicast is not necessarily the
901  * same, since internal VPP systesm (like LISP and SR) create
902  * their own unicast tables.
903  */
904  fib_index = fib_table_find (fproto, table_id);
905  mfib_index = mfib_table_find (fproto, table_id);
906 
907  if (~0 == fib_index)
908  {
910  (is_api ?
912  FIB_SOURCE_CLI), name);
913  }
914  if (~0 == mfib_index)
915  {
917  (is_api ?
920  }
921 
922  if ((~0 == fib_index) || (~0 == mfib_index))
923  call_elf_section_ip_table_callbacks (vnm, table_id, 1 /* is_add */ ,
925  }
926 }
927 
928 static u32
930  u8 is_multipath,
931  u32 fib_index,
932  const mfib_prefix_t * prefix,
934  u32 rpf_id, fib_route_path_t * rpaths)
935 {
936  u32 mfib_entry_index = ~0;
937 
938  if (0 == vec_len (rpaths))
939  {
940  mfib_entry_index = mfib_table_entry_update (fib_index, prefix,
943  }
944  else
945  {
946  if (is_add)
947  {
948  mfib_entry_index =
950  MFIB_SOURCE_API, rpaths);
951  }
952  else
953  {
955  MFIB_SOURCE_API, rpaths);
956  }
957  }
958 
959  return (mfib_entry_index);
960 }
961 
962 static int
964  u32 * stats_index)
965 {
966  fib_route_path_t *rpath, *rpaths = NULL;
967  fib_node_index_t mfib_entry_index;
968  mfib_entry_flags_t eflags;
969  mfib_prefix_t pfx;
970  u32 fib_index;
971  int rv;
972  u16 ii;
973 
974  ip_mprefix_decode (&mp->route.prefix, &pfx);
975 
977  ntohl (mp->route.table_id), &fib_index);
978  if (0 != rv)
979  goto out;
980 
981  vec_validate (rpaths, mp->route.n_paths - 1);
982 
983  for (ii = 0; ii < mp->route.n_paths; ii++)
984  {
985  rpath = &rpaths[ii];
986 
987  rv = mfib_api_path_decode (&mp->route.paths[ii], rpath);
988 
989  if (0 != rv)
990  goto out;
991  }
992 
993  eflags = mfib_api_path_entry_flags_decode (mp->route.entry_flags);
994  mfib_entry_index = mroute_add_del_handler (mp->is_add,
995  mp->is_add,
996  fib_index, &pfx,
997  eflags,
998  ntohl (mp->route.rpf_id),
999  rpaths);
1000 
1001  if (~0 != mfib_entry_index)
1002  *stats_index = mfib_entry_get_stats_index (mfib_entry_index);
1003 
1004 out:
1005  return (rv);
1006 }
1007 
1008 void
1010 {
1012  u32 stats_index = ~0;
1013  int rv;
1014 
1016 
1017  /* *INDENT-OFF* */
1018  REPLY_MACRO2 (VL_API_IP_MROUTE_ADD_DEL_REPLY,
1019  ({
1020  rmp->stats_index = htonl (stats_index);
1021  }));
1022  /* *INDENT-ON* */
1023 }
1024 
1025 static void
1028  u32 context)
1029 {
1030  vl_api_ip_details_t *mp;
1031 
1032  mp = vl_msg_api_alloc (sizeof (*mp));
1033  clib_memset (mp, 0, sizeof (*mp));
1034  mp->_vl_msg_id = ntohs (VL_API_IP_DETAILS);
1035 
1036  mp->sw_if_index = ntohl (sw_if_index);
1037  mp->is_ipv6 = is_ipv6;
1038  mp->context = context;
1039 
1040  vl_api_send_msg (reg, (u8 *) mp);
1041 }
1042 
1043 static void
1045  vl_api_registration_t * reg,
1046  const fib_prefix_t * pfx,
1048 {
1050 
1051  mp = vl_msg_api_alloc (sizeof (*mp));
1052  clib_memset (mp, 0, sizeof (*mp));
1053  mp->_vl_msg_id = ntohs (VL_API_IP_ADDRESS_DETAILS);
1054 
1055  ip_prefix_encode (pfx, &mp->prefix);
1056  mp->context = context;
1057  mp->sw_if_index = htonl (sw_if_index);
1058 
1059  vl_api_send_msg (reg, (u8 *) mp);
1060 }
1061 
1062 static void
1064 {
1066  vl_api_registration_t *reg;
1067  ip6_main_t *im6 = &ip6_main;
1068  ip4_main_t *im4 = &ip4_main;
1069  ip_lookup_main_t *lm6 = &im6->lookup_main;
1070  ip_lookup_main_t *lm4 = &im4->lookup_main;
1071  ip_interface_address_t *ia = 0;
1072  u32 sw_if_index = ~0;
1073  int rv __attribute__ ((unused)) = 0;
1074 
1075  VALIDATE_SW_IF_INDEX (mp);
1076 
1077  sw_if_index = ntohl (mp->sw_if_index);
1078 
1080  if (!reg)
1081  return;
1082 
1083  if (mp->is_ipv6)
1084  {
1085  /* *INDENT-OFF* */
1086  /* Do not send subnet details of the IP-interface for
1087  * unnumbered interfaces. otherwise listening clients
1088  * will be confused that the subnet is applied on more
1089  * than one interface */
1091  ({
1092  fib_prefix_t pfx = {
1093  .fp_addr.ip6 = *(ip6_address_t *)ip_interface_address_get_address (lm6, ia),
1094  .fp_len = ia->address_length,
1095  .fp_proto = FIB_PROTOCOL_IP6,
1096  };
1097  send_ip_address_details(am, reg, &pfx, sw_if_index, mp->context);
1098  }));
1099  /* *INDENT-ON* */
1100  }
1101  else
1102  {
1103  /* *INDENT-OFF* */
1105  ({
1106  fib_prefix_t pfx = {
1108  .fp_len = ia->address_length,
1109  .fp_proto = FIB_PROTOCOL_IP4,
1110  };
1111 
1112  send_ip_address_details(am, reg, &pfx, sw_if_index, mp->context);
1113  }));
1114  /* *INDENT-ON* */
1115  }
1116 
1118 }
1119 
1120 static void
1122  vl_api_registration_t * reg,
1123  u32 sw_if_index, u32 ip_sw_if_index, u32 context)
1124 {
1126 
1127  mp = vl_msg_api_alloc (sizeof (*mp));
1128  clib_memset (mp, 0, sizeof (*mp));
1129  mp->_vl_msg_id = ntohs (VL_API_IP_UNNUMBERED_DETAILS);
1130 
1131  mp->context = context;
1132  mp->sw_if_index = htonl (sw_if_index);
1133  mp->ip_sw_if_index = htonl (ip_sw_if_index);
1134 
1135  vl_api_send_msg (reg, (u8 *) mp);
1136 }
1137 
1138 static void
1140 {
1141  vnet_main_t *vnm = vnet_get_main ();
1143  int rv __attribute__ ((unused)) = 0;
1145  vl_api_registration_t *reg;
1147  u32 sw_if_index;
1148 
1149  sw_if_index = ntohl (mp->sw_if_index);
1150 
1152  if (!reg)
1153  return;
1154 
1155  if (~0 != sw_if_index)
1156  {
1157  VALIDATE_SW_IF_INDEX (mp);
1158 
1159  si = vnet_get_sw_interface (vnm, ntohl (mp->sw_if_index));
1160 
1162  {
1164  sw_if_index,
1166  mp->context);
1167  }
1168  }
1169  else
1170  {
1171  /* *INDENT-OFF* */
1173  {
1175  {
1177  si->sw_if_index,
1179  mp->context);
1180  }
1181  }
1182  /* *INDENT-ON* */
1183  }
1184 
1186 }
1187 
1188 static void
1190 {
1192  vnet_main_t *vnm = vnet_get_main ();
1193  //vlib_main_t *vm = vlib_get_main ();
1195  vl_api_registration_t *reg;
1196  vnet_sw_interface_t *si, *sorted_sis;
1197  u32 sw_if_index = ~0;
1198 
1200  if (!reg)
1201  return;
1202 
1203  /* Gather interfaces. */
1205  _vec_len (sorted_sis) = 0;
1206  /* *INDENT-OFF* */
1208  {
1209  vec_add1 (sorted_sis, si[0]);
1210  }
1211  /* *INDENT-ON* */
1212 
1213  vec_foreach (si, sorted_sis)
1214  {
1216  {
1217  /* if (mp->is_ipv6 && !ip6_interface_enabled (vm, si->sw_if_index)) */
1218  /* { */
1219  /* continue; */
1220  /* } */
1222  send_ip_details (am, reg, sw_if_index, mp->is_ipv6, mp->context);
1223  }
1224  }
1225 
1226  vec_free (sorted_sis);
1227 }
1228 
1229 static void
1231 {
1232  vl_api_set_ip_flow_hash_reply_t *rmp;
1233  int rv;
1234  u32 table_id;
1235  flow_hash_config_t flow_hash_config = 0;
1236 
1237  table_id = ntohl (mp->vrf_id);
1238 
1239 #define _(a,b) if (mp->a) flow_hash_config |= b;
1241 #undef _
1242 
1244  flow_hash_config);
1245 
1246  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
1247 }
1248 
1249 static void
1251 {
1252  vl_api_set_ip_flow_hash_v2_reply_t *rmp;
1254  int rv;
1255 
1256  rv = ip_address_family_decode (mp->af, &af);
1257 
1258  if (!rv)
1259  rv = ip_flow_hash_set (af, htonl (mp->table_id),
1260  htonl (mp->flow_hash_config));
1261 
1262  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_V2_REPLY);
1263 }
1264 
1265 static void
1268 {
1269  vl_api_set_ip_flow_hash_router_id_reply_t *rmp;
1270  int rv = 0;
1271 
1272  ip_flow_hash_router_id_set (ntohl (mp->router_id));
1273 
1274  REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_ROUTER_ID_REPLY);
1275 }
1276 
1277 void
1279  u32 context, const mfib_signal_t * mfs)
1280 {
1282  const mfib_prefix_t *prefix;
1283  mfib_table_t *mfib;
1284  mfib_itf_t *mfi;
1285 
1286  mp = vl_msg_api_alloc (sizeof (*mp));
1287 
1288  clib_memset (mp, 0, sizeof (*mp));
1289  mp->_vl_msg_id = ntohs (VL_API_MFIB_SIGNAL_DETAILS);
1290  mp->context = context;
1291 
1292  mfi = mfib_itf_get (mfs->mfs_itf);
1295  prefix->fp_proto);
1296  mp->table_id = ntohl (mfib->mft_table_id);
1297  mp->sw_if_index = ntohl (mfi->mfi_sw_if_index);
1298 
1300 
1301  if (0 != mfs->mfs_buffer_len)
1302  {
1303  mp->ip_packet_len = ntohs (mfs->mfs_buffer_len);
1304 
1305  memcpy (mp->ip_packet_data, mfs->mfs_buffer, mfs->mfs_buffer_len);
1306  }
1307  else
1308  {
1309  mp->ip_packet_len = 0;
1310  }
1311 
1312  vl_api_send_msg (reg, (u8 *) mp);
1313 }
1314 
1315 static void
1317 {
1318  vl_api_registration_t *reg;
1319 
1321  if (!reg)
1322  return;
1323 
1324  while (vl_api_can_send_msg (reg) && mfib_signal_send_one (reg, mp->context))
1325  ;
1326 }
1327 
1328 static void
1331 {
1332  vl_api_ip_container_proxy_add_del_reply_t *rmp;
1334  int rv = 0;
1336 
1337  clib_memset (&args, 0, sizeof (args));
1338 
1339  ip_prefix_decode (&mp->pfx, &args.prefix);
1340 
1341  args.sw_if_index = clib_net_to_host_u32 (mp->sw_if_index);
1342  args.is_add = mp->is_add;
1343  if ((error = vnet_ip_container_proxy_add_del (&args)))
1344  {
1347  }
1348 
1349  REPLY_MACRO (VL_API_IP_CONTAINER_PROXY_ADD_DEL_REPLY);
1350 }
1351 
1352 typedef struct ip_walk_ctx_t_
1353 {
1356 } ip_walk_ctx_t;
1357 
1358 static int
1360  void *args)
1361 {
1363  ip_walk_ctx_t *ctx = args;
1364 
1365  mp = vl_msg_api_alloc (sizeof (*mp));
1366  if (!mp)
1367  return 1;
1368 
1369  clib_memset (mp, 0, sizeof (*mp));
1370  mp->_vl_msg_id = ntohs (VL_API_IP_CONTAINER_PROXY_DETAILS);
1371  mp->context = ctx->context;
1372 
1373  mp->sw_if_index = ntohl (sw_if_index);
1374  ip_prefix_encode (pfx, &mp->prefix);
1375 
1376  vl_api_send_msg (ctx->reg, (u8 *) mp);
1377 
1378  return 1;
1379 }
1380 
1381 static void
1383  mp)
1384 {
1385  vl_api_registration_t *reg;
1386 
1388  if (!reg)
1389  return;
1390 
1391  ip_walk_ctx_t ctx = {
1392  .context = mp->context,
1393  .reg = reg,
1394  };
1395 
1397 }
1398 
1399 static void
1401 {
1402  int rv = 0;
1403  vl_api_ioam_enable_reply_t *rmp;
1405 
1406  /* Ignoring the profile id as currently a single profile
1407  * is supported */
1409  mp->seqno, mp->analyse);
1410  if (error)
1411  {
1414  }
1415 
1416  REPLY_MACRO (VL_API_IOAM_ENABLE_REPLY);
1417 }
1418 
1419 static void
1421 {
1422  int rv = 0;
1423  vl_api_ioam_disable_reply_t *rmp;
1425 
1427  if (error)
1428  {
1431  }
1432 
1433  REPLY_MACRO (VL_API_IOAM_DISABLE_REPLY);
1434 }
1435 
1436 static void
1439 {
1440  vl_api_ip_source_and_port_range_check_add_del_reply_t *rmp;
1441  int rv = 0;
1442 
1443  u8 is_add = mp->is_add;
1444  fib_prefix_t pfx;
1445  u16 *low_ports = 0;
1446  u16 *high_ports = 0;
1447  u32 vrf_id;
1448  u16 tmp_low, tmp_high;
1449  u8 num_ranges;
1450  int i;
1451 
1452  ip_prefix_decode (&mp->prefix, &pfx);
1453 
1454  // Validate port range
1455  num_ranges = mp->number_of_ranges;
1456  if (num_ranges > 32)
1457  { // This is size of array in VPE.API
1458  rv = VNET_API_ERROR_EXCEEDED_NUMBER_OF_RANGES_CAPACITY;
1459  goto reply;
1460  }
1461 
1462  vec_reset_length (low_ports);
1463  vec_reset_length (high_ports);
1464 
1465  for (i = 0; i < num_ranges; i++)
1466  {
1467  tmp_low = mp->low_ports[i];
1468  tmp_high = mp->high_ports[i];
1469  // If tmp_low <= tmp_high then only need to check tmp_low = 0
1470  // If tmp_low <= tmp_high then only need to check tmp_high > 65535
1471  if (tmp_low > tmp_high || tmp_low == 0 || tmp_high > 65535)
1472  {
1473  rv = VNET_API_ERROR_INVALID_VALUE;
1474  goto reply;
1475  }
1476  vec_add1 (low_ports, tmp_low);
1477  vec_add1 (high_ports, tmp_high + 1);
1478  }
1479 
1480  vrf_id = ntohl (mp->vrf_id);
1481 
1482  if (vrf_id < 1)
1483  {
1484  rv = VNET_API_ERROR_INVALID_VALUE;
1485  goto reply;
1486  }
1487 
1488 
1489  if (FIB_PROTOCOL_IP6 == pfx.fp_proto)
1490  {
1492  pfx.fp_len,
1493  vrf_id,
1494  low_ports,
1495  high_ports, is_add);
1496  }
1497  else
1498  {
1500  pfx.fp_len,
1501  vrf_id,
1502  low_ports,
1503  high_ports, is_add);
1504  }
1505 
1506 reply:
1507  vec_free (low_ports);
1508  vec_free (high_ports);
1509  REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY);
1510 }
1511 
1512 static void
1515 {
1517  vl_api_ip_source_and_port_range_check_interface_add_del_reply_t *rmp;
1518  ip4_main_t *im = &ip4_main;
1519  int rv;
1520  u32 sw_if_index;
1523  uword *p = 0;
1524  int i;
1525 
1527  ntohl (mp->tcp_out_vrf_id);
1529  ntohl (mp->udp_out_vrf_id);
1531  ntohl (mp->tcp_in_vrf_id);
1533  ntohl (mp->udp_in_vrf_id);
1534 
1535 
1537  {
1538  if (vrf_id[i] != 0 && vrf_id[i] != ~0)
1539  {
1540  p = hash_get (im->fib_index_by_table_id, vrf_id[i]);
1541 
1542  if (p == 0)
1543  {
1544  rv = VNET_API_ERROR_INVALID_VALUE;
1545  goto reply;
1546  }
1547 
1548  fib_index[i] = p[0];
1549  }
1550  else
1551  fib_index[i] = ~0;
1552  }
1553  sw_if_index = ntohl (mp->sw_if_index);
1554 
1555  VALIDATE_SW_IF_INDEX (mp);
1556 
1557  rv =
1559  mp->is_add);
1560 
1562 reply:
1563 
1564  REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY);
1565 }
1566 
1567 static void
1570 {
1571  vl_api_sw_interface_ip6_set_link_local_address_reply_t *rmp;
1572  ip6_address_t ip;
1573  int rv;
1574 
1575  VALIDATE_SW_IF_INDEX (mp);
1576 
1577  ip6_address_decode (mp->ip, &ip);
1578 
1579  rv = ip6_link_set_local_address (ntohl (mp->sw_if_index), &ip);
1580 
1582  REPLY_MACRO (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY);
1583 }
1584 
1585 static void
1588 {
1590  const ip6_address_t *ip = NULL;
1591  int rv = 0;
1592 
1593  VALIDATE_SW_IF_INDEX (mp);
1594 
1595  ip = ip6_get_link_local_address (ntohl (mp->sw_if_index));
1596  if (NULL == ip)
1597  rv = VNET_API_ERROR_IP6_NOT_ENABLED;
1598 
1600  /* clang-format off */
1601  REPLY_MACRO2 (VL_API_SW_INTERFACE_IP6_GET_LINK_LOCAL_ADDRESS_REPLY,
1602  ({
1603  if (!rv)
1604  ip6_address_encode (ip, rmp->ip);
1605  }))
1606  /* clang-format on */
1607 }
1608 
1609 static void
1611 {
1612  vl_api_ip_table_replace_begin_reply_t *rmp;
1613  fib_protocol_t fproto;
1614  u32 fib_index;
1615  int rv = 0;
1616 
1617  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1618  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
1619 
1620  if (INDEX_INVALID == fib_index)
1621  rv = VNET_API_ERROR_NO_SUCH_FIB;
1622  else
1623  {
1624  fib_table_mark (fib_index, fproto, FIB_SOURCE_API);
1625  mfib_table_mark (mfib_table_find (fproto, ntohl (mp->table.table_id)),
1626  fproto, MFIB_SOURCE_API);
1627  }
1628  REPLY_MACRO (VL_API_IP_TABLE_REPLACE_BEGIN_REPLY);
1629 }
1630 
1631 static void
1633 {
1634  vl_api_ip_table_replace_end_reply_t *rmp;
1635  fib_protocol_t fproto;
1636  u32 fib_index;
1637  int rv = 0;
1638 
1639  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1640  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
1641 
1642  if (INDEX_INVALID == fib_index)
1643  rv = VNET_API_ERROR_NO_SUCH_FIB;
1644  else
1645  {
1646  fib_table_sweep (fib_index, fproto, FIB_SOURCE_API);
1648  (fproto, ntohl (mp->table.table_id)), fproto,
1649  MFIB_SOURCE_API);
1650  }
1651  REPLY_MACRO (VL_API_IP_TABLE_REPLACE_END_REPLY);
1652 }
1653 
1654 static void
1656 {
1657  vl_api_ip_table_flush_reply_t *rmp;
1658  fib_protocol_t fproto;
1659  u32 fib_index;
1660  int rv = 0;
1661 
1662  fproto = (mp->table.is_ip6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4);
1663  fib_index = fib_table_find (fproto, ntohl (mp->table.table_id));
1664 
1665  if (INDEX_INVALID == fib_index)
1666  rv = VNET_API_ERROR_NO_SUCH_FIB;
1667  else
1668  {
1669  vnet_main_t *vnm = vnet_get_main ();
1672 
1673  /* Shut down interfaces in this FIB / clean out intfc routes */
1674  /* *INDENT-OFF* */
1676  {
1677  if (fib_index == fib_table_get_index_for_sw_if_index (fproto,
1678  si->sw_if_index))
1679  {
1680  u32 flags = si->flags;
1683  }
1684  }
1685  /* *INDENT-ON* */
1686 
1687  fib_table_flush (fib_index, fproto, FIB_SOURCE_API);
1688  mfib_table_flush (mfib_table_find (fproto, ntohl (mp->table.table_id)),
1689  fproto, MFIB_SOURCE_API);
1690  }
1691 
1692  REPLY_MACRO (VL_API_IP_TABLE_FLUSH_REPLY);
1693 }
1694 
1695 void
1697 {
1698  vl_api_ip_reassembly_set_reply_t *rmp;
1699  int rv = 0;
1700  switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
1701  {
1702  case IP_REASS_TYPE_FULL:
1703  if (mp->is_ip6)
1704  {
1705  rv = ip6_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1706  clib_net_to_host_u32
1707  (mp->max_reassemblies),
1708  clib_net_to_host_u32
1709  (mp->max_reassembly_length),
1710  clib_net_to_host_u32
1711  (mp->expire_walk_interval_ms));
1712  }
1713  else
1714  {
1715  rv = ip4_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1716  clib_net_to_host_u32
1717  (mp->max_reassemblies),
1718  clib_net_to_host_u32
1719  (mp->max_reassembly_length),
1720  clib_net_to_host_u32
1721  (mp->expire_walk_interval_ms));
1722  }
1723  break;
1725  if (mp->is_ip6)
1726  {
1727  rv =
1728  ip6_sv_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1729  clib_net_to_host_u32 (mp->max_reassemblies),
1730  clib_net_to_host_u32
1731  (mp->max_reassembly_length),
1732  clib_net_to_host_u32
1733  (mp->expire_walk_interval_ms));
1734  }
1735  else
1736  {
1737  rv = ip4_sv_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
1738  clib_net_to_host_u32 (mp->max_reassemblies),
1739  clib_net_to_host_u32
1740  (mp->max_reassembly_length),
1741  clib_net_to_host_u32
1742  (mp->expire_walk_interval_ms));
1743  }
1744  break;
1745  }
1746 
1747  REPLY_MACRO (VL_API_IP_REASSEMBLY_SET_REPLY);
1748 }
1749 
1750 void
1752 {
1754 
1756  if (rp == 0)
1757  return;
1758 
1759  vl_api_ip_reassembly_get_reply_t *rmp = vl_msg_api_alloc (sizeof (*rmp));
1760  clib_memset (rmp, 0, sizeof (*rmp));
1761  rmp->_vl_msg_id = ntohs (VL_API_IP_REASSEMBLY_GET_REPLY);
1762  rmp->context = mp->context;
1763  rmp->retval = 0;
1764  u32 timeout_ms;
1765  u32 max_reassemblies;
1766  u32 max_reassembly_length;
1767  u32 expire_walk_interval_ms;
1768  switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
1769  {
1770  case IP_REASS_TYPE_FULL:
1771  if (mp->is_ip6)
1772  {
1773  rmp->is_ip6 = 1;
1774  ip6_full_reass_get (&timeout_ms, &max_reassemblies,
1775  &max_reassembly_length,
1776  &expire_walk_interval_ms);
1777  }
1778  else
1779  {
1780  rmp->is_ip6 = 0;
1781  ip4_full_reass_get (&timeout_ms, &max_reassemblies,
1782  &max_reassembly_length,
1783  &expire_walk_interval_ms);
1784  }
1785  break;
1787  if (mp->is_ip6)
1788  {
1789  rmp->is_ip6 = 1;
1790  ip6_sv_reass_get (&timeout_ms, &max_reassemblies,
1791  &max_reassembly_length, &expire_walk_interval_ms);
1792  }
1793  else
1794  {
1795  rmp->is_ip6 = 0;
1796  ip4_sv_reass_get (&timeout_ms, &max_reassemblies,
1797  &max_reassembly_length, &expire_walk_interval_ms);
1798  }
1799  break;
1800  }
1801  rmp->timeout_ms = clib_host_to_net_u32 (timeout_ms);
1802  rmp->max_reassemblies = clib_host_to_net_u32 (max_reassemblies);
1803  rmp->max_reassembly_length = clib_host_to_net_u32 (max_reassembly_length);
1805  clib_host_to_net_u32 (expire_walk_interval_ms);
1806  vl_api_send_msg (rp, (u8 *) rmp);
1807 }
1808 
1809 void
1812 {
1813  vl_api_ip_reassembly_enable_disable_reply_t *rmp;
1814  int rv = 0;
1815  switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
1816  {
1817  case IP_REASS_TYPE_FULL:
1818  rv =
1819  ip4_full_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
1820  mp->enable_ip4);
1821  if (0 == rv)
1822  rv =
1823  ip6_full_reass_enable_disable (clib_net_to_host_u32
1824  (mp->sw_if_index), mp->enable_ip6);
1825  break;
1827  rv =
1828  ip4_sv_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
1829  mp->enable_ip4);
1830  if (0 == rv)
1831  {
1832  rv =
1833  ip6_sv_reass_enable_disable (clib_net_to_host_u32
1834  (mp->sw_if_index), mp->enable_ip6);
1835  }
1836  break;
1837  }
1838 
1839  REPLY_MACRO (VL_API_IP_REASSEMBLY_ENABLE_DISABLE_REPLY);
1840 }
1841 
1842 static walk_rc_t
1844  const ip_punt_redirect_rx_t * ipr, void *arg)
1845 {
1847  fib_path_encode_ctx_t path_ctx = {
1848  .rpaths = NULL,
1849  };
1850  ip_walk_ctx_t *ctx = arg;
1851 
1852  mp = vl_msg_api_alloc (sizeof (*mp));
1853  if (!mp)
1854  return (WALK_STOP);;
1855 
1856  clib_memset (mp, 0, sizeof (*mp));
1857  mp->_vl_msg_id = ntohs (VL_API_IP_PUNT_REDIRECT_DETAILS);
1858  mp->context = ctx->context;
1859 
1860  fib_path_list_walk_w_ext (ipr->pl, NULL, fib_path_encode, &path_ctx);
1861 
1862  mp->punt.rx_sw_if_index = htonl (rx_sw_if_index);
1863  mp->punt.tx_sw_if_index = htonl (path_ctx.rpaths[0].frp_sw_if_index);
1864 
1865  ip_address_encode (&path_ctx.rpaths[0].frp_addr,
1866  fib_proto_to_ip46 (ipr->fproto), &mp->punt.nh);
1867 
1868  vl_api_send_msg (ctx->reg, (u8 *) mp);
1869 
1870  vec_free (path_ctx.rpaths);
1871 
1872  return (WALK_CONTINUE);
1873 }
1874 
1875 static void
1877 {
1878  vl_api_registration_t *reg;
1880 
1882  if (!reg)
1883  return;
1884 
1885  if (mp->is_ipv6 == 1)
1886  fproto = FIB_PROTOCOL_IP6;
1887 
1888  ip_walk_ctx_t ctx = {
1889  .reg = reg,
1890  .context = mp->context,
1891  };
1892 
1893  if (~0 != mp->sw_if_index)
1894  {
1895  u32 rx_sw_if_index;
1896  index_t pri;
1897 
1898  rx_sw_if_index = ntohl (mp->sw_if_index);
1899  pri = ip_punt_redirect_find (fproto, rx_sw_if_index);
1900 
1901  if (INDEX_INVALID == pri)
1902  return;
1903 
1904  send_ip_punt_redirect_details (rx_sw_if_index,
1905  ip_punt_redirect_get (pri), &ctx);
1906  }
1907  else
1909 }
1910 
1911 void
1913 {
1914  vl_api_ip_path_mtu_update_reply_t *rmp;
1915  ip_address_t nh;
1916  int rv = 0;
1917 
1918  ip_address_decode2 (&mp->pmtu.nh, &nh);
1919 
1920  rv = ip_path_mtu_update (&nh, ntohl (mp->pmtu.table_id),
1921  ntohs (mp->pmtu.path_mtu));
1922 
1923  REPLY_MACRO (VL_API_IP_PATH_MTU_UPDATE_REPLY);
1924 }
1925 
1926 void
1929 {
1930  vl_api_ip_path_mtu_replace_begin_reply_t *rmp;
1931  int rv;
1932 
1934 
1935  REPLY_MACRO (VL_API_IP_PATH_MTU_REPLACE_BEGIN_REPLY);
1936 }
1937 
1938 void
1940 {
1941  vl_api_ip_path_mtu_replace_end_reply_t *rmp;
1942  int rv;
1943 
1945 
1946  REPLY_MACRO (VL_API_IP_PATH_MTU_REPLACE_END_REPLY);
1947 }
1948 
1949 static void
1951 {
1953  ip_address_t ip;
1954  ip_pmtu_t *ipt;
1955 
1956  ipt = ip_path_mtu_get (ipti);
1957 
1958  REPLY_MACRO_DETAILS4 (VL_API_IP_PATH_MTU_DETAILS, rp, context, ({
1959  ip_pmtu_get_ip (ipt, &ip);
1960  ip_address_encode2 (&ip, &rmp->pmtu.nh);
1961  rmp->pmtu.table_id =
1962  htonl (ip_pmtu_get_table_id (ipt));
1963  rmp->pmtu.path_mtu = htons (ipt->ipt_cfg_pmtu);
1964  }));
1965 }
1966 
1967 static void
1969 {
1971  i32 rv = 0;
1972 
1974  VL_API_IP_PATH_MTU_GET_REPLY, ip_pmtu_pool,
1975  ({ send_ip_path_mtu_details (cursor, rp, mp->context); }));
1976 }
1977 
1978 #define vl_msg_name_crc_list
1979 #include <vnet/ip/ip.api.h>
1980 #undef vl_msg_name_crc_list
1981 
1982 static void
1984 {
1985 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
1986  foreach_vl_msg_name_crc_ip;
1987 #undef _
1988 }
1989 
1990 static clib_error_t *
1992 {
1994 
1995 #define _(N,n) \
1996  vl_msg_api_set_handlers(VL_API_##N, #n, \
1997  vl_api_##n##_t_handler, \
1998  vl_noop_handler, \
1999  vl_api_##n##_t_endian, \
2000  vl_api_##n##_t_print, \
2001  sizeof(vl_api_##n##_t), 1);
2003 #undef _
2004 
2005  /*
2006  * Mark the route add/del API as MP safe
2007  */
2008  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL] = 1;
2009  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_REPLY] = 1;
2010  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_V2] = 1;
2011  am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL_V2_REPLY] = 1;
2012 
2013  /*
2014  * Set up the (msg_name, crc, message-id) table
2015  */
2017 
2018  return 0;
2019 }
2020 
2022 
2023 /*
2024  * fd.io coding-style-patch-verification: ON
2025  *
2026  * Local Variables:
2027  * eval: (c-set-style "gnu")
2028  * End:
2029  */
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:145
vl_api_ip_dump_t
Definition: ip.api:498
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:251
vl_api_ip_address_dump_t::client_index
u32 client_index
Definition: ip.api:464
vl_api_ip_source_and_port_range_check_add_del_t::vrf_id
u32 vrf_id
Definition: ip.api:623
im
vnet_interface_main_t * im
Definition: interface_output.c:395
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:1696
vl_api_ip_table_dump_t::context
u32 context
Definition: ip.api:67
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:513
vl_api_ip_route_add_del_reply_t
Definition: ip.api:186
vl_api_ip_path_mtu_get_reply_t
Definition: ip.api:797
vl_api_ip_punt_redirect_dump_t
Definition: ip.api:566
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:364
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:789
vl_api_ip_mroute_add_del_reply_t::stats_index
u32 stats_index
Definition: ip.api:433
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:586
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_ip_path_mtu_replace_end_t
Definition: ip.api:818
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:379
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:896
vl_api_ip_unnumbered_dump_t
Dump IP unnumbered configurations.
Definition: ip.api:484
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:136
ip_walk_ctx_t_
Definition: ip_api.c:1352
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:868
ip_walk_ctx_t_::reg
vl_api_registration_t * reg
Definition: ip_api.c:1354
ip6_full_reass.h
IPv6 Reassembly.
vl_api_mfib_signal_details_t::ip_packet_data
u8 ip_packet_data[256]
Definition: ip.api:518
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
ip6_punt_redirect_add
void ip6_punt_redirect_add(u32 rx_sw_if_index, u32 tx_sw_if_index, ip46_address_t *nh)
Definition: ip6_punt_drop.c:309
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:339
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:1632
vl_api_ip_address_dump_t
Definition: ip.api:462
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:723
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:1123
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:96
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:1512
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:185
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:1095
vl_api_ip_route_dump_t::context
u32 context
Definition: ip.api:209
vl_api_ip_fib_dump_walk_ctx_t_
Definition: ip_api.c:183
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:785
vl_api_ip_punt_police_t::policer_index
u32 policer_index
Definition: ip.api:532
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:1479
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
ip_mprefix_decode
void ip_mprefix_decode(const vl_api_mprefix_t *in, mfib_prefix_t *out)
Definition: ip_types_api.c:328
vl_api_ip_punt_police_t
IP punt policer.
Definition: ip.api:528
vl_api_ip_address_details_t
Definition: ip.api:455
vl_api_set_ip_flow_hash_v2_t
Definition: ip.api:331
vl_api_ip_mroute_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:425
vl_api_ip_address_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:458
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:1927
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:1174
vl_api_ip_mtable_dump_t::client_index
u32 client_index
Definition: ip.api:373
entry_flags
vl_api_mfib_entry_flags_t entry_flags
Definition: ip.api:414
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:416
vl_api_ip_mfib_dump_ctx_t_::entries
fib_node_index_t * entries
Definition: ip_api.c:402
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:1250
name
string name[64]
Definition: fib.api:25
vl_api_ip_route_dump_t::client_index
u32 client_index
Definition: ip.api:208
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:806
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:570
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:487
vl_api_ioam_disable_t
iOAM disable
Definition: ip.api:706
lookup
static hash_pair_t * lookup(void *v, uword key, enum lookup_opcode op, void *new_value, void *old_value)
Definition: hash.c:545
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:1610
vl_api_ip_reassembly_get_reply_t::max_reassemblies
u32 max_reassemblies
Definition: ip.api:744
vl_api_ip_route_lookup_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:249
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:1811
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:1950
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:1751
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:1121
vl_api_ip_route_v2_dump_t::table
vl_api_ip_table_t table
Definition: ip.api:219
IP46_TYPE_IP4
@ IP46_TYPE_IP4
Definition: ip46_address.h:26
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:1113
vl_api_ip_mroute_dump_t
Dump IP multicast fib table.
Definition: ip.api:439
ip_mprefix_encode
void ip_mprefix_encode(const mfib_prefix_t *in, vl_api_mprefix_t *out)
Definition: ip_types_api.c:318
vl_api_ip_address_details_t::context
u32 context
Definition: ip.api:457
vnet_interface_main_t
Definition: interface.h:989
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:1185
mfib_api_path_decode
int mfib_api_path_decode(vl_api_mfib_path_t *in, fib_route_path_t *out)
Definition: mfib_api.c:116
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:298
vl_api_ip_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:494
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:516
am
app_main_t * am
Definition: application.c:489
vl_api_ip_route_v2_dump_t
Definition: ip.api:212
vl_api_ip_source_and_port_range_check_add_del_t::low_ports
u16 low_ports[32]
Definition: ip.api:621
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:143
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:843
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:288
vl_api_ip_mroute_dump_t::context
u32 context
Definition: ip.api:442
vl_api_mfib_signal_dump_t::client_index
u32 client_index
Definition: ip.api:507
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:488
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
vl_api_ip_route_dump_t
Dump IP routes from a table.
Definition: ip.api:206
vl_api_ip_route_details_t
IP FIB table entry response.
Definition: ip.api:225
fib_route_path_t_::frp_sw_if_index
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:545
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:934
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:292
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:92
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:371
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:66
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:1239
ip4_full_reass.h
IPv4 Reassembly.
vl_api_ip_reassembly_set_t::max_reassembly_length
u32 max_reassembly_length
Definition: ip.api:725
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:321
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:1486
vl_api_ip_table_details_t::context
u32 context
Definition: ip.api:129
vl_api_ip_source_and_port_range_check_interface_add_del_t::tcp_in_vrf_id
u32 tcp_in_vrf_id
Definition: ip.api:639
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:284
vl_api_ip_punt_redirect_dump_t::is_ipv6
bool is_ipv6
Definition: ip.api:571
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
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:761
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:598
vl_api_ip_mroute_details_t::context
u32 context
Definition: ip.api:451
error
Definition: cJSON.c:88
vl_api_ip_route_v2_dump_t::context
u32 context
Definition: ip.api:216
vl_api_ip_container_proxy_dump_t::context
u32 context
Definition: ip.api:592
ip_prefix_encode
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
Definition: ip_types_api.c:287
i32
signed int i32
Definition: types.h:77
vl_api_ip_reassembly_get_reply_t::context
u32 context
Definition: ip.api:741
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:1075
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:872
fib_path_encode_ctx_t_::rpaths
fib_route_path_t * rpaths
Definition: fib_path.h:221
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:242
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:265
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:186
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:1316
vl_api_ip_table_details_t::table
vl_api_ip_table_t table
Definition: ip.api:130
vl_api_set_ip_flow_hash_router_id_t
Set the ip flow hash router ID.
Definition: ip.api:347
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:119
vl_api_ip_reassembly_set_t::type
vl_api_ip_reass_type_t type
Definition: ip.api:728
vnet_sw_interface_t::sw_if_index
u32 sw_if_index
Definition: interface.h:875
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:638
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:757
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:1714
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:683
vl_api_ip_reassembly_get_t
Definition: ip.api:731
vl_api_ioam_enable_t::analyse
bool analyse
Definition: ip.api:695
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:574
vl_api_ip_source_and_port_range_check_add_del_t
Configure IP source and L4 port-range check.
Definition: ip.api:614
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:696
vl_api_ip_mroute_add_del_t::route
vl_api_ip_mroute_t route
Definition: ip.api:427
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:34
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:1189
vl_api_ip_mroute_add_del_t
Definition: ip.api:421
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:735
vl_api_ip_table_replace_end_t::table
vl_api_ip_table_t table
Definition: ip.api:107
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:189
ip6_address_encode
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
Definition: ip_types_api.c:137
vl_api_ip_route_add_del_v2_t
Definition: ip.api:177
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_ip_route_lookup_reply_t::route
vl_api_ip_route_t route
Definition: ip.api:269
vl_api_ip_route_v2_dump_t::src
u8 src
Definition: ip.api:218
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:622
vl_api_ip_source_and_port_range_check_interface_add_del_t::tcp_out_vrf_id
u32 tcp_out_vrf_id
Definition: ip.api:640
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:597
vl_api_ip_details_t
Definition: ip.api:491
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:580
vl_api_ip_punt_redirect_details_t
Definition: ip.api:574
vnet_msg_enum.h
vl_api_mfib_signal_dump_t
Definition: ip.api:505
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:1026
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:1266
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
fib_table_t_::ft_desc
u8 * ft_desc
Table description.
Definition: fib_table.h:122
ip4_punt_redirect_add
void ip4_punt_redirect_add(u32 rx_sw_if_index, u32 tx_sw_if_index, ip46_address_t *nh)
Definition: ip4_punt_drop.c:316
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:125
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:243
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:336
vl_api_ip_mtable_dump_t::context
u32 context
Definition: ip.api:374
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:752
vl_api_ip_mtable_details_t
Definition: ip.api:376
ip_prefix_decode
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
Definition: ip_types_api.c:259
vl_api_ip_reassembly_enable_disable_t::type
vl_api_ip_reass_type_t type
Definition: ip.api:764
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:1230
uword
u64 uword
Definition: types.h:112
hash_get
#define hash_get(h, key)
Definition: hash.h:249
vl_api_ip_route_v2_dump_t::client_index
u32 client_index
Definition: ip.api:215
mfib_route_dump_walk
static walk_rc_t mfib_route_dump_walk(fib_node_index_t fei, void *arg)
Definition: ip_api.c:406
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:1443
vl_api_set_ip_flow_hash_v2_t::flow_hash_config
vl_api_ip_flow_hash_config_t flow_hash_config
Definition: ip.api:337
vl_api_ip_route_v2_details_t::context
u32 context
Definition: ip.api:233
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:173
vl_api_ip_table_replace_end_t
IP table replace end.
Definition: ip.api:103
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:747
interface.h
vl_api_ip_punt_redirect_t::is_add
bool is_add[default=true]
Definition: ip.api:563
vl_api_ip_route_lookup_v2_t::exact
u8 exact
Definition: ip.api:257
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
vl_api_ip_route_add_del_reply_t::stats_index
u32 stats_index
Definition: ip.api:190
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:929
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:505
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:614
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:514
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:478
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:459
vl_api_ip_container_proxy_dump_t::client_index
u32 client_index
Definition: ip.api:591
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:599
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:465
VNET_SW_INTERFACE_FLAG_UNNUMBERED
@ VNET_SW_INTERFACE_FLAG_UNNUMBERED
Definition: interface.h:850
ip6_main_t::fibs
struct fib_table_t_ * fibs
Definition: ip6.h:115
vl_api_ip_mfib_dump_ctx_t_
Definition: ip_api.c:400
vl_api_sw_interface_ip6_enable_disable_t::enable
bool enable
Definition: ip.api:365
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:1009
vl_api_ip_route_lookup_v2_t::table_id
u32 table_id
Definition: ip.api:256
vl_api_ip_reassembly_set_t::max_reassemblies
u32 max_reassemblies
Definition: ip.api:724
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:158
vl_api_ip_unnumbered_dump_t::client_index
u32 client_index
Definition: ip.api:486
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:1743
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:548
ip4_address_t
Definition: ip4_packet.h:50
vl_api_ip_unnumbered_details_t::context
u32 context
Definition: ip.api:476
vl_api_ip_punt_redirect_t::punt
vl_api_punt_redirect_t punt
Definition: ip.api:562
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:197
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:963
vl_api_ip_mtable_details_t::context
u32 context
Definition: ip.api:379
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:1014
vl_api_ip_punt_police_t::is_add
bool is_add[default=true]
Definition: ip.api:533
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:577
vl_api_mfib_signal_details_t::ip_packet_len
u16 ip_packet_len
Definition: ip.api:517
vl_api_ip_route_lookup_v2_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:258
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:192
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:69
vl_api_ip_punt_redirect_dump_t::context
u32 context
Definition: ip.api:569
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:883
vl_api_ip_reassembly_get_reply_t::retval
i32 retval
Definition: ip.api:742
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:1385
ip_punt_redirect_rx_t_::pl
fib_node_index_t pl
Definition: ip_punt_drop.h:221
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: ip_api.c:1983
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:1655
vl_api_ioam_disable_t_handler
static void vl_api_ioam_disable_t_handler(vl_api_ioam_disable_t *mp)
Definition: ip_api.c:1420
ip6_main
ip6_main_t ip6_main
Definition: ip6_forward.c:2787
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:743
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:1423
vl_api_ip_unnumbered_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:477
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:455
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:474
vl_api_ioam_enable_t
IOAM enable : Enable in-band OAM.
Definition: ip.api:689
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:762
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:727
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:441
vl_api_ip_path_mtu_get_t
Definition: ip.api:791
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:297
vl_api_ioam_enable_t_handler
static void vl_api_ioam_enable_t_handler(vl_api_ioam_enable_t *mp)
Definition: ip_api.c:1400
fib_path_list.h
vl_api_mfib_signal_details_t::table_id
u32 table_id
Definition: ip.api:515
vl_api_set_ip_flow_hash_v2_t::table_id
u32 table_id
Definition: ip.api:335
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:276
vl_api_ip_dump_t::context
u32 context
Definition: ip.api:501
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:210
ip_api_hookup
static clib_error_t * ip_api_hookup(vlib_main_t *vm)
Definition: ip_api.c:1991
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:584
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:998
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:697
vl_api_ip_route_v2_details_t
Definition: ip.api:230
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:1139
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:618
u32
unsigned int u32
Definition: types.h:88
vl_api_ip_container_proxy_details_t
Definition: ip.api:595
vl_api_ip_reassembly_get_t::type
vl_api_ip_reass_type_t type
Definition: ip.api:736
vl_api_ip_mroute_add_del_reply_t
Definition: ip.api:429
vl_api_ip_address_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:466
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:449
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:694
vl_api_ip_reassembly_get_t::client_index
u32 client_index
Definition: ip.api:733
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:825
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:2708
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
si
vnet_sw_interface_t * si
Definition: interface_output.c:398
vl_api_ip_route_details_t::context
u32 context
Definition: ip.api:227
vl_api_ip_route_add_del_v2_t::route
vl_api_ip_route_v2_t route
Definition: ip.api:184
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:1359
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:175
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:242
vl_api_set_ip_flow_hash_router_id_t::router_id
u32 router_id
Definition: ip.api:351
vl_api_ip_path_mtu_replace_begin_t
Definition: ip.api:813
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:1382
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:490
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:360
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
ip_walk_ctx_t_::context
u32 context
Definition: ip_api.c:1355
vl_api_ip_details_t::is_ipv6
bool is_ipv6
Definition: ip.api:495
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:884
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:289
vl_api_ip_dump_t::client_index
u32 client_index
Definition: ip.api:500
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:502
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:1586
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:1063
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:1438
vl_api_ip_table_details_t
IP FIB table response.
Definition: ip.api:127
ip4_main_t::mfibs
struct mfib_table_t_ * mfibs
Vector of MFIBs.
Definition: ip4.h:118
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:182
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:1939
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:220
vl_api_ip_reassembly_set_t
Definition: ip.api:719
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:347
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:620
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:1514
vl_api_ip_punt_police_t::is_ip6
bool is_ip6
Definition: ip.api:534
IP_REASS_TYPE_FULL
@ IP_REASS_TYPE_FULL
Definition: ip.api:715
mfib_signal.h
ip
vl_api_address_t ip
Definition: l2.api:558
vl_api_ip_route_lookup_v2_reply_t
Definition: ip.api:271
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:360
vl_api_ip_mroute_dump_t::table
vl_api_ip_table_t table
Definition: ip.api:443
vl_api_ip_reassembly_get_reply_t::expire_walk_interval_ms
u32 expire_walk_interval_ms
Definition: ip.api:746
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:1912
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:769
vl_api_ip_mtable_details_t::table
vl_api_ip_table_t table
Definition: ip.api:380
vl_api_ip_route_add_del_t
Add / del route request.
Definition: ip.api:169
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:1336
vl_api_ip_table_flush_t
IP table flush Flush a table of all routes.
Definition: ip.api:116
ip46_type_t
ip46_type_t
Definition: ip46_address.h:22
vnet_all_api_h.h
vl_api_ip_source_and_port_range_check_interface_add_del_t
Set interface source and L4 port-range request.
Definition: ip.api:633
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:576
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:1569
vl_api_ip_route_add_del_v2_t::is_multipath
bool is_multipath
Definition: ip.api:183
vl_api_ip_reassembly_get_t::context
u32 context
Definition: ip.api:734
vl_api_mfib_signal_details_t
Definition: ip.api:511
vl_api_ip_reassembly_set_t::expire_walk_interval_ms
u32 expire_walk_interval_ms
Definition: ip.api:726
vl_api_ip_path_mtu_get_t::context
u32 context
Definition: ip.api:794
vl_api_ip_source_and_port_range_check_interface_add_del_t::is_add
bool is_add[default=true]
Definition: ip.api:637
fib_source_t
enum fib_source_t_ fib_source_t
The different sources that can create a route.
context
u32 context
Definition: ip.api:780
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:1876
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:120
vl_api_ip_punt_redirect_t
IP punt redirect.
Definition: ip.api:558
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:589
vrf_id
u32 vrf_id
Definition: nat44_ed.api:1053
vl_api_ip_details_t::context
u32 context
Definition: ip.api:493
vl_api_ip_mroute_details_t::route
vl_api_ip_mroute_t route
Definition: ip.api:452
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:622
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:1448
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:282
vl_api_ip_route_v2_details_t::route
vl_api_ip_route_v2_t route
Definition: ip.api:234
vl_api_ip_address_dump_t::is_ipv6
bool is_ipv6
Definition: ip.api:467
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:64
vl_api_ip_container_proxy_add_del_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ip.api:585
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:931
vl_api_ip_route_add_del_v2_reply_t
Definition: ip.api:192
vl_api_ip_source_and_port_range_check_add_del_t::prefix
vl_api_prefix_t prefix
Definition: ip.api:619
vl_api_ip_reassembly_get_reply_t::max_reassembly_length
u32 max_reassembly_length
Definition: ip.api:745
vl_api_ip_table_replace_begin_t
IP table replace being.
Definition: ip.api:88
vl_api_ip_route_lookup_t::exact
u8 exact
Definition: ip.api:248
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:1141
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:199
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:1330
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:1106
vl_api_ip_route_lookup_t::table_id
u32 table_id
Definition: ip.api:247
vl_api_ip_reassembly_enable_disable_t::enable_ip6
bool enable_ip6
Definition: ip.api:763
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:508
vl_api_ip_source_and_port_range_check_interface_add_del_t::udp_out_vrf_id
u32 udp_out_vrf_id
Definition: ip.api:642
vl_api_ip_punt_redirect_dump_t::client_index
u32 client_index
Definition: ip.api:568
ip_types_api.h
ip_path_mtu.h
foreach_ip_api_msg
#define foreach_ip_api_msg
Definition: ip_api.c:71
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:1843
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:1359
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:228
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:1968
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:735
vl_api_ip_path_mtu_details_t
Definition: ip.api:803
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:635
IP_REASS_TYPE_SHALLOW_VIRTUAL
@ IP_REASS_TYPE_SHALLOW_VIRTUAL
Definition: ip.api:716
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:1279
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:174
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:1044
vl_api_ip_source_and_port_range_check_interface_add_del_t::udp_in_vrf_id
u32 udp_in_vrf_id
Definition: ip.api:641
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:739
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
vpe_api_main
vpe_api_main_t vpe_api_main
Definition: interface_api.c:55
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
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:1278