FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
fib_entry.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vlib/vlib.h>
17 #include <vnet/ip/format.h>
18 #include <vnet/ip/lookup.h>
19 #include <vnet/adj/adj.h>
20 #include <vnet/dpo/load_balance.h>
21 #include <vnet/dpo/drop_dpo.h>
22 
23 #include <vnet/fib/fib_entry.h>
24 #include <vnet/fib/fib_walk.h>
25 #include <vnet/fib/fib_entry_src.h>
27 #include <vnet/fib/fib_table.h>
28 #include <vnet/fib/fib_internal.h>
30 #include <vnet/fib/fib_path_ext.h>
33 
34 /*
35  * Array of strings/names for the FIB sources
36  */
39 
40 /*
41  * Pool for all fib_entries
42  */
44 
45 /**
46  * the logger
47  */
49 
52 {
54 }
55 
56 static fib_node_t *
58 {
59  return ((fib_node_t*)fib_entry_get(index));
60 }
61 
63 fib_entry_get_index (const fib_entry_t * fib_entry)
64 {
65  return (fib_entry - fib_entry_pool);
66 }
67 
69 fib_entry_get_proto (const fib_entry_t * fib_entry)
70 {
71  return (fib_entry->fe_prefix.fp_proto);
72 }
73 
76 {
77  return (fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto));
78 }
79 
82 {
83  switch (fib_entry->fe_prefix.fp_proto)
84  {
85  case FIB_PROTOCOL_IP4:
87  case FIB_PROTOCOL_IP6:
89  case FIB_PROTOCOL_MPLS:
90  if (MPLS_EOS == fib_entry->fe_prefix.fp_eos)
92  else
94  }
95 
97 }
98 
99 u8 *
100 format_fib_entry_flags (u8 *s, va_list *args)
101 {
103  fib_entry_flag_t flag = va_arg(*args, int);
104 
105  FOR_EACH_FIB_ATTRIBUTE(attr) {
106  if ((1<<attr) & flag) {
107  s = format (s, "%s,", fib_attribute_names[attr]);
108  }
109  }
110 
111  return (s);
112 }
113 
114 u8 *
115 format_fib_entry_src_flags (u8 *s, va_list *args)
116 {
118  fib_entry_src_flag_t flag = va_arg(*args, int);
119 
121  if ((1<<sattr) & flag) {
122  s = format (s, "%s,", fib_src_attribute_names[sattr]);
123  }
124  }
125 
126  return (s);
127 }
128 
129 u8 *
130 format_fib_entry (u8 * s, va_list * args)
131 {
133  fib_entry_t *fib_entry;
135  fib_node_index_t fei;
136  fib_source_t source;
137  int level;
138 
139  fei = va_arg (*args, fib_node_index_t);
140  level = va_arg (*args, int);
141  fib_entry = fib_entry_get(fei);
142 
143  s = format (s, "%U", format_fib_prefix, &fib_entry->fe_prefix);
144 
145  if (level >= FIB_ENTRY_FORMAT_DETAIL)
146  {
147  s = format (s, " fib:%d", fib_entry->fe_fib_index);
148  s = format (s, " index:%d", fib_entry_get_index(fib_entry));
149  s = format (s, " locks:%d", fib_entry->fe_node.fn_locks);
150 
151  FOR_EACH_SRC_ADDED(fib_entry, src, source,
152  ({
153  s = format (s, "\n %U", format_fib_source, source);
154  s = format (s, " refs:%d", src->fes_ref_count);
155  if (FIB_ENTRY_FLAG_NONE != src->fes_entry_flags) {
156  s = format(s, " entry-flags:%U",
157  format_fib_entry_flags, src->fes_entry_flags);
158  }
159  if (FIB_ENTRY_SRC_FLAG_NONE != src->fes_flags) {
160  s = format(s, " src-flags:%U",
161  format_fib_entry_src_flags, src->fes_flags);
162  }
163  s = fib_entry_src_format(fib_entry, source, s);
164  s = format (s, "\n");
165  if (FIB_NODE_INDEX_INVALID != src->fes_pl)
166  {
167  s = fib_path_list_format(src->fes_pl, s);
168  }
169  s = format(s, "%U", format_fib_path_ext_list, &src->fes_path_exts);
170  }));
171 
172  s = format (s, "\n forwarding: ");
173  }
174  else
175  {
176  s = format (s, "\n");
177  }
178 
179  fct = fib_entry_get_default_chain_type(fib_entry);
180 
181  if (!dpo_id_is_valid(&fib_entry->fe_lb))
182  {
183  s = format (s, " UNRESOLVED\n");
184  return (s);
185  }
186  else
187  {
188  s = format(s, " %U-chain\n %U",
191  &fib_entry->fe_lb,
192  2);
193  s = format(s, "\n");
194 
195  if (level >= FIB_ENTRY_FORMAT_DETAIL2)
196  {
197  index_t *fedi;
198 
199  s = format (s, " Delegates:\n");
200  vec_foreach(fedi, fib_entry->fe_delegates)
201  {
202  s = format(s, " %U\n", format_fib_entry_delegate, *fedi);
203  }
204  }
205  }
206 
207  if (level >= FIB_ENTRY_FORMAT_DETAIL2)
208  {
209  s = format(s, " Children:");
210  s = fib_node_children_format(fib_entry->fe_node.fn_children, s);
211  }
212 
213  return (s);
214 }
215 
216 static fib_entry_t*
218 {
219  ASSERT(FIB_NODE_TYPE_ENTRY == node->fn_type);
220  return ((fib_entry_t*)node);
221 }
222 
223 static void
225 {
228  fib_entry_t *fib_entry;
229 
230  fib_entry = fib_entry_from_fib_node(node);
231 
232  ASSERT(!dpo_id_is_valid(&fib_entry->fe_lb));
233 
234  FOR_EACH_DELEGATE_CHAIN(fib_entry, fdt, fed,
235  {
236  dpo_reset(&fed->fd_dpo);
237  fib_entry_delegate_remove(fib_entry, fdt);
238  });
239 
240  FIB_ENTRY_DBG(fib_entry, "last-lock");
241 
242  fib_node_deinit(&fib_entry->fe_node);
243 
244  ASSERT(0 == vec_len(fib_entry->fe_delegates));
245  vec_free(fib_entry->fe_delegates);
246  vec_free(fib_entry->fe_srcs);
247  pool_put(fib_entry_pool, fib_entry);
248 }
249 
250 static fib_entry_src_t*
252 {
253  fib_entry_src_t *bsrc;
254 
255  /*
256  * the enum of sources is deliberately arranged in priority order
257  */
258  if (0 == vec_len(fib_entry->fe_srcs))
259  {
260  bsrc = NULL;
261  }
262  else
263  {
264  bsrc = vec_elt_at_index(fib_entry->fe_srcs, 0);
265  }
266 
267  return (bsrc);
268 }
269 
270 static fib_source_t
272 {
273  if (NULL != esrc)
274  {
275  return (esrc->fes_src);
276  }
277  return (FIB_SOURCE_INVALID);
278 }
279 
280 static fib_entry_flag_t
282 {
283  if (NULL != esrc)
284  {
285  return (esrc->fes_entry_flags);
286  }
287  return (FIB_ENTRY_FLAG_NONE);
288 }
289 
292 {
293  return (fib_entry_get_flags_i(fib_entry_get(fib_entry_index)));
294 }
295 
296 /*
297  * fib_entry_back_walk_notify
298  *
299  * A back walk has reach this entry.
300  */
304 {
305  fib_entry_t *fib_entry;
306 
307  fib_entry = fib_entry_from_fib_node(node);
308 
309  if (FIB_NODE_BW_REASON_FLAG_EVALUATE & ctx->fnbw_reason ||
310  FIB_NODE_BW_REASON_FLAG_ADJ_UPDATE & ctx->fnbw_reason ||
311  FIB_NODE_BW_REASON_FLAG_ADJ_DOWN & ctx->fnbw_reason ||
312  FIB_NODE_BW_REASON_FLAG_INTERFACE_UP & ctx->fnbw_reason ||
315  {
318  fib_entry_get_index(fib_entry)));
319  }
320 
321  /*
322  * all other walk types can be reclassifed to a re-evaluate to
323  * all recursive dependents.
324  * By reclassifying we ensure that should any of these walk types meet
325  * they can be merged.
326  */
327  ctx->fnbw_reason = FIB_NODE_BW_REASON_FLAG_EVALUATE;
328 
329  /*
330  * ... and nothing is forced sync from now on.
331  */
332  ctx->fnbw_flags &= ~FIB_NODE_BW_FLAG_FORCE_SYNC;
333 
334  FIB_ENTRY_DBG(fib_entry, "bw:%U",
335  format_fib_node_bw_reason, ctx->fnbw_reason);
336 
337  /*
338  * propagate the backwalk further if we haven't already reached the
339  * maximum depth.
340  */
342  fib_entry_get_index(fib_entry),
343  ctx);
344 
346 }
347 
348 static void
350 {
351  u32 n_srcs = 0, n_exts = 0;
352  fib_entry_src_t *esrc;
353  fib_entry_t *entry;
354 
355  fib_show_memory_usage("Entry",
358  sizeof(fib_entry_t));
359 
361  {
362  n_srcs += vec_len(entry->fe_srcs);
363  vec_foreach(esrc, entry->fe_srcs)
364  {
365  n_exts += fib_path_ext_list_length(&esrc->fes_path_exts);
366  }
367  }
368 
369  fib_show_memory_usage("Entry Source",
370  n_srcs, n_srcs, sizeof(fib_entry_src_t));
371  fib_show_memory_usage("Entry Path-Extensions",
372  n_exts, n_exts,
373  sizeof(fib_path_ext_t));
374 }
375 
376 /*
377  * The FIB path-list's graph node virtual function table
378  */
381  .fnv_last_lock = fib_entry_last_lock_gone,
382  .fnv_back_walk = fib_entry_back_walk_notify,
383  .fnv_mem_show = fib_entry_show_memory,
384 };
385 
386 /**
387  * @brief Contribute the set of Adjacencies that this entry forwards with
388  * to build the uRPF list of its children
389  */
390 void
392  index_t urpf)
393 {
394  fib_entry_t *fib_entry;
395 
396  fib_entry = fib_entry_get(entry_index);
397 
398  return (fib_path_list_contribute_urpf(fib_entry->fe_parent, urpf));
399 }
400 
401 /*
402  * If the client is request a chain for multicast forwarding then swap
403  * the chain type to one that can provide such transport.
404  */
407 {
408  switch (fct)
409  {
412  /*
413  * we can only transport IP multicast packets if there is an
414  * LSP.
415  */
417  break;
425  break;
426  }
427 
428  return (fct);
429 }
430 
431 /*
432  * fib_entry_contribute_forwarding
433  *
434  * Get an lock the forwarding information (DPO) contributed by the FIB entry.
435  */
436 void
439  dpo_id_t *dpo)
440 {
442  fib_entry_t *fib_entry;
443 
444  fib_entry = fib_entry_get(fib_entry_index);
445 
446  /*
447  * mfib children ask for mcast chains. fix these to the appropriate ucast types.
448  */
450 
451  if (fct == fib_entry_get_default_chain_type(fib_entry))
452  {
453  dpo_copy(dpo, &fib_entry->fe_lb);
454  }
455  else
456  {
457  fed = fib_entry_delegate_find(fib_entry,
459 
460  if (NULL == fed)
461  {
462  /*
463  * use a temporary DPO lest the delegate realloc in the recursive
464  * calculation.
465  */
467 
468  /*
469  * on-demand create eos/non-eos.
470  * There is no on-demand delete because:
471  * - memory versus complexity & reliability:
472  * leaving unrequired [n]eos LB arounds wastes memory, cleaning
473  * then up on the right trigger is more code. i favour the latter.
474  */
475  fib_entry_src_mk_lb(fib_entry,
476  fib_entry_get_best_source(fib_entry_index),
477  fct,
478  &tmp);
479 
481  fib_entry,
483 
484  dpo_copy(&fed->fd_dpo, &tmp);
485  dpo_reset(&tmp);
486  }
487 
488  dpo_copy(dpo, &fed->fd_dpo);
489  }
490  /*
491  * use the drop DPO is nothing else is present
492  */
493  if (!dpo_id_is_valid(dpo))
494  {
496  }
497 
498  /*
499  * don't allow the special index indicating replicate.vs.load-balance
500  * to escape to the clients
501  */
502  dpo->dpoi_index &= ~MPLS_IS_REPLICATE;
503 }
504 
505 const dpo_id_t *
507 {
509  fib_entry_t *fib_entry;
510 
511  fib_entry = fib_entry_get(fib_entry_index);
512  fct = fib_entry_get_default_chain_type(fib_entry);
513 
516 
517  if (dpo_id_is_valid(&fib_entry->fe_lb))
518  {
519  return (&fib_entry->fe_lb);
520  }
521 
523 }
524 
527 {
528  const dpo_id_t *dpo;
529 
530  dpo = fib_entry_contribute_ip_forwarding(fib_entry_index);
531 
532  if (dpo_id_is_valid(dpo))
533  {
534  dpo = load_balance_get_bucket(dpo->dpoi_index, 0);
535 
536  if (dpo_is_adj(dpo))
537  {
538  return (dpo->dpoi_index);
539  }
540  }
541  return (ADJ_INDEX_INVALID);
542 }
543 
546 {
547  fib_entry_t *fib_entry;
548 
549  fib_entry = fib_entry_get(fib_entry_index);
550 
551  return (fib_entry->fe_parent);
552 }
553 
554 u32
556  fib_node_type_t child_type,
557  fib_node_index_t child_index)
558 {
560  fib_entry_index,
561  child_type,
562  child_index));
563 };
564 
565 void
567  u32 sibling_index)
568 {
570  fib_entry_index,
571  sibling_index);
572 
574  fib_entry_index))
575  {
576  /*
577  * if there are no children left then there is no reason to keep
578  * the non-default forwarding chains. those chains are built only
579  * because the children want them.
580  */
583  fib_entry_t *fib_entry;
584 
585  fib_entry = fib_entry_get(fib_entry_index);
586 
587  FOR_EACH_DELEGATE_CHAIN(fib_entry, fdt, fed,
588  {
589  dpo_reset(&fed->fd_dpo);
590  fib_entry_delegate_remove(fib_entry, fdt);
591  });
592  }
593 }
594 
595 static fib_entry_t *
596 fib_entry_alloc (u32 fib_index,
597  const fib_prefix_t *prefix,
598  fib_node_index_t *fib_entry_index)
599 {
600  fib_entry_t *fib_entry;
601  fib_prefix_t *fep;
602 
603  pool_get(fib_entry_pool, fib_entry);
604  clib_memset(fib_entry, 0, sizeof(*fib_entry));
605 
606  fib_node_init(&fib_entry->fe_node,
608 
609  fib_entry->fe_fib_index = fib_index;
610 
611  /*
612  * the one time we need to update the const prefix is when
613  * the entry is first created
614  */
615  fep = (fib_prefix_t*)&(fib_entry->fe_prefix);
616  *fep = *prefix;
617 
618  if (FIB_PROTOCOL_MPLS == fib_entry->fe_prefix.fp_proto)
619  {
620  fep->fp_len = 21;
621  if (MPLS_NON_EOS == fep->fp_eos)
622  {
624  }
626  }
627 
628  dpo_reset(&fib_entry->fe_lb);
629 
630  *fib_entry_index = fib_entry_get_index(fib_entry);
631 
632  return (fib_entry);
633 }
634 
635 static fib_entry_t*
637  fib_entry_flag_t old_flags)
638 {
639  fib_node_index_t fei;
640 
641  /*
642  * save the index so we can recover from pool reallocs
643  */
644  fei = fib_entry_get_index(fib_entry);
645 
646  /*
647  * handle changes to attached export for import entries
648  */
649  int is_import = (FIB_ENTRY_FLAG_IMPORT & fib_entry_get_flags_i(fib_entry));
650  int was_import = (FIB_ENTRY_FLAG_IMPORT & old_flags);
651 
652  if (!was_import && is_import)
653  {
654  /*
655  * transition from not exported to exported
656  */
657 
658  /*
659  * there is an assumption here that the entry resolves via only
660  * one interface and that it is the cross VRF interface.
661  */
663 
664  fib_attached_export_import(fib_entry,
666  fib_entry_get_proto(fib_entry),
667  sw_if_index));
668  }
669  else if (was_import && !is_import)
670  {
671  /*
672  * transition from exported to not exported
673  */
674  fib_attached_export_purge(fib_entry);
675  }
676  /*
677  * else
678  * no change. nothing to do.
679  */
680 
681  /*
682  * reload the entry address post possible pool realloc
683  */
684  fib_entry = fib_entry_get(fei);
685 
686  /*
687  * handle changes to attached export for export entries
688  */
689  int is_attached = (FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags_i(fib_entry));
690  int was_attached = (FIB_ENTRY_FLAG_ATTACHED & old_flags);
691 
692  if (!was_attached && is_attached)
693  {
694  /*
695  * transition to attached. time to export
696  */
697  // FIXME
698  }
699  // else FIXME
700 
701  return (fib_entry);
702 }
703 
704 static fib_entry_t*
706  fib_source_t source,
707  fib_entry_flag_t old_flags)
708 {
709  fib_entry = fib_entry_post_flag_update_actions(fib_entry,
710  old_flags);
711  fib_entry = fib_entry_src_action_installed(fib_entry, source);
712 
713  return (fib_entry);
714 }
715 
718  const fib_prefix_t *prefix,
719  fib_source_t source,
721  const fib_route_path_t *paths)
722 {
723  fib_node_index_t fib_entry_index;
724  fib_entry_t *fib_entry;
725 
726  ASSERT(0 < vec_len(paths));
727 
728  fib_entry = fib_entry_alloc(fib_index, prefix, &fib_entry_index);
729 
730  /*
731  * since this is a new entry create, we don't need to check for winning
732  * sources - there is only one.
733  */
734  fib_entry = fib_entry_src_action_add(fib_entry, source, flags,
735  drop_dpo_get(
737  fib_entry_get_proto(fib_entry))));
739  source,
740  flags,
741  paths);
742  /*
743  * handle possible realloc's by refetching the pointer
744  */
745  fib_entry = fib_entry_get(fib_entry_index);
746  fib_entry_src_action_activate(fib_entry, source);
747 
748  fib_entry = fib_entry_post_install_actions(fib_entry, source,
750 
751  FIB_ENTRY_DBG(fib_entry, "create");
752 
753  return (fib_entry_index);
754 }
755 
758  const fib_prefix_t *prefix,
759  fib_source_t source,
761  const dpo_id_t *dpo)
762 {
763  fib_node_index_t fib_entry_index;
764  fib_entry_t *fib_entry;
765 
766  /*
767  * create and initialize the new enty
768  */
769  fib_entry = fib_entry_alloc(fib_index, prefix, &fib_entry_index);
770 
771  /*
772  * create the path-list
773  */
774  fib_entry = fib_entry_src_action_add(fib_entry, source, flags, dpo);
775  fib_entry_src_action_activate(fib_entry, source);
776 
777  fib_entry = fib_entry_post_install_actions(fib_entry, source,
779 
780  FIB_ENTRY_DBG(fib_entry, "create-special");
781 
782  return (fib_entry_index);
783 }
784 
785 static void
787  fib_source_t source,
788  fib_entry_flag_t old_flags)
789 {
790  /*
791  * backwalk to children to inform then of the change to forwarding.
792  */
793  fib_node_back_walk_ctx_t bw_ctx = {
795  };
796 
798 
799  /*
800  * then inform any covered prefixes
801  */
803 
804  fib_entry_post_install_actions(fib_entry, source, old_flags);
805 }
806 
807 void
809 {
810  fib_source_t best_source;
811  fib_entry_t *fib_entry;
812  fib_entry_src_t *bsrc;
813 
814  fib_entry = fib_entry_get(fib_entry_index);
815 
816  bsrc = fib_entry_get_best_src_i(fib_entry);
817  best_source = fib_entry_src_get_source(bsrc);
818 
819  fib_entry_src_action_reactivate(fib_entry, best_source);
820 }
821 
822 static void
824  fib_source_t old_source,
825  fib_entry_flag_t old_flags,
826  fib_source_t new_source)
827 {
828  switch (fib_source_cmp(new_source, old_source))
829  {
831  /*
832  * we have a new winning source.
833  */
834  fib_entry_src_action_deactivate(fib_entry, old_source);
835  fib_entry_src_action_activate(fib_entry, new_source);
836  break;
837 
839  /*
840  * the new source loses. Re-activate the winning sources
841  * in case it is an interposer and hence relied on the losing
842  * source's path-list.
843  */
844  fib_entry_src_action_reactivate(fib_entry, old_source);
845  return;
846 
848  /*
849  * the new source is one this entry already has.
850  * But the path-list was updated, which will contribute new forwarding,
851  * so install it.
852  */
853  fib_entry_src_action_reactivate(fib_entry, new_source);
854  break;
855  }
856 
857  fib_entry_post_update_actions(fib_entry, new_source, old_flags);
858 }
859 
860 void
862  fib_source_t old_source,
863  fib_source_t new_source)
864 {
865  fib_entry_flag_t old_flags;
866 
867  old_flags = fib_entry_get_flags_for_source(
868  fib_entry_get_index(fib_entry), old_source);
869 
870  return (fib_entry_source_change_w_flags(fib_entry, old_source,
871  old_flags, new_source));
872 }
873 
874 void
876  fib_source_t source,
878  const dpo_id_t *dpo)
879 {
880  fib_source_t best_source;
881  fib_entry_t *fib_entry;
882 
883  fib_entry = fib_entry_get(fib_entry_index);
884  best_source = fib_entry_get_best_source(fib_entry_index);
885 
886  fib_entry = fib_entry_src_action_add(fib_entry, source, flags, dpo);
887  fib_entry_source_change(fib_entry, best_source, source);
888  FIB_ENTRY_DBG(fib_entry, "special-add:%U", format_fib_source, source);
889 }
890 
891 void
893  fib_source_t source,
895  const dpo_id_t *dpo)
896 {
897  fib_source_t best_source;
898  fib_entry_t *fib_entry;
899 
900  fib_entry = fib_entry_get(fib_entry_index);
901  best_source = fib_entry_get_best_source(fib_entry_index);
902 
903  fib_entry = fib_entry_src_action_update(fib_entry, source, flags, dpo);
904  fib_entry_source_change(fib_entry, best_source, source);
905 
906  FIB_ENTRY_DBG(fib_entry, "special-updated:%U", format_fib_source, source);
907 }
908 
909 
910 void
912  fib_source_t source,
914  const fib_route_path_t *rpaths)
915 {
916  fib_source_t best_source;
917  fib_entry_t *fib_entry;
918  fib_entry_src_t *bsrc;
919 
920  fib_entry = fib_entry_get(fib_entry_index);
921  ASSERT(NULL != fib_entry);
922 
923  bsrc = fib_entry_get_best_src_i(fib_entry);
924  best_source = fib_entry_src_get_source(bsrc);
925 
926  fib_entry = fib_entry_src_action_path_add(fib_entry, source, flags, rpaths);
927 
928  fib_entry_source_change(fib_entry, best_source, source);
929 
930  FIB_ENTRY_DBG(fib_entry, "path add:%U", format_fib_source, source);
931 }
932 
935 {
937  fib_source_t source;
938  int has_only_inherited_sources = 1;
939 
940  FOR_EACH_SRC_ADDED(fib_entry, src, source,
941  ({
942  if (!(src->fes_flags & FIB_ENTRY_SRC_FLAG_INHERITED))
943  {
944  has_only_inherited_sources = 0;
945  break;
946  }
947  }));
948  if (has_only_inherited_sources)
949  {
950  FOR_EACH_SRC_ADDED(fib_entry, src, source,
951  ({
952  fib_entry_src_action_remove(fib_entry, source);
953  }));
954  return (FIB_ENTRY_SRC_FLAG_NONE);
955  }
956  else
957  {
958  return (FIB_ENTRY_SRC_FLAG_ADDED);
959  }
960 }
961 
964  fib_entry_flag_t old_flags)
965 {
966  const fib_entry_src_t *bsrc;
967  fib_source_t best_source;
968 
969  /*
970  * if all that is left are inherited sources, then burn them
971  */
973 
974  bsrc = fib_entry_get_best_src_i(fib_entry);
975  best_source = fib_entry_src_get_source(bsrc);
976 
977  if (FIB_SOURCE_INVALID == best_source)
978  {
979  /*
980  * no more sources left. this entry is toast.
981  */
982  fib_entry = fib_entry_post_flag_update_actions(fib_entry, old_flags);
984 
985  return (FIB_ENTRY_SRC_FLAG_NONE);
986  }
987  else
988  {
989  fib_entry_src_action_activate(fib_entry, best_source);
990  }
991 
992  fib_entry_post_update_actions(fib_entry, best_source, old_flags);
993 
994  /*
995  * still have sources
996  */
997  return (FIB_ENTRY_SRC_FLAG_ADDED);
998 }
999 
1000 /*
1001  * fib_entry_path_remove
1002  *
1003  * remove a path from the entry.
1004  * return the fib_entry's index if it is still present, INVALID otherwise.
1005  */
1008  fib_source_t source,
1009  const fib_route_path_t *rpaths)
1010 {
1011  fib_entry_src_flag_t sflag;
1012  fib_source_t best_source;
1013  fib_entry_flag_t bflags;
1014  fib_entry_t *fib_entry;
1015  fib_entry_src_t *bsrc;
1016 
1017  fib_entry = fib_entry_get(fib_entry_index);
1018  ASSERT(NULL != fib_entry);
1019 
1020  bsrc = fib_entry_get_best_src_i(fib_entry);
1021  best_source = fib_entry_src_get_source(bsrc);
1022  bflags = fib_entry_src_get_flags(bsrc);
1023 
1024  sflag = fib_entry_src_action_path_remove(fib_entry, source, rpaths);
1025 
1026  FIB_ENTRY_DBG(fib_entry, "path remove:%U", format_fib_source, source);
1027 
1028  /*
1029  * if the path list for the source passed is invalid,
1030  * then we need to create a new one. else we are updating
1031  * an existing.
1032  */
1033  switch (fib_source_cmp(source, best_source))
1034  {
1035  case FIB_SOURCE_CMP_BETTER:
1036  /*
1037  * Que! removing a path from a source that is better than the
1038  * one this entry is using.
1039  */
1040  ASSERT(0);
1041  break;
1042  case FIB_SOURCE_CMP_WORSE:
1043  /*
1044  * the source is not the best. no need to update forwarding
1045  */
1046  if (FIB_ENTRY_SRC_FLAG_ADDED & sflag)
1047  {
1048  /*
1049  * the source being removed still has paths
1050  */
1051  return (FIB_ENTRY_SRC_FLAG_ADDED);
1052  }
1053  else
1054  {
1055  /*
1056  * that was the last path from this source, check if those
1057  * that remain are non-inherited
1058  */
1059  return (fib_entry_src_burn_only_inherited(fib_entry));
1060  }
1061  break;
1062  case FIB_SOURCE_CMP_EQUAL:
1063  /*
1064  * removing a path from the path-list we were using.
1065  */
1066  if (!(FIB_ENTRY_SRC_FLAG_ADDED & sflag))
1067  {
1068  /*
1069  * the last path from the source was removed.
1070  * fallback to lower source
1071  */
1072  return (fib_entry_source_removed(fib_entry, bflags));
1073  }
1074  else
1075  {
1076  /*
1077  * re-install the new forwarding information
1078  */
1079  fib_entry_src_action_reactivate(fib_entry, source);
1080  }
1081  break;
1082  }
1083 
1084  fib_entry_post_update_actions(fib_entry, source, bflags);
1085 
1086  /*
1087  * still have sources
1088  */
1089  return (FIB_ENTRY_SRC_FLAG_ADDED);
1090 }
1091 
1092 /*
1093  * fib_entry_special_remove
1094  *
1095  * remove a special source from the entry.
1096  * return the fib_entry's index if it is still present, INVALID otherwise.
1097  */
1100  fib_source_t source)
1101 {
1102  fib_entry_src_flag_t sflag;
1103  fib_source_t best_source;
1104  fib_entry_flag_t bflags;
1105  fib_entry_t *fib_entry;
1106  fib_entry_src_t *bsrc;
1107 
1108  fib_entry = fib_entry_get(fib_entry_index);
1109  ASSERT(NULL != fib_entry);
1110 
1111  bsrc = fib_entry_get_best_src_i(fib_entry);
1112  best_source = fib_entry_src_get_source(bsrc);
1113  bflags = fib_entry_src_get_flags(bsrc);
1114 
1115  FIB_ENTRY_DBG(fib_entry, "special remove:%U", format_fib_source, source);
1116 
1117  sflag = fib_entry_src_action_remove_or_update_inherit(fib_entry, source);
1118 
1119  /*
1120  * if the path list for the source passed is invalid,
1121  * then we need to create a new one. else we are updating
1122  * an existing.
1123  */
1124  switch (fib_source_cmp(source, best_source))
1125  {
1126  case FIB_SOURCE_CMP_BETTER:
1127  /*
1128  * Que! removing a path from a source that is better than the
1129  * one this entry is using. This can only mean it is a source
1130  * this prefix does not have.
1131  */
1132  return (FIB_ENTRY_SRC_FLAG_ADDED);
1133 
1134  case FIB_SOURCE_CMP_WORSE:
1135  /*
1136  * the source is not the best. no need to update forwarding
1137  */
1138  if (FIB_ENTRY_SRC_FLAG_ADDED & sflag)
1139  {
1140  /*
1141  * the source being removed still has paths
1142  */
1143  return (FIB_ENTRY_SRC_FLAG_ADDED);
1144  }
1145  else
1146  {
1147  /*
1148  * that was the last path from this source, check if those
1149  * that remain are non-inherited
1150  */
1152  {
1153  /*
1154  * no more sources left. this entry is toast.
1155  */
1156  fib_entry = fib_entry_post_flag_update_actions(fib_entry, bflags);
1157  fib_entry_src_action_uninstall(fib_entry);
1158  return (FIB_ENTRY_SRC_FLAG_NONE);
1159  }
1160 
1161  /*
1162  * reactivate the best source so the interposer gets restacked
1163  */
1164  fib_entry_src_action_reactivate(fib_entry, best_source);
1165 
1166  return (FIB_ENTRY_SRC_FLAG_ADDED);
1167  }
1168  break;
1169 
1170  case FIB_SOURCE_CMP_EQUAL:
1171  if (!(FIB_ENTRY_SRC_FLAG_ADDED & sflag))
1172  {
1173  /*
1174  * the source was removed. use the next best.
1175  */
1176  return (fib_entry_source_removed(fib_entry, bflags));
1177  }
1178  else
1179  {
1180  /*
1181  * re-install the new forwarding information
1182  */
1183  fib_entry_src_action_reactivate(fib_entry, source);
1184  }
1185  break;
1186  }
1187 
1188  fib_entry_post_update_actions(fib_entry, source, bflags);
1189 
1190  /*
1191  * still have sources
1192  */
1193  return (FIB_ENTRY_SRC_FLAG_ADDED);
1194 }
1195 
1196 /**
1197  * fib_entry_inherit
1198  *
1199  * If the source on the cover is inheriting then push this source
1200  * down to the covered.
1201  */
1202 void
1204  fib_node_index_t covered)
1205 {
1207  fib_entry_get(covered));
1208 }
1209 
1210 /**
1211  * fib_entry_delete
1212  *
1213  * The source is withdrawing all the paths it provided
1214  */
1217  fib_source_t source)
1218 {
1219  return (fib_entry_special_remove(fib_entry_index, source));
1220 }
1221 
1222 /**
1223  * fib_entry_update
1224  *
1225  * The source has provided a new set of paths that will replace the old.
1226  */
1227 void
1229  fib_source_t source,
1231  const fib_route_path_t *paths)
1232 {
1233  fib_source_t best_source;
1234  fib_entry_flag_t bflags;
1235  fib_entry_t *fib_entry;
1236  fib_entry_src_t *bsrc;
1237 
1238  fib_entry = fib_entry_get(fib_entry_index);
1239  ASSERT(NULL != fib_entry);
1240 
1241  bsrc = fib_entry_get_best_src_i(fib_entry);
1242  best_source = fib_entry_src_get_source(bsrc);
1243  bflags = fib_entry_get_flags_i(fib_entry);
1244 
1245  fib_entry = fib_entry_src_action_path_swap(fib_entry,
1246  source,
1247  flags,
1248  paths);
1249 
1250  fib_entry_source_change_w_flags(fib_entry, best_source, bflags, source);
1251  FIB_ENTRY_DBG(fib_entry, "update");
1252 }
1253 
1254 
1255 /*
1256  * fib_entry_cover_changed
1257  *
1258  * this entry is tracking its cover and that cover has changed.
1259  */
1260 void
1262 {
1264  .install = !0,
1265  .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
1266  };
1267  CLIB_UNUSED(fib_source_t source);
1268  fib_source_t best_source;
1269  fib_entry_flag_t bflags;
1270  fib_entry_t *fib_entry;
1271  fib_entry_src_t *esrc;
1272  u32 index;
1273 
1274  bflags = FIB_ENTRY_FLAG_NONE;
1275  best_source = FIB_SOURCE_FIRST;
1276  fib_entry = fib_entry_get(fib_entry_index);
1277 
1279 
1280  /*
1281  * propagate the notification to each of the added sources
1282  */
1283  index = 0;
1284  FOR_EACH_SRC_ADDED(fib_entry, esrc, source,
1285  ({
1286  if (0 == index)
1287  {
1288  /*
1289  * only the best source gets to set the back walk flags
1290  */
1291  res = fib_entry_src_action_cover_change(fib_entry, esrc);
1292  bflags = fib_entry_src_get_flags(esrc);
1293  best_source = fib_entry_src_get_source(esrc);
1294  }
1295  else
1296  {
1297  fib_entry_src_action_cover_change(fib_entry, esrc);
1298  }
1299  index++;
1300  }));
1301 
1302  if (res.install)
1303  {
1306  fib_entry_get_best_src_i(fib_entry)));
1307  fib_entry = fib_entry_post_install_actions(fib_entry,
1308  best_source,
1309  bflags);
1310  }
1311  else
1312  {
1313  fib_entry_src_action_uninstall(fib_entry);
1314  }
1315 
1317  {
1318  /*
1319  * time for walkies fido.
1320  */
1321  fib_node_back_walk_ctx_t bw_ctx = {
1322  .fnbw_reason = res.bw_reason,
1323  };
1324 
1325  fib_walk_sync(FIB_NODE_TYPE_ENTRY, fib_entry_index, &bw_ctx);
1326  }
1327  FIB_ENTRY_DBG(fib_entry, "cover-changed");
1328 }
1329 
1330 /*
1331  * fib_entry_cover_updated
1332  *
1333  * this entry is tracking its cover and that cover has been updated
1334  * (i.e. its forwarding information has changed).
1335  */
1336 void
1338 {
1340  .install = !0,
1341  .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
1342  };
1343  CLIB_UNUSED(fib_source_t source);
1344  fib_source_t best_source;
1345  fib_entry_flag_t bflags;
1346  fib_entry_t *fib_entry;
1347  fib_entry_src_t *esrc;
1348  u32 index;
1349 
1350  bflags = FIB_ENTRY_FLAG_NONE;
1351  best_source = FIB_SOURCE_FIRST;
1352  fib_entry = fib_entry_get(fib_entry_index);
1353 
1355 
1356  /*
1357  * propagate the notification to each of the added sources
1358  */
1359  index = 0;
1360  FOR_EACH_SRC_ADDED(fib_entry, esrc, source,
1361  ({
1362  if (0 == index)
1363  {
1364  /*
1365  * only the best source gets to set the install result
1366  */
1367  res = fib_entry_src_action_cover_update(fib_entry, esrc);
1368  bflags = fib_entry_src_get_flags(esrc);
1369  best_source = fib_entry_src_get_source(esrc);
1370  }
1371  else
1372  {
1373  /*
1374  * contirubting sources can set backwalk flags
1375  */
1377  {
1379  .install = !0,
1380  .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
1381  };
1382 
1383  tmp = fib_entry_src_action_cover_update(fib_entry, esrc);
1384  res.bw_reason |= tmp.bw_reason;
1385  }
1386  else
1387  {
1388  fib_entry_src_action_cover_update(fib_entry, esrc);
1389  }
1390  }
1391  index++;
1392  }));
1393 
1394  if (res.install)
1395  {
1398  fib_entry_get_best_src_i(fib_entry)));
1399  fib_entry = fib_entry_post_install_actions(fib_entry,
1400  best_source,
1401  bflags);
1402  }
1403  else
1404  {
1405  fib_entry_src_action_uninstall(fib_entry);
1406  }
1407 
1409  {
1410  /*
1411  * time for walkies fido.
1412  */
1413  fib_node_back_walk_ctx_t bw_ctx = {
1414  .fnbw_reason = res.bw_reason,
1415  };
1416 
1417  fib_walk_sync(FIB_NODE_TYPE_ENTRY, fib_entry_index, &bw_ctx);
1418  }
1419  FIB_ENTRY_DBG(fib_entry, "cover-updated");
1420 }
1421 
1422 int
1424  fib_node_index_t **entry_indicies)
1425 {
1426  fib_entry_t *fib_entry;
1427  int was_looped, is_looped;
1428 
1429  fib_entry = fib_entry_get(entry_index);
1430 
1431  if (FIB_NODE_INDEX_INVALID != fib_entry->fe_parent)
1432  {
1433  fib_node_index_t *entries = *entry_indicies;
1434 
1435  vec_add1(entries, entry_index);
1436  was_looped = fib_path_list_is_looped(fib_entry->fe_parent);
1437  is_looped = fib_path_list_recursive_loop_detect(fib_entry->fe_parent,
1438  &entries);
1439 
1440  *entry_indicies = entries;
1441 
1442  if (!!was_looped != !!is_looped)
1443  {
1444  /*
1445  * re-evaluate all the entry's forwarding
1446  * NOTE: this is an inplace modify
1447  */
1449  fib_entry_delegate_t *fed;
1450 
1451  FOR_EACH_DELEGATE_CHAIN(fib_entry, fdt, fed,
1452  {
1453  fib_entry_src_mk_lb(fib_entry,
1454  fib_entry_get_best_source(entry_index),
1456  &fed->fd_dpo);
1457  });
1458  }
1459  }
1460  else
1461  {
1462  /*
1463  * the entry is currently not linked to a path-list. this happens
1464  * when it is this entry that is re-linking path-lists and has thus
1465  * broken the loop
1466  */
1467  is_looped = 0;
1468  }
1469 
1470  return (is_looped);
1471 }
1472 
1473 u32
1475 {
1476  fib_entry_t *fib_entry;
1477 
1478  fib_entry = fib_entry_get(entry_index);
1479 
1480  return (fib_path_list_get_resolving_interface(fib_entry->fe_parent));
1481 }
1482 
1483 u32
1485 {
1486  const fib_entry_src_t *src;
1487  fib_entry_t *fib_entry;
1488  fib_source_t source;
1489  u32 sw_if_index;
1490 
1491  fib_entry = fib_entry_get(entry_index);
1492 
1493  FOR_EACH_SRC_ADDED(fib_entry, src, source,
1494  ({
1496  source);
1497 
1498  if (~0 != sw_if_index)
1499  break;
1500  }));
1501  return (sw_if_index);
1502 }
1503 
1506 {
1507  fib_entry_t *fib_entry;
1508  fib_entry_src_t *bsrc;
1509 
1510  fib_entry = fib_entry_get(entry_index);
1511 
1512  bsrc = fib_entry_get_best_src_i(fib_entry);
1513  return (fib_entry_src_get_source(bsrc));
1514 }
1515 
1516 /**
1517  * Return !0 is the entry represents a host prefix
1518  */
1519 int
1521 {
1522  return (fib_prefix_is_host(fib_entry_get_prefix(fib_entry_index)));
1523 }
1524 
1525 /**
1526  * Return !0 is the entry is resolved, i.e. will return a valid forwarding
1527  * chain
1528  */
1529 int
1531 {
1532  fib_entry_delegate_t *fed;
1533  fib_entry_t *fib_entry;
1534 
1535  fib_entry = fib_entry_get(fib_entry_index);
1536 
1538 
1539  if (NULL == fed)
1540  {
1541  /*
1542  * no BFD tracking - consider it resolved.
1543  */
1544  return (!0);
1545  }
1546  else
1547  {
1548  /*
1549  * defer to the state of the BFD tracking
1550  */
1551  return (FIB_BFD_STATE_UP == fed->fd_bfd_state);
1552  }
1553 }
1554 
1555 void
1557  flow_hash_config_t hash_config)
1558 {
1559  fib_entry_t *fib_entry;
1560 
1561  fib_entry = fib_entry_get(fib_entry_index);
1562 
1563  /*
1564  * pass the hash-config on to the load-balance object where it is cached.
1565  * we can ignore LBs in the delegate chains, since they will not be of the
1566  * correct protocol type (i.e. they are not IP)
1567  * There's no way, nor need, to change the hash config for MPLS.
1568  */
1569  if (dpo_id_is_valid(&fib_entry->fe_lb))
1570  {
1571  load_balance_t *lb;
1572 
1573  ASSERT(DPO_LOAD_BALANCE == fib_entry->fe_lb.dpoi_type);
1574 
1575  lb = load_balance_get(fib_entry->fe_lb.dpoi_index);
1576 
1577  /*
1578  * atomic update for packets in flight
1579  */
1580  lb->lb_hash_config = hash_config;
1581  }
1582 }
1583 
1584 u32
1586 {
1587  fib_entry_t *fib_entry;
1588 
1589  fib_entry = fib_entry_get(fib_entry_index);
1590 
1591  return (fib_entry->fe_lb.dpoi_index);
1592 }
1593 
1594 static int
1596  const ip4_address_t * a2)
1597 {
1598  /*
1599  * IP addresses are unsigned ints. the return value here needs to be signed
1600  * a simple subtraction won't cut it.
1601  * If the addresses are the same, the sort order is undefined, so phoey.
1602  */
1603  return ((clib_net_to_host_u32(a1->data_u32) >
1604  clib_net_to_host_u32(a2->data_u32) ) ?
1605  1 : -1);
1606 }
1607 
1608 static int
1609 fib_ip6_address_compare (const ip6_address_t * a1,
1610  const ip6_address_t * a2)
1611 {
1612  int i;
1613  for (i = 0; i < ARRAY_LEN (a1->as_u16); i++)
1614  {
1615  int cmp = (clib_net_to_host_u16 (a1->as_u16[i]) -
1616  clib_net_to_host_u16 (a2->as_u16[i]));
1617  if (cmp != 0)
1618  return cmp;
1619  }
1620  return 0;
1621 }
1622 
1623 static int
1625  fib_node_index_t fib_entry_index2)
1626 {
1627  fib_entry_t *fib_entry1, *fib_entry2;
1628  int cmp = 0;
1629 
1630  fib_entry1 = fib_entry_get(fib_entry_index1);
1631  fib_entry2 = fib_entry_get(fib_entry_index2);
1632 
1633  switch (fib_entry1->fe_prefix.fp_proto)
1634  {
1635  case FIB_PROTOCOL_IP4:
1636  cmp = fib_ip4_address_compare(&fib_entry1->fe_prefix.fp_addr.ip4,
1637  &fib_entry2->fe_prefix.fp_addr.ip4);
1638  break;
1639  case FIB_PROTOCOL_IP6:
1640  cmp = fib_ip6_address_compare(&fib_entry1->fe_prefix.fp_addr.ip6,
1641  &fib_entry2->fe_prefix.fp_addr.ip6);
1642  break;
1643  case FIB_PROTOCOL_MPLS:
1644  cmp = (fib_entry1->fe_prefix.fp_label - fib_entry2->fe_prefix.fp_label);
1645 
1646  if (0 == cmp)
1647  {
1648  cmp = (fib_entry1->fe_prefix.fp_eos - fib_entry2->fe_prefix.fp_eos);
1649  }
1650  break;
1651  }
1652 
1653  if (0 == cmp) {
1654  cmp = (fib_entry1->fe_prefix.fp_len - fib_entry2->fe_prefix.fp_len);
1655  }
1656  return (cmp);
1657 }
1658 
1659 int
1660 fib_entry_cmp_for_sort (void *i1, void *i2)
1661 {
1662  fib_node_index_t *fib_entry_index1 = i1, *fib_entry_index2 = i2;
1663 
1664  return (fib_entry_cmp(*fib_entry_index1,
1665  *fib_entry_index2));
1666 }
1667 
1668 void
1670 {
1671  fib_entry_t *fib_entry;
1672 
1673  fib_entry = fib_entry_get(fib_entry_index);
1674 
1675  fib_node_lock(&fib_entry->fe_node);
1676 }
1677 
1678 void
1680 {
1681  fib_entry_t *fib_entry;
1682 
1683  fib_entry = fib_entry_get(fib_entry_index);
1684 
1685  fib_node_unlock(&fib_entry->fe_node);
1686 }
1687 
1688 void
1690 {
1692  fib_entry_logger = vlib_log_register_class("fib", "entry");
1693 
1695 }
1696 
1699 {
1700  fib_path_ext_list_t *ext_list;
1702  .rpaths = NULL,
1703  };
1704  fib_entry_t *fib_entry;
1705  fib_entry_src_t *bsrc;
1706 
1707  ext_list = NULL;
1708  fib_entry = fib_entry_get(fib_entry_index);
1709  bsrc = fib_entry_get_best_src_i(fib_entry);
1710 
1711  if (bsrc)
1712  {
1713  ext_list = &bsrc->fes_path_exts;
1714  }
1715 
1716  if (FIB_NODE_INDEX_INVALID != fib_entry->fe_parent)
1717  {
1719  ext_list,
1721  &ctx);
1722  }
1723 
1724  return (ctx.rpaths);
1725 }
1726 
1727 const fib_prefix_t *
1729 {
1730  fib_entry_t *fib_entry;
1731 
1732  fib_entry = fib_entry_get(fib_entry_index);
1733 
1734  return (&fib_entry->fe_prefix);
1735 }
1736 
1737 u32
1739 {
1740  fib_entry_t *fib_entry;
1741 
1742  fib_entry = fib_entry_get(fib_entry_index);
1743 
1744  return (fib_entry->fe_fib_index);
1745 }
1746 
1747 u32
1749 {
1750  return (pool_elts(fib_entry_pool));
1751 }
1752 
1753 #if CLIB_DEBUG > 0
1754 void
1756 {
1757  fib_node_index_t *fei, *feis = NULL;
1758  fib_entry_t *fib_entry;
1759 
1760  pool_foreach (fib_entry, fib_entry_pool)
1761  {
1762  if (fib_entry->fe_fib_index == fib_table->ft_index)
1763  vec_add1 (feis, fib_entry_get_index(fib_entry));
1764  }
1765 
1766  if (vec_len(feis))
1767  {
1768  vec_foreach (fei, feis)
1770  }
1771 
1772  ASSERT(0);
1773 }
1774 #endif
1775 
1776 static clib_error_t *
1778  unformat_input_t * input,
1779  vlib_cli_command_t * cmd)
1780 {
1781  fib_node_index_t fei;
1782 
1783  if (unformat (input, "%d", &fei))
1784  {
1785  /*
1786  * show one in detail
1787  */
1789  {
1790  vlib_cli_output (vm, "%d@%U",
1791  fei,
1792  format_fib_entry, fei,
1794  }
1795  else
1796  {
1797  vlib_cli_output (vm, "entry %d invalid", fei);
1798  }
1799  }
1800  else
1801  {
1802  /*
1803  * show all
1804  */
1805  vlib_cli_output (vm, "FIB Entries:");
1807  {
1808  vlib_cli_output (vm, "%d@%U",
1809  fei,
1810  format_fib_entry, fei,
1812  }
1813  }
1814 
1815  return (NULL);
1816 }
1817 
1819  .path = "show fib entry",
1820  .function = show_fib_entry_command,
1821  .short_help = "show fib entry",
1822 };
load_balance.h
vlib.h
FIB_NODE_BW_REASON_FLAG_ADJ_DOWN
@ FIB_NODE_BW_REASON_FLAG_ADJ_DOWN
Definition: fib_node.h:163
tmp
u32 * tmp
Definition: interface_output.c:1078
FIB_NODE_TYPE_ENTRY
@ FIB_NODE_TYPE_ENTRY
Definition: fib_node.h:33
fib_entry_unlock
void fib_entry_unlock(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1679
fib_entry_src_action_path_swap
fib_entry_t * fib_entry_src_action_path_swap(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *rpaths)
Definition: fib_entry_src.c:1677
FIB_SOURCE_CMP_WORSE
@ FIB_SOURCE_CMP_WORSE
Definition: fib_source.h:190
fib_entry_get_flags_i
fib_entry_flag_t fib_entry_get_flags_i(const fib_entry_t *fib_entry)
Definition: fib_entry_src.c:1905
fib_entry.h
adj.h
fib_entry_src_cover_res_t_
Result from a cover update/change.
Definition: fib_entry_src.h:91
fib_entry_pool_size
u32 fib_entry_pool_size(void)
Definition: fib_entry.c:1748
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
fib_entry_source_removed
static fib_entry_src_flag_t fib_entry_source_removed(fib_entry_t *fib_entry, fib_entry_flag_t old_flags)
Definition: fib_entry.c:963
DPO_INVALID
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
fib_entry_src_mk_lb
void fib_entry_src_mk_lb(fib_entry_t *fib_entry, fib_source_t source, fib_forward_chain_type_t fct, dpo_id_t *dpo_lb)
Definition: fib_entry_src.c:563
fib_entry_alloc
static fib_entry_t * fib_entry_alloc(u32 fib_index, const fib_prefix_t *prefix, fib_node_index_t *fib_entry_index)
Definition: fib_entry.c:596
fib_entry_delegate_remove
void fib_entry_delegate_remove(fib_entry_t *fib_entry, fib_entry_delegate_type_t type)
Definition: fib_entry_delegate.c:72
fib_entry_vft
static const fib_node_vft_t fib_entry_vft
Definition: fib_entry.c:379
fib_entry_delegate_type_to_chain_type
fib_forward_chain_type_t fib_entry_delegate_type_to_chain_type(fib_entry_delegate_type_t fdt)
Definition: fib_entry_delegate.c:160
show_fib_entry_command
static clib_error_t * show_fib_entry_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: fib_entry.c:1777
FIB_NODE_BW_REASON_FLAG_INTERFACE_UP
@ FIB_NODE_BW_REASON_FLAG_INTERFACE_UP
Definition: fib_node.h:158
fib_src_attribute_names
static const char * fib_src_attribute_names[]
Definition: fib_entry.c:38
fib_entry_special_add
void fib_entry_special_add(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Definition: fib_entry.c:875
fib_entry_get_prefix
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1728
fib_attached_export_cover_update
void fib_attached_export_cover_update(fib_entry_t *fib_entry)
If this entry is tracking a cover (in another table) then that cover has been updated.
Definition: fib_attached_export.c:505
fib_node_back_walk_rc_t
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
fib_entry_contribute_urpf
void fib_entry_contribute_urpf(fib_node_index_t entry_index, index_t urpf)
Contribute the set of Adjacencies that this entry forwards with to build the uRPF list of its childre...
Definition: fib_entry.c:391
FIB_NODE_BW_REASON_FLAG_NONE
@ FIB_NODE_BW_REASON_FLAG_NONE
Definition: fib_node.h:155
fib_path_encode_ctx_t_
Path encode context to use when walking a path-list to encode paths.
Definition: fib_path.h:219
fib_entry_src_attribute_t
enum fib_entry_src_attribute_t_ fib_entry_src_attribute_t
Flags for the source data.
fib_entry_t_
An entry in a FIB table.
Definition: fib_entry.h:305
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
format_fib_path_ext_list
u8 * format_fib_path_ext_list(u8 *s, va_list *args)
Definition: fib_path_ext.c:461
fib_entry_src_burn_only_inherited
static fib_entry_src_flag_t fib_entry_src_burn_only_inherited(fib_entry_t *fib_entry)
Definition: fib_entry.c:934
format_fib_forw_chain_type
u8 * format_fib_forw_chain_type(u8 *s, va_list *args)
Definition: fib_types.c:49
fib_entry_cover_updated
void fib_entry_cover_updated(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1337
dpo_id_t_::dpoi_type
dpo_type_t dpoi_type
the type
Definition: dpo.h:178
fib_entry_set_flow_hash_config
void fib_entry_set_flow_hash_config(fib_node_index_t fib_entry_index, flow_hash_config_t hash_config)
Definition: fib_entry.c:1556
ADJ_INDEX_INVALID
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
Definition: adj_types.h:36
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
fib_entry_cmp_for_sort
int fib_entry_cmp_for_sort(void *i1, void *i2)
Definition: fib_entry.c:1660
vlib_log_class_t
u32 vlib_log_class_t
Definition: vlib.h:52
FIB_ENTRY_FORMAT_DETAIL
#define FIB_ENTRY_FORMAT_DETAIL
Definition: fib_entry.h:360
fib_path_list_format
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
Definition: fib_path_list.c:165
FIB_ENTRY_FORMAT_DETAIL2
#define FIB_ENTRY_FORMAT_DETAIL2
Definition: fib_entry.h:361
fib_entry_attribute_t
enum fib_entry_attribute_t_ fib_entry_attribute_t
The different sources that can create a route.
FIB_FORW_CHAIN_TYPE_MPLS_EOS
@ FIB_FORW_CHAIN_TYPE_MPLS_EOS
Contribute an object that is to be used to forward end-of-stack MPLS packets.
Definition: fib_types.h:128
vlib_log_register_class
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:339
fib_ip6_address_compare
static int fib_ip6_address_compare(const ip6_address_t *a1, const ip6_address_t *a2)
Definition: fib_entry.c:1609
fib_table_assert_empty
void fib_table_assert_empty(const fib_table_t *fib_table)
Debug function.
Definition: fib_entry.c:1755
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
fib_node_t_::fn_children
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
Definition: fib_node.h:315
load_balance_t_::lb_hash_config
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
Definition: load_balance.h:161
fib_node_vft_t_
A FIB graph nodes virtual function table.
Definition: fib_node.h:288
FIB_ENTRY_FLAG_ATTACHED
@ FIB_ENTRY_FLAG_ATTACHED
Definition: fib_entry.h:114
vlib_cli_command_t::path
char * path
Definition: cli.h:96
fib_entry_src_t_
Information related to the source of a FIB entry.
Definition: fib_entry.h:197
paths
paths
Definition: map.api:460
FIB_NODE_INDEX_INVALID
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
fib_table.h
FIB_FORW_CHAIN_TYPE_MCAST_IP4
@ FIB_FORW_CHAIN_TYPE_MCAST_IP4
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:132
fib_entry_delegate.h
fib_entry_src_action_reactivate
void fib_entry_src_action_reactivate(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:1190
entries
u32 entries
Definition: flowhash_template.h:362
fib_entry_t_::fe_parent
fib_node_index_t fe_parent
the path-list for which this entry is a child.
Definition: fib_entry.h:342
fib_node_t_::fn_locks
u32 fn_locks
Number of dependents on this node.
Definition: fib_node.h:321
FIB_FORW_CHAIN_TYPE_ETHERNET
@ FIB_FORW_CHAIN_TYPE_ETHERNET
Contribute an object that is to be used to forward Ethernet packets.
Definition: fib_types.h:140
fib_prefix_t_::fp_len
u16 fp_len
The mask length.
Definition: fib_types.h:206
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
fib_path_list_get_resolving_interface
u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index)
Definition: fib_path_list.c:611
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
fib_entry_chain_type_mcast_to_ucast
static fib_forward_chain_type_t fib_entry_chain_type_mcast_to_ucast(fib_forward_chain_type_t fct)
Definition: fib_entry.c:406
fib_node_children_format
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
Definition: fib_node.c:176
fib_entry_src_action_path_remove
fib_entry_src_flag_t fib_entry_src_action_path_remove(fib_entry_t *fib_entry, fib_source_t source, const fib_route_path_t *rpaths)
Definition: fib_entry_src.c:1738
MPLS_EOS
@ MPLS_EOS
Definition: packet.h:39
fib_source_cmp
fib_source_priority_cmp_t fib_source_cmp(fib_source_t s1, fib_source_t s2)
Definition: fib_source.c:76
fib_prefix_t_::fp_eos
mpls_eos_bit_t fp_eos
Definition: fib_types.h:229
fib_entry_src_inherit
void fib_entry_src_inherit(const fib_entry_t *cover, fib_entry_t *covered)
Definition: fib_entry_src.c:1017
fib_entry_src_get_source
static fib_source_t fib_entry_src_get_source(const fib_entry_src_t *esrc)
Definition: fib_entry.c:271
unformat_input_t
struct _unformat_input_t unformat_input_t
fib_entry_delegate_find
fib_entry_delegate_t * fib_entry_delegate_find(const fib_entry_t *fib_entry, fib_entry_delegate_type_t type)
Definition: fib_entry_delegate.c:65
fib_entry_inherit
void fib_entry_inherit(fib_node_index_t cover, fib_node_index_t covered)
fib_entry_inherit
Definition: fib_entry.c:1203
fib_entry_get_adj
adj_index_t fib_entry_get_adj(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:526
fib_entry_src_action_remove_or_update_inherit
fib_entry_src_flag_t fib_entry_src_action_remove_or_update_inherit(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:1387
drop_dpo.h
fib_node_type_t
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
fib_entry_get_best_src_i
static fib_entry_src_t * fib_entry_get_best_src_i(const fib_entry_t *fib_entry)
Definition: fib_entry.c:251
format_fib_entry_src_flags
u8 * format_fib_entry_src_flags(u8 *s, va_list *args)
Definition: fib_entry.c:115
fib_entry_contribute_forwarding
void fib_entry_contribute_forwarding(fib_node_index_t fib_entry_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
Definition: fib_entry.c:437
fib_entry_src_action_uninstall
void fib_entry_src_action_uninstall(fib_entry_t *fib_entry)
Definition: fib_entry_src.c:783
FIB_ENTRY_SRC_FLAG_INHERITED
@ FIB_ENTRY_SRC_FLAG_INHERITED
Definition: fib_entry.h:182
fib_entry_src_t_::fes_path_exts
fib_path_ext_list_t fes_path_exts
A vector of path extensions.
Definition: fib_entry.h:201
fib_node_get_n_children
u32 fib_node_get_n_children(fib_node_type_t parent_type, fib_node_index_t parent_index)
Definition: fib_node.c:142
FOR_EACH_FIB_SRC_ATTRIBUTE
#define FOR_EACH_FIB_SRC_ATTRIBUTE(_item)
Definition: fib_entry.h:171
show_fib_entry
static vlib_cli_command_t show_fib_entry
(constructor) VLIB_CLI_COMMAND (show_fib_entry)
Definition: fib_entry.c:1818
FIB_FORW_CHAIN_TYPE_NSH
@ FIB_FORW_CHAIN_TYPE_NSH
Contribute an object that is to be used to forward NSH packets.
Definition: fib_types.h:146
fib_node_back_walk_ctx_t_::fnbw_reason
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
Definition: fib_node.h:218
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
fib_entry_is_resolved
int fib_entry_is_resolved(fib_node_index_t fib_entry_index)
Return !0 is the entry is resolved, i.e.
Definition: fib_entry.c:1530
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
FIB_NODE_BW_REASON_FLAG_EVALUATE
@ FIB_NODE_BW_REASON_FLAG_EVALUATE
Definition: fib_node.h:157
FIB_FORW_CHAIN_TYPE_UNICAST_IP4
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP4
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:108
fib_entry_back_walk_notify
static fib_node_back_walk_rc_t fib_entry_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Definition: fib_entry.c:302
fib_entry_src.h
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
n_srcs
u8 n_srcs
Definition: igmp.api:68
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
fib_entry_chain_type_to_delegate_type
fib_entry_delegate_type_t fib_entry_chain_type_to_delegate_type(fib_forward_chain_type_t fct)
Definition: fib_entry_delegate.c:134
fib_entry_child_add
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: fib_entry.c:555
load_balance_get_bucket
const dpo_id_t * load_balance_get_bucket(index_t lbi, u32 bucket)
Definition: load_balance.c:366
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
fib_entry_flag_t
enum fib_entry_flag_t_ fib_entry_flag_t
FIB_SOURCE_CMP_EQUAL
@ FIB_SOURCE_CMP_EQUAL
Definition: fib_source.h:191
fib_entry_create_special
fib_node_index_t fib_entry_create_special(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Definition: fib_entry.c:757
fib_entry_t_::fe_fib_index
u32 fe_fib_index
The index of the FIB table this entry is in.
Definition: fib_entry.h:318
MPLS_IS_REPLICATE
#define MPLS_IS_REPLICATE
The top bit of the index, which is the result of the MPLS lookup is used to determine if the DPO is a...
Definition: mpls_types.h:66
fib_entry_t_::fe_srcs
fib_entry_src_t * fe_srcs
Vector of source infos.
Definition: fib_entry.h:337
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
fib_table_t_::ft_index
fib_node_index_t ft_index
Index into FIB vector.
Definition: fib_table.h:97
FIB_SOURCE_INVALID
@ FIB_SOURCE_INVALID
An invalid source This is not a real source, so don't use it to source a prefix.
Definition: fib_source.h:35
fib_forward_chain_type_t
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_entry_lock
void fib_entry_lock(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1669
fib_entry_contribute_ip_forwarding
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:506
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
fib_entry_cover_update_notify
void fib_entry_cover_update_notify(fib_entry_t *fib_entry)
Definition: fib_entry_cover.c:173
fib_entry_last_lock_gone
static void fib_entry_last_lock_gone(fib_node_t *node)
Definition: fib_entry.c:224
fib_walk.h
fib_ip4_address_compare
static int fib_ip4_address_compare(const ip4_address_t *a1, const ip4_address_t *a2)
Definition: fib_entry.c:1595
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
fib_forw_chain_type_to_dpo_proto
dpo_proto_t fib_forw_chain_type_to_dpo_proto(fib_forward_chain_type_t fct)
Convert from a chain type to the DPO proto it will install.
Definition: fib_types.c:516
format.h
fib_entry_special_update
void fib_entry_special_update(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Definition: fib_entry.c:892
fib_entry_cover.h
FIB_ENTRY_SRC_FLAG_NONE
@ FIB_ENTRY_SRC_FLAG_NONE
Definition: fib_entry.h:177
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
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.
fib_entry_track_module_init
void fib_entry_track_module_init(void)
Definition: fib_entry_track.c:175
fib_entry_get_node
static fib_node_t * fib_entry_get_node(fib_node_index_t index)
Definition: fib_entry.c:57
fib_path_ext_list_t_
A list of path-extensions.
Definition: fib_types.h:639
FIB_ENTRY_FLAG_NONE
@ FIB_ENTRY_FLAG_NONE
Definition: fib_entry.h:112
FIB_ENTRY_ATTRIBUTES
#define FIB_ENTRY_ATTRIBUTES
Definition: fib_entry.h:92
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
fib_entry_is_host
int fib_entry_is_host(fib_node_index_t fib_entry_index)
Return !0 is the entry represents a host prefix.
Definition: fib_entry.c:1520
format_fib_source
u8 * format_fib_source(u8 *s, va_list *args)
Definition: fib_source.c:66
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
fib_entry_get_index
fib_node_index_t fib_entry_get_index(const fib_entry_t *fib_entry)
Definition: fib_entry.c:63
fib_entry_from_fib_node
static fib_entry_t * fib_entry_from_fib_node(fib_node_t *node)
Definition: fib_entry.c:217
fib_attached_export_import
void fib_attached_export_import(fib_entry_t *fib_entry, fib_node_index_t export_fib)
FIB attached export.
Definition: fib_attached_export.c:240
fib_show_memory_usage
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
Definition: fib_node.c:220
fib_entry_module_init
void fib_entry_module_init(void)
Definition: fib_entry.c:1689
fib_entry_src_action_add
fib_entry_t * fib_entry_src_action_add(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Definition: fib_entry_src.c:1298
fib_entry_path_add
void fib_entry_path_add(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *rpaths)
Definition: fib_entry.c:911
dpo_id_is_valid
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
Definition: dpo.h:216
fib_entry_pool
static fib_entry_t * fib_entry_pool
Definition: fib_entry.c:43
fib_entry_src_action_remove
fib_entry_src_flag_t fib_entry_src_action_remove(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:1442
fib_entry_t_::fe_delegates
index_t * fe_delegates
A vector of delegate indices.
Definition: fib_entry.h:353
fib_prefix_t_::fp_label
mpls_label_t fp_label
Definition: fib_types.h:228
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
fib_entry_delegate_find_or_add
fib_entry_delegate_t * fib_entry_delegate_find_or_add(fib_entry_t *fib_entry, fib_entry_delegate_type_t fdt)
Definition: fib_entry_delegate.c:118
fib_entry_src_action_activate
void fib_entry_src_action_activate(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:1073
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
fib_entry_src_flag_t
enum fib_entry_src_flag_t_ fib_entry_src_flag_t
FIB_NODE_BW_REASON_FLAG_ADJ_UPDATE
@ FIB_NODE_BW_REASON_FLAG_ADJ_UPDATE
Definition: fib_node.h:161
fib_prefix_t_::fp_payload_proto
dpo_proto_t fp_payload_proto
This protocol determines the payload protocol of packets that will be forwarded by this entry once th...
Definition: fib_types.h:235
fib_entry_get_flags_for_source
fib_entry_flag_t fib_entry_get_flags_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
Definition: fib_entry_src.c:1877
fib_entry_delegate_t_::fd_bfd_state
fib_bfd_state_t fd_bfd_state
BFD state.
Definition: fib_entry_delegate.h:138
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
src
vl_api_address_t src
Definition: gre.api:54
FIB_ENTRY_DBG
#define FIB_ENTRY_DBG(_e, _fmt, _args...)
Definition: fib_entry_src.h:28
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
ip4_address_t
Definition: ip4_packet.h:50
fib_path_list_is_looped
int fib_path_list_is_looped(fib_node_index_t path_list_index)
Definition: fib_path_list.c:647
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
fib_entry_get_resolving_interface
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
Definition: fib_entry.c:1474
fib_node_register_type
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:60
fib_entry_src_action_path_add
fib_entry_t * fib_entry_src_action_path_add(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *rpaths)
Definition: fib_entry_src.c:1617
fib_path_ext_list_length
int fib_path_ext_list_length(const fib_path_ext_list_t *list)
Definition: fib_path_ext.c:481
FIB_NODE_BACK_WALK_CONTINUE
@ FIB_NODE_BACK_WALK_CONTINUE
Definition: fib_node.h:259
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
fib_attached_export_cover_change
void fib_attached_export_cover_change(fib_entry_t *fib_entry)
If this entry is tracking a cover (in another table) then that cover has changed.
Definition: fib_attached_export.c:495
fib_proto_to_dpo
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
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
format_dpo_id
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
Definition: dpo.c:150
FIB_NODE_BW_REASON_FLAG_INTERFACE_DOWN
@ FIB_NODE_BW_REASON_FLAG_INTERFACE_DOWN
Definition: fib_node.h:159
FIB_ENTRY_DELEGATE_BFD
@ FIB_ENTRY_DELEGATE_BFD
BFD session state.
Definition: fib_entry_delegate.h:49
fib_attached_export_purge
void fib_attached_export_purge(fib_entry_t *fib_entry)
All the imported entries need to be purged.
Definition: fib_attached_export.c:316
fib_entry_track.h
fib_entry_src_action_installed
fib_entry_t * fib_entry_src_action_installed(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:1274
fib_entry_src_format
u8 * fib_entry_src_format(fib_entry_t *fib_entry, fib_source_t source, u8 *s)
Definition: fib_entry_src.c:1787
fib_entry_post_flag_update_actions
static fib_entry_t * fib_entry_post_flag_update_actions(fib_entry_t *fib_entry, fib_entry_flag_t old_flags)
Definition: fib_entry.c:636
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
fib_entry_delegate_type_t
enum fib_entry_delegate_type_t_ fib_entry_delegate_type_t
Delegate types.
DPO_LOAD_BALANCE
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
Definition: dpo.h:104
format_fib_entry_flags
u8 * format_fib_entry_flags(u8 *s, va_list *args)
Definition: fib_entry.c:100
fib_walk_sync
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
Definition: fib_walk.c:745
fib_entry_recursive_loop_detect
int fib_entry_recursive_loop_detect(fib_node_index_t entry_index, fib_node_index_t **entry_indicies)
Definition: fib_entry.c:1423
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
pool_len
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:139
index
u32 index
Definition: flow_types.api:221
fib_entry_create
fib_node_index_t fib_entry_create(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *paths)
Definition: fib_entry.c:717
dpo_copy
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:264
fib_entry_delete
fib_entry_src_flag_t fib_entry_delete(fib_node_index_t fib_entry_index, fib_source_t source)
fib_entry_delete
Definition: fib_entry.c:1216
FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS
@ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS
Contribute an object that is to be used to forward non-end-of-stack MPLS packets.
Definition: fib_types.h:117
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:576
fib_entry_get
fib_entry_t * fib_entry_get(fib_node_index_t index)
Definition: fib_entry.c:51
fib_entry_src_action_update
fib_entry_t * fib_entry_src_action_update(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Definition: fib_entry_src.c:1353
fib_entry_src_action_deactivate
void fib_entry_src_action_deactivate(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:1134
fib_entry_src_action_cover_change
fib_entry_src_cover_res_t fib_entry_src_action_cover_change(fib_entry_t *fib_entry, fib_entry_src_t *esrc)
Definition: fib_entry_src.c:225
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
MPLS_NON_EOS
@ MPLS_NON_EOS
Definition: packet.h:38
fib_entry_get_any_resolving_interface
u32 fib_entry_get_any_resolving_interface(fib_node_index_t entry_index)
Definition: fib_entry.c:1484
fib_entry_source_change_w_flags
static void fib_entry_source_change_w_flags(fib_entry_t *fib_entry, fib_source_t old_source, fib_entry_flag_t old_flags, fib_source_t new_source)
Definition: fib_entry.c:823
fib_entry_recalculate_forwarding
void fib_entry_recalculate_forwarding(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:808
FIB_PROTOCOL_MPLS
@ FIB_PROTOCOL_MPLS
Definition: fib_types.h:38
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
fib_entry_t_::fe_lb
dpo_id_t fe_lb
The load-balance used for forwarding.
Definition: fib_entry.h:331
DPO_PROTO_MPLS
@ DPO_PROTO_MPLS
Definition: dpo.h:66
u32
unsigned int u32
Definition: types.h:88
FOR_EACH_SRC_ADDED
#define FOR_EACH_SRC_ADDED(_entry, _src, _source, action)
Definition: fib_entry_src.h:218
fib_entry_show_memory
static void fib_entry_show_memory(void)
Definition: fib_entry.c:349
fib_entry_src_t_::fes_src
fib_source_t fes_src
Which source this info block is for.
Definition: fib_entry.h:216
ip4_address_t::data_u32
u32 data_u32
Definition: ip4_packet.h:53
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
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
format_fib_prefix
u8 * format_fib_prefix(u8 *s, va_list *args)
Definition: fib_types.c:283
FIB_BFD_STATE_UP
@ FIB_BFD_STATE_UP
Definition: fib_entry_delegate.h:80
DPO_PROTO_NONE
#define DPO_PROTO_NONE
Definition: dpo.h:73
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
load_balance_get
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:220
fib_entry_t_::fe_node
fib_node_t fe_node
Base class.
Definition: fib_entry.h:309
FIB_NODE_BW_REASON_FLAG_INTERFACE_DELETE
@ FIB_NODE_BW_REASON_FLAG_INTERFACE_DELETE
Definition: fib_node.h:160
fib_node_lock
void fib_node_lock(fib_node_t *node)
Definition: fib_node.c:203
fib_entry_get_flags
fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:291
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
fib_entry_post_update_actions
static void fib_entry_post_update_actions(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t old_flags)
Definition: fib_entry.c:786
fib_entry_source_change
void fib_entry_source_change(fib_entry_t *fib_entry, fib_source_t old_source, fib_source_t new_source)
Definition: fib_entry.c:861
FIB_FORW_CHAIN_TYPE_BIER
@ FIB_FORW_CHAIN_TYPE_BIER
Contribute an object that is to be used to forward BIER packets.
Definition: fib_types.h:121
FIB_ENTRY_FORMAT_BRIEF
#define FIB_ENTRY_FORMAT_BRIEF
Definition: fib_entry.h:359
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
fib_entry_get_fib_index
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1738
fib_entry_src_get_flags
static fib_entry_flag_t fib_entry_src_get_flags(const fib_entry_src_t *esrc)
Definition: fib_entry.c:281
FIB_FORW_CHAIN_TYPE_MCAST_IP6
@ FIB_FORW_CHAIN_TYPE_MCAST_IP6
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:136
fib_node_t_
An node in the FIB graph.
Definition: fib_node.h:301
fib_entry_src_cover_res_t_::bw_reason
fib_node_bw_reason_flag_t bw_reason
Definition: fib_entry_src.h:93
fib_entry_get_dpo_proto
dpo_proto_t fib_entry_get_dpo_proto(const fib_entry_t *fib_entry)
Definition: fib_entry.c:75
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
FOR_EACH_FIB_ATTRIBUTE
#define FOR_EACH_FIB_ATTRIBUTE(_item)
Definition: fib_entry.h:106
fib_entry_encode
fib_route_path_t * fib_entry_encode(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1698
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
FIB_SOURCE_FIRST
@ FIB_SOURCE_FIRST
Marker.
Definition: fib_source.h:39
fib_path_list_contribute_urpf
void fib_path_list_contribute_urpf(fib_node_index_t path_list_index, index_t urpf)
Contribute (add) this path list's uRPF list.
Definition: fib_path_list.c:435
drop_dpo_get
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
fib_node_init
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
fib_attribute_names
static const char * fib_attribute_names[]
Definition: fib_entry.c:37
fib_entry_logger
vlib_log_class_t fib_entry_logger
the logger
Definition: fib_entry.c:48
fib_entry_t_::fe_prefix
const fib_prefix_t fe_prefix
The prefix of the route.
Definition: fib_entry.h:314
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
fib_node_unlock
void fib_node_unlock(fib_node_t *node)
Definition: fib_node.c:209
lookup.h
fib_entry_src_t_::fes_entry_flags
fib_entry_flag_t fes_entry_flags
Flags the source contributes to the entry.
Definition: fib_entry.h:211
fib_entry_get_stats_index
u32 fib_entry_get_stats_index(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1585
dpo_is_adj
int dpo_is_adj(const dpo_id_t *dpo)
Return TRUE is the DPO is any type of adjacency.
Definition: dpo.c:282
fib_internal.h
fib_entry_src_action_cover_update
fib_entry_src_cover_res_t fib_entry_src_action_cover_update(fib_entry_t *fib_entry, fib_entry_src_t *esrc)
Definition: fib_entry_src.c:239
fib_path_ext_t_
A path extension is a per-entry addition to the forwarding information when packets are sent for that...
Definition: fib_path_ext.h:98
FIB_ENTRY_SRC_ATTRIBUTES
#define FIB_ENTRY_SRC_ATTRIBUTES
Definition: fib_entry.h:163
fib_entry_src_t_::fes_flags
fib_entry_src_flag_t fes_flags
Flags on the source.
Definition: fib_entry.h:221
format_fib_entry_delegate
u8 * format_fib_entry_delegate(u8 *s, va_list *args)
Definition: fib_entry_delegate.c:296
clib_error
#define clib_error(format, args...)
Definition: error.h:62
fib_node_back_walk_ctx_t_
Context passed between object during a back walk.
Definition: fib_node.h:214
FIB_SOURCE_CMP_BETTER
@ FIB_SOURCE_CMP_BETTER
Definition: fib_source.h:189
fib_node_vft_t_::fnv_get
fib_node_get_t fnv_get
Definition: fib_node.h:289
fib_node_child_remove
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
Definition: fib_node.c:123
fib_entry_get_default_chain_type
fib_forward_chain_type_t fib_entry_get_default_chain_type(const fib_entry_t *fib_entry)
Definition: fib_entry.c:81
fib_prefix_is_host
int fib_prefix_is_host(const fib_prefix_t *prefix)
Return true is the prefix is a host prefix.
Definition: fib_types.c:249
FIB_NODE_BW_FLAG_FORCE_SYNC
@ FIB_NODE_BW_FLAG_FORCE_SYNC
Force the walk to be synchronous.
Definition: fib_node.h:180
fib_entry_special_remove
fib_entry_src_flag_t fib_entry_special_remove(fib_node_index_t fib_entry_index, fib_source_t source)
Definition: fib_entry.c:1099
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
fib_source_t
enum fib_source_t_ fib_source_t
The different sources that can create a route.
FIB_ENTRY_SRC_FLAG_ADDED
@ FIB_ENTRY_SRC_FLAG_ADDED
Definition: fib_entry.h:178
fib_entry_path_remove
fib_entry_src_flag_t fib_entry_path_remove(fib_node_index_t fib_entry_index, fib_source_t source, const fib_route_path_t *rpaths)
Definition: fib_entry.c:1007
fib_node_deinit
void fib_node_deinit(fib_node_t *node)
Definition: fib_node.c:197
fib_path_ext.h
load_balance_t_
The FIB DPO provieds;.
Definition: load_balance.h:106
FIB_FORW_CHAIN_TYPE_UNICAST_IP6
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP6
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:112
fib_entry_delegate_t_
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...
Definition: fib_entry_delegate.h:99
fib_entry_src_cover_res_t_::install
u16 install
Definition: fib_entry_src.h:92
fib_entry_update
void fib_entry_update(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *paths)
fib_entry_update
Definition: fib_entry.c:1228
fib_entry_child_remove
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
Definition: fib_entry.c:566
vlib_cli_command_t
Definition: cli.h:92
fib_entry_cover_changed
void fib_entry_cover_changed(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1261
fib_entry_get_proto
fib_protocol_t fib_entry_get_proto(const fib_entry_t *fib_entry)
Definition: fib_entry.c:69
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
fib_entry_cmp
static int fib_entry_cmp(fib_node_index_t fib_entry_index1, fib_node_index_t fib_entry_index2)
Definition: fib_entry.c:1624
fib_entry_post_install_actions
static fib_entry_t * fib_entry_post_install_actions(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t old_flags)
Definition: fib_entry.c:705
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
format_fib_node_bw_reason
u8 * format_fib_node_bw_reason(u8 *s, va_list *args)
Definition: fib_walk.c:973
fib_entry_get_resolving_interface_for_source
u32 fib_entry_get_resolving_interface_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
Definition: fib_entry_src.c:1856
fib_attached_export.h
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
fib_path_list_recursive_loop_detect
int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies)
Definition: fib_path_list.c:1252
fib_node_child_add
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
Definition: fib_node.c:98
fib_entry_get_best_source
fib_source_t fib_entry_get_best_source(fib_node_index_t entry_index)
Definition: fib_entry.c:1505
FOR_EACH_DELEGATE_CHAIN
#define FOR_EACH_DELEGATE_CHAIN(_entry, _fdt, _fed, _body)
Definition: fib_entry_delegate.h:61
fib_entry_delegate_t_::fd_dpo
dpo_id_t fd_dpo
Valid for the forwarding chain delegates.
Definition: fib_entry_delegate.h:123
FIB_ENTRY_SRC_FLAG_CONTRIBUTING
@ FIB_ENTRY_SRC_FLAG_CONTRIBUTING
Definition: fib_entry.h:179
fib_entry_get_path_list
fib_node_index_t fib_entry_get_path_list(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:545
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
FIB_ENTRY_FLAG_IMPORT
@ FIB_ENTRY_FLAG_IMPORT
Definition: fib_entry.h:118
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
format_fib_entry
u8 * format_fib_entry(u8 *s, va_list *args)
Definition: fib_entry.c:130