FD.io VPP  v17.04.2-2-ga8f93f8
Vector Packet Processing
mfib_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 
18 #include <vnet/mfib/mfib_entry.h>
19 #include <vnet/fib/fib_path_list.h>
20 
21 #include <vnet/dpo/drop_dpo.h>
22 #include <vnet/dpo/replicate_dpo.h>
23 
24 /**
25  * Debug macro
26  */
27 #ifdef MFIB_DEBUG
28 #DEFIne MFIB_ENTRY_DBG(_e, _fmt, _args...) \
29 { \
30  u8*__tmp = NULL; \
31  __tmp = format(__tmp, "e:[%d:%U", \
32  mfib_entry_get_index(_e), \
33  format_ip46_address, \
34  &_e->mfe_prefix.fp_grp_addr, \
35  IP46_TYPE_ANY); \
36  __tmp = format(__tmp, "/%d,", \
37  _e->mfe_prefix.fp_len); \
38  __tmp = format(__tmp, "%U]", \
39  mfib_entry_get_index(_e), \
40  format_ip46_address, \
41  &_e->mfe_prefix.fp_src_addr, \
42  IP46_TYPE_ANY); \
43  __tmp = format(__tmp, _fmt, ##_args); \
44  clib_warning("%s", __tmp); \
45  vec_free(__tmp); \
46 }
47 #else
48 #define MFIB_ENTRY_DBG(_e, _fmt, _args...)
49 #endif
50 
51 /**
52  * The source of an MFIB entry
53  */
54 typedef struct mfib_entry_src_t_
55 {
56  /**
57  * Which source this is
58  */
60 
61  /**
62  * The path-list of forwarding interfaces
63  */
65 
66  /**
67  * Route flags
68  */
70 
71  /**
72  * The hash table of all interfaces
73  */
76 
77 /**
78  * String names for each source
79  */
80 static const char *mfib_source_names[] = MFIB_SOURCE_NAMES;
81 
82 /*
83  * Pool for all fib_entries
84  */
86 
87 static fib_node_t *
89 {
90  return ((fib_node_t*)mfib_entry_get(index));
91 }
92 
93 static fib_protocol_t
94 mfib_entry_get_proto (const mfib_entry_t * mfib_entry)
95 {
96  return (mfib_entry->mfe_prefix.fp_proto);
97 }
98 
101 {
102  switch (mfib_entry->mfe_prefix.fp_proto)
103  {
104  case FIB_PROTOCOL_IP4:
106  case FIB_PROTOCOL_IP6:
108  case FIB_PROTOCOL_MPLS:
109  ASSERT(0);
110  break;
111  }
113 }
114 
115 static u8 *
116 format_mfib_entry_dpo (u8 * s, va_list * args)
117 {
118  index_t fei = va_arg(*args, index_t);
119  CLIB_UNUSED(u32 indent) = va_arg(*args, u32);
120 
121  return (format(s, "%U",
122  format_mfib_entry, fei,
124 }
125 
126 u8 *
127 format_mfib_entry (u8 * s, va_list * args)
128 {
129  fib_node_index_t fei, mfi;
130  mfib_entry_t *mfib_entry;
131  mfib_entry_src_t *msrc;
132  u32 sw_if_index;
133  int level;
134 
135  fei = va_arg (*args, fib_node_index_t);
136  level = va_arg (*args, int);
137  mfib_entry = mfib_entry_get(fei);
138 
139  s = format (s, "%U", format_mfib_prefix, &mfib_entry->mfe_prefix);
140  s = format (s, ": %U", format_mfib_entry_flags, mfib_entry->mfe_flags);
141 
142  if (level >= MFIB_ENTRY_FORMAT_DETAIL)
143  {
144  s = format (s, "\n");
145  s = format (s, " fib:%d", mfib_entry->mfe_fib_index);
146  s = format (s, " index:%d", mfib_entry_get_index(mfib_entry));
147  s = format (s, " locks:%d\n", mfib_entry->mfe_node.fn_locks);
148  vec_foreach(msrc, mfib_entry->mfe_srcs)
149  {
150  s = format (s, " src:%s", mfib_source_names[msrc->mfes_src]);
151  s = format (s, ": %U\n", format_mfib_entry_flags, msrc->mfes_flags);
152  if (FIB_NODE_INDEX_INVALID != msrc->mfes_pl)
153  {
154  s = fib_path_list_format(msrc->mfes_pl, s);
155  }
156  hash_foreach(sw_if_index, mfi, msrc->mfes_itfs,
157  ({
158  s = format(s, " %U\n", format_mfib_itf, mfi);
159  }));
160  }
161  }
162 
163  s = format(s, "\n Interfaces:");
164  hash_foreach(sw_if_index, mfi, mfib_entry->mfe_itfs,
165  ({
166  s = format(s, "\n %U", format_mfib_itf, mfi);
167  }));
168 
169  s = format(s, "\n %U-chain\n %U",
173  &mfib_entry->mfe_rep,
174  2);
175  s = format(s, "\n");
176 
177  if (level >= MFIB_ENTRY_FORMAT_DETAIL2)
178  {
179  s = format(s, "\nchildren:");
180  s = fib_node_children_format(mfib_entry->mfe_node.fn_children, s);
181  }
182 
183  return (s);
184 }
185 
186 static mfib_entry_t*
188 {
189 #if CLIB_DEBUG > 0
191 #endif
192  return ((mfib_entry_t*)node);
193 }
194 
195 static int
197  void * v2)
198 {
199  mfib_entry_src_t *esrc1 = v1, *esrc2 = v2;
200 
201  return (esrc1->mfes_src - esrc2->mfes_src);
202 }
203 
204 static void
206  mfib_source_t source)
207 
208 {
209  mfib_entry_src_t esrc = {
211  .mfes_flags = MFIB_ENTRY_FLAG_NONE,
212  .mfes_src = source,
213  };
214 
215  vec_add1(mfib_entry->mfe_srcs, esrc);
216  vec_sort_with_function(mfib_entry->mfe_srcs,
218 }
219 
220 static mfib_entry_src_t *
222  mfib_source_t source,
223  u32 *index)
224 
225 {
226  mfib_entry_src_t *esrc;
227  int ii;
228 
229  ii = 0;
230  vec_foreach(esrc, mfib_entry->mfe_srcs)
231  {
232  if (esrc->mfes_src == source)
233  {
234  if (NULL != index)
235  {
236  *index = ii;
237  }
238  return (esrc);
239  }
240  else
241  {
242  ii++;
243  }
244  }
245 
246  return (NULL);
247 }
248 
249 static mfib_entry_src_t *
251  mfib_source_t source)
252 {
253  mfib_entry_src_t *esrc;
254 
255  esrc = mfib_entry_src_find(mfib_entry, source, NULL);
256 
257  if (NULL == esrc)
258  {
259  mfib_entry_src_init(mfib_entry, source);
260  }
261 
262  return (mfib_entry_src_find(mfib_entry, source, NULL));
263 }
264 
265 static mfib_entry_src_t*
267 {
268  mfib_entry_src_t *bsrc;
269 
270  /*
271  * the enum of sources is deliberately arranged in priority order
272  */
273  if (0 == vec_len(mfib_entry->mfe_srcs))
274  {
275  bsrc = NULL;
276  }
277  else
278  {
279  bsrc = vec_elt_at_index(mfib_entry->mfe_srcs, 0);
280  }
281 
282  return (bsrc);
283 }
284 
285 static void
287 {
288  u32 sw_if_index;
289  index_t mfii;
290 
291  hash_foreach(sw_if_index, mfii, msrc->mfes_itfs,
292  ({
293  mfib_itf_delete(mfib_itf_get(mfii));
294  }));
295  hash_free(msrc->mfes_itfs);
296  msrc->mfes_itfs = NULL;
298 }
299 
300 static void
302  mfib_source_t source)
303 
304 {
305  mfib_entry_src_t *msrc;
306  u32 index = ~0;
307 
308  msrc = mfib_entry_src_find(mfib_entry, source, &index);
309 
310  if (NULL != msrc)
311  {
312  mfib_entry_src_flush(msrc);
313  vec_del1(mfib_entry->mfe_srcs, index);
314  }
315 }
316 
317 static int
319 {
320  return (hash_elts(msrc->mfes_itfs));
321 }
322 
323 
324 static void
326 {
327  mfib_entry_t *mfib_entry;
328  mfib_entry_src_t *msrc;
329 
330  mfib_entry = mfib_entry_from_fib_node(node);
331 
332  dpo_reset(&mfib_entry->mfe_rep);
333 
334  MFIB_ENTRY_DBG(mfib_entry, "last-lock");
335 
336  vec_foreach(msrc, mfib_entry->mfe_srcs)
337  {
338  mfib_entry_src_flush(msrc);
339  }
340 
341  fib_path_list_unlock(mfib_entry->mfe_parent);
342  vec_free(mfib_entry->mfe_srcs);
343 
344  fib_node_deinit(&mfib_entry->mfe_node);
345  pool_put(mfib_entry_pool, mfib_entry);
346 }
347 
348 /*
349  * mfib_entry_back_walk_notify
350  *
351  * A back walk has reach this entry.
352  */
356 {
357  // FIXME - re-evalute
358 
360 }
361 
362 static void
364 {
365  fib_show_memory_usage("multicast-Entry",
366  pool_elts(mfib_entry_pool),
367  pool_len(mfib_entry_pool),
368  sizeof(mfib_entry_t));
369 }
370 
371 /*
372  * The MFIB entry's graph node virtual function table
373  */
374 static const fib_node_vft_t mfib_entry_vft = {
376  .fnv_last_lock = mfib_entry_last_lock_gone,
377  .fnv_back_walk = mfib_entry_back_walk_notify,
378  .fnv_mem_show = mfib_entry_show_memory,
379 };
380 
381 u32
383  fib_node_type_t child_type,
384  fib_node_index_t child_index)
385 {
387  mfib_entry_index,
388  child_type,
389  child_index));
390 };
391 
392 void
394  u32 sibling_index)
395 {
397  mfib_entry_index,
398  sibling_index);
399 }
400 
401 static mfib_entry_t *
403  const mfib_prefix_t *prefix,
404  fib_node_index_t *mfib_entry_index)
405 {
406  mfib_entry_t *mfib_entry;
407 
408  pool_get(mfib_entry_pool, mfib_entry);
409 
410  fib_node_init(&mfib_entry->mfe_node,
412 
413  /*
414  * Some of the members require non-default initialisation
415  * so we also init those that don't and thus save on the call to memset.
416  */
417  mfib_entry->mfe_flags = 0;
418  mfib_entry->mfe_fib_index = fib_index;
419  mfib_entry->mfe_prefix = *prefix;
420  mfib_entry->mfe_parent = FIB_NODE_INDEX_INVALID;
421  mfib_entry->mfe_sibling = FIB_NODE_INDEX_INVALID;
422  mfib_entry->mfe_srcs = NULL;
423  mfib_entry->mfe_itfs = NULL;
424 
425  dpo_reset(&mfib_entry->mfe_rep);
426 
427  *mfib_entry_index = mfib_entry_get_index(mfib_entry);
428 
429  MFIB_ENTRY_DBG(mfib_entry, "alloc");
430 
431  return (mfib_entry);
432 }
433 
435 {
439 
440 static int
442  fib_node_index_t path_index,
443  void *arg)
444 {
447 
448  ctx = arg;
449 
450  /*
451  * if the path is not resolved, don't include it.
452  */
453  if (!fib_path_is_resolved(path_index))
454  {
455  return (!0);
456  }
457 
458  switch (ctx->fct)
459  {
462  /*
463  * EOS traffic with no label to stack, we need the IP Adj
464  */
465  vec_add2(ctx->next_hops, nh, 1);
466 
467  nh->path_index = path_index;
468  nh->path_weight = fib_path_get_weight(path_index);
469  fib_path_contribute_forwarding(path_index, ctx->fct, &nh->path_dpo);
470  break;
471 
478  ASSERT(0);
479  break;
480  }
481 
482  return (!0);
483 }
484 
485 static void
487 {
488  dpo_proto_t dp;
489 
490  dp = fib_proto_to_dpo(mfib_entry_get_proto(mfib_entry));
491 
492  if (FIB_NODE_INDEX_INVALID != mfib_entry->mfe_parent)
493  {
495  .next_hops = NULL,
496  .fct = mfib_entry_get_default_chain_type(mfib_entry),
497  };
498 
499  fib_path_list_walk(mfib_entry->mfe_parent,
501  &ctx);
502 
503  if (!(MFIB_ENTRY_FLAG_EXCLUSIVE & mfib_entry->mfe_flags))
504  {
505  /*
506  * each path contirbutes a next-hop. form a replicate
507  * from those choices.
508  */
509  if (!dpo_id_is_valid(&mfib_entry->mfe_rep) ||
510  dpo_is_drop(&mfib_entry->mfe_rep))
511  {
512  dpo_id_t tmp_dpo = DPO_INVALID;
513 
514  dpo_set(&tmp_dpo,
515  DPO_REPLICATE, dp,
516  replicate_create(0, dp));
517 
519  &mfib_entry->mfe_rep,
520  &tmp_dpo);
521 
522  dpo_reset(&tmp_dpo);
523  }
524  replicate_multipath_update(&mfib_entry->mfe_rep,
525  ctx.next_hops);
526  }
527  else
528  {
529  /*
530  * for exclusive routes the source provided a replicate DPO
531  * we we stashed inthe special path list with one path
532  * so we can stack directly on that.
533  */
534  ASSERT(1 == vec_len(ctx.next_hops));
535 
537  &mfib_entry->mfe_rep,
538  &ctx.next_hops[0].path_dpo);
539  dpo_reset(&ctx.next_hops[0].path_dpo);
540  vec_free(ctx.next_hops);
541  }
542  }
543  else
544  {
546  &mfib_entry->mfe_rep,
547  drop_dpo_get(dp));
548  }
549 }
550 
551 static void
553  const fib_route_path_t *rpath)
554 {
555  fib_node_index_t old_pl_index;
556  fib_route_path_t *rpaths;
557 
559 
560  /*
561  * path-lists require a vector of paths
562  */
563  rpaths = NULL;
564  vec_add1(rpaths, rpath[0]);
565 
566  old_pl_index = msrc->mfes_pl;
567 
568  if (FIB_NODE_INDEX_INVALID == msrc->mfes_pl)
569  {
570  msrc->mfes_pl =
572  rpaths);
573  }
574  else
575  {
576  msrc->mfes_pl =
579  rpaths);
580  }
582  fib_path_list_unlock(old_pl_index);
583 
584  vec_free(rpaths);
585 }
586 
587 static int
589  const fib_route_path_t *rpath)
590 {
591  fib_node_index_t old_pl_index;
592  fib_route_path_t *rpaths;
593 
595 
596  /*
597  * path-lists require a vector of paths
598  */
599  rpaths = NULL;
600  vec_add1(rpaths, rpath[0]);
601 
602  old_pl_index = msrc->mfes_pl;
603 
604  msrc->mfes_pl =
607  rpaths);
608 
610  fib_path_list_unlock(old_pl_index);
611 
612  vec_free(rpaths);
613 
614  return (FIB_NODE_INDEX_INVALID != msrc->mfes_pl);
615 }
616 
617 static void
619 {
620  fib_node_index_t old_pl_index;
621  mfib_entry_src_t *bsrc;
622 
623  old_pl_index = mfib_entry->mfe_parent;
624 
625  /*
626  * copy the forwarding data from the bast source
627  */
628  bsrc = mfib_entry_get_best_src(mfib_entry);
629 
630  if (NULL == bsrc)
631  {
632  mfib_entry->mfe_parent = FIB_NODE_INDEX_INVALID;
633  }
634  else
635  {
636  mfib_entry->mfe_parent = bsrc->mfes_pl;
637  mfib_entry->mfe_flags = bsrc->mfes_flags;
638  mfib_entry->mfe_itfs = bsrc->mfes_itfs;
639  }
640 
641  /*
642  * re-stack the entry on the best forwarding info.
643  */
644  if (old_pl_index != mfib_entry->mfe_parent ||
645  FIB_NODE_INDEX_INVALID == old_pl_index)
646  {
647  mfib_entry_stack(mfib_entry);
648 
649  fib_path_list_lock(mfib_entry->mfe_parent);
650  fib_path_list_unlock(old_pl_index);
651  }
652 }
653 
654 
657  mfib_source_t source,
658  const mfib_prefix_t *prefix,
659  mfib_entry_flags_t entry_flags)
660 {
661  fib_node_index_t mfib_entry_index;
662  mfib_entry_t *mfib_entry;
663  mfib_entry_src_t *msrc;
664 
665  mfib_entry = mfib_entry_alloc(fib_index, prefix,
666  &mfib_entry_index);
667  msrc = mfib_entry_src_find_or_create(mfib_entry, source);
668  msrc->mfes_flags = entry_flags;
669 
671 
672  return (mfib_entry_index);
673 }
674 
675 static int
677 {
678  return (0 == vec_len(mfib_entry->mfe_srcs));
679 }
680 
681 static int
683 {
684  return ((MFIB_ENTRY_FLAG_NONE == msrc->mfes_flags &&
685  0 == mfib_entry_src_n_itfs(msrc)));
686 }
687 
688 int
690  mfib_source_t source,
691  mfib_entry_flags_t entry_flags,
692  index_t repi)
693 {
694  mfib_entry_t *mfib_entry;
695  mfib_entry_src_t *msrc;
696 
697  mfib_entry = mfib_entry_get(mfib_entry_index);
698  msrc = mfib_entry_src_find_or_create(mfib_entry, source);
699  msrc->mfes_flags = entry_flags;
700 
701  if (INDEX_INVALID != repi)
702  {
703  /*
704  * The source is providing its own replicate DPO.
705  * Create a sepcial path-list to manage it, that way
706  * this entry and the source are equivalent to a normal
707  * entry
708  */
709  fib_node_index_t old_pl_index;
710  fib_protocol_t fp;
711  dpo_id_t dpo = DPO_INVALID;
712 
713  fp = mfib_entry_get_proto(mfib_entry);
714  old_pl_index = msrc->mfes_pl;
715 
716  dpo_set(&dpo, DPO_REPLICATE,
717  fib_proto_to_dpo(fp),
718  repi);
719 
720  msrc->mfes_pl =
723  &dpo);
724 
725  dpo_reset(&dpo);
727  fib_path_list_unlock(old_pl_index);
728  }
729 
731  {
732  /*
733  * this source has no interfaces and no flags.
734  * it has nothing left to give - remove it
735  */
736  mfib_entry_src_remove(mfib_entry, source);
737  }
738 
740 
741  return (mfib_entry_ok_for_delete(mfib_entry));
742 }
743 
744 static void
746  u32 sw_if_index,
747  index_t mi)
748 {
749  hash_set(msrc->mfes_itfs, sw_if_index, mi);
750 }
751 
752 static void
754  u32 sw_if_index)
755 {
756  mfib_itf_t *mfi;
757 
758  mfi = mfib_entry_itf_find(msrc->mfes_itfs, sw_if_index);
759 
760  mfib_itf_delete(mfi);
761 
762  hash_unset(msrc->mfes_itfs, sw_if_index);
763 }
764 
765 void
767  mfib_source_t source,
768  const fib_route_path_t *rpath,
769  mfib_itf_flags_t itf_flags)
770 {
771  mfib_entry_t *mfib_entry;
772  mfib_entry_src_t *msrc;
773  mfib_itf_t *mfib_itf;
774 
775  mfib_entry = mfib_entry_get(mfib_entry_index);
776  ASSERT(NULL != mfib_entry);
777  msrc = mfib_entry_src_find_or_create(mfib_entry, source);
778 
779  /*
780  * search for the interface in the current set
781  */
782  mfib_itf = mfib_entry_itf_find(msrc->mfes_itfs,
783  rpath[0].frp_sw_if_index);
784 
785  if (NULL == mfib_itf)
786  {
787  /*
788  * this is a path we do not yet have. If it is forwarding then we
789  * add it to the replication set
790  */
791  if (itf_flags & MFIB_ITF_FLAG_FORWARD)
792  {
793  mfib_entry_forwarding_path_add(msrc, rpath);
794  }
795  /*
796  * construct a new ITF for this entry's list
797  */
798  mfib_entry_itf_add(msrc,
799  rpath[0].frp_sw_if_index,
800  mfib_itf_create(rpath[0].frp_sw_if_index,
801  itf_flags));
802  }
803  else
804  {
805  int was_forwarding = !!(mfib_itf->mfi_flags & MFIB_ITF_FLAG_FORWARD);
806  int is_forwarding = !!(itf_flags & MFIB_ITF_FLAG_FORWARD);
807 
808  if (!was_forwarding && is_forwarding)
809  {
810  mfib_entry_forwarding_path_add(msrc, rpath);
811  }
812  else if (was_forwarding && !is_forwarding)
813  {
815  }
816  /*
817  * packets in flight see these updates.
818  */
819  mfib_itf->mfi_flags = itf_flags;
820  }
821 
823 }
824 
825 /*
826  * mfib_entry_path_remove
827  *
828  * remove a path from the entry.
829  * return the mfib_entry's index if it is still present, INVALID otherwise.
830  */
831 int
833  mfib_source_t source,
834  const fib_route_path_t *rpath)
835 {
836  mfib_entry_t *mfib_entry;
837  mfib_entry_src_t *msrc;
838  mfib_itf_t *mfib_itf;
839 
840  mfib_entry = mfib_entry_get(mfib_entry_index);
841  ASSERT(NULL != mfib_entry);
842  msrc = mfib_entry_src_find(mfib_entry, source, NULL);
843 
844  if (NULL == msrc)
845  {
846  /*
847  * there are no paths left for this source
848  */
849  return (mfib_entry_ok_for_delete(mfib_entry));
850  }
851 
852  /*
853  * search for the interface in the current set
854  */
855  mfib_itf = mfib_entry_itf_find(msrc->mfes_itfs,
856  rpath[0].frp_sw_if_index);
857 
858  if (NULL == mfib_itf)
859  {
860  /*
861  * removing a path that does not exist
862  */
863  return (mfib_entry_ok_for_delete(mfib_entry));
864  }
865 
866  /*
867  * we have this path. If it is forwarding then we
868  * remove it to the replication set
869  */
870  if (mfib_itf->mfi_flags & MFIB_ITF_FLAG_FORWARD)
871  {
873  }
874 
875  /*
876  * remove the interface/path from this entry's list
877  */
878  mfib_entry_itf_remove(msrc, rpath[0].frp_sw_if_index);
879 
881  {
882  /*
883  * this source has no interfaces and no flags.
884  * it has nothing left to give - remove it
885  */
886  mfib_entry_src_remove(mfib_entry, source);
887  }
888 
890 
891  return (mfib_entry_ok_for_delete(mfib_entry));
892 }
893 
894 /**
895  * mfib_entry_delete
896  *
897  * The source is withdrawing all the paths it provided
898  */
899 int
901  mfib_source_t source)
902 {
903  mfib_entry_t *mfib_entry;
904 
905  mfib_entry = mfib_entry_get(mfib_entry_index);
906  mfib_entry_src_remove(mfib_entry, source);
907 
909 
910  return (mfib_entry_ok_for_delete(mfib_entry));
911 }
912 
913 static int
915  ip4_address_t * a2)
916 {
917  /*
918  * IP addresses are unsiged ints. the return value here needs to be signed
919  * a simple subtraction won't cut it.
920  * If the addresses are the same, the sort order is undefiend, so phoey.
921  */
922  return ((clib_net_to_host_u32(a1->data_u32) >
923  clib_net_to_host_u32(a2->data_u32) ) ?
924  1 : -1);
925 }
926 
927 static int
929  ip6_address_t * a2)
930 {
931  int i;
932  for (i = 0; i < ARRAY_LEN (a1->as_u16); i++)
933  {
934  int cmp = (clib_net_to_host_u16 (a1->as_u16[i]) -
935  clib_net_to_host_u16 (a2->as_u16[i]));
936  if (cmp != 0)
937  return cmp;
938  }
939  return 0;
940 }
941 
942 static int
943 mfib_entry_cmp (fib_node_index_t mfib_entry_index1,
944  fib_node_index_t mfib_entry_index2)
945 {
946  mfib_entry_t *mfib_entry1, *mfib_entry2;
947  int cmp = 0;
948 
949  mfib_entry1 = mfib_entry_get(mfib_entry_index1);
950  mfib_entry2 = mfib_entry_get(mfib_entry_index2);
951 
952  switch (mfib_entry1->mfe_prefix.fp_proto)
953  {
954  case FIB_PROTOCOL_IP4:
955  cmp = fib_ip4_address_compare(&mfib_entry1->mfe_prefix.fp_grp_addr.ip4,
956  &mfib_entry2->mfe_prefix.fp_grp_addr.ip4);
957 
958  if (0 == cmp)
959  {
960  cmp = fib_ip4_address_compare(&mfib_entry1->mfe_prefix.fp_src_addr.ip4,
961  &mfib_entry2->mfe_prefix.fp_src_addr.ip4);
962  }
963  break;
964  case FIB_PROTOCOL_IP6:
965  cmp = fib_ip6_address_compare(&mfib_entry1->mfe_prefix.fp_grp_addr.ip6,
966  &mfib_entry2->mfe_prefix.fp_grp_addr.ip6);
967 
968  if (0 == cmp)
969  {
970  cmp = fib_ip6_address_compare(&mfib_entry1->mfe_prefix.fp_src_addr.ip6,
971  &mfib_entry2->mfe_prefix.fp_src_addr.ip6);
972  }
973  break;
974  case FIB_PROTOCOL_MPLS:
975  ASSERT(0);
976  cmp = 0;
977  break;
978  }
979 
980  if (0 == cmp) {
981  cmp = (mfib_entry1->mfe_prefix.fp_len - mfib_entry2->mfe_prefix.fp_len);
982  }
983  return (cmp);
984 }
985 
986 int
987 mfib_entry_cmp_for_sort (void *i1, void *i2)
988 {
989  fib_node_index_t *mfib_entry_index1 = i1, *mfib_entry_index2 = i2;
990 
991  return (mfib_entry_cmp(*mfib_entry_index1,
992  *mfib_entry_index2));
993 }
994 
995 void
997 {
998  mfib_entry_t *mfib_entry;
999 
1000  mfib_entry = mfib_entry_get(mfib_entry_index);
1001 
1002  fib_node_lock(&mfib_entry->mfe_node);
1003 }
1004 
1005 void
1007 {
1008  mfib_entry_t *mfib_entry;
1009 
1010  mfib_entry = mfib_entry_get(mfib_entry_index);
1011 
1012  fib_node_unlock(&mfib_entry->mfe_node);
1013 }
1014 
1015 static void
1017 {
1018 }
1019 static void
1021 {
1022 }
1023 
1024 const static dpo_vft_t mfib_entry_dpo_vft = {
1026  .dv_unlock = mfib_entry_dpo_unlock,
1027  .dv_format = format_mfib_entry_dpo,
1028  .dv_mem_show = mfib_entry_show_memory,
1029 };
1030 
1031 const static char* const mfib_entry_ip4_nodes[] =
1032 {
1033  "ip4-mfib-forward-rpf",
1034  NULL,
1035 };
1036 const static char* const mfib_entry_ip6_nodes[] =
1037 {
1038  "ip6-mfib-forward-rpf",
1039  NULL,
1040 };
1041 
1042 const static char* const * const mfib_entry_nodes[DPO_PROTO_NUM] =
1043 {
1046 };
1047 
1048 void
1050 {
1052  dpo_register(DPO_MFIB_ENTRY, &mfib_entry_dpo_vft, mfib_entry_nodes);
1053 }
1054 
1055 void
1057  fib_route_path_encode_t **api_rpaths)
1058 {
1059  mfib_entry_t *mfib_entry;
1060 
1061  mfib_entry = mfib_entry_get(mfib_entry_index);
1062  if (FIB_NODE_INDEX_INVALID != mfib_entry->mfe_parent)
1063  {
1064  fib_path_list_walk(mfib_entry->mfe_parent,
1066  api_rpaths);
1067  }
1068 }
1069 
1070 
1071 void
1073  mfib_prefix_t *pfx)
1074 {
1075  mfib_entry_t *mfib_entry;
1076 
1077  mfib_entry = mfib_entry_get(mfib_entry_index);
1078  *pfx = mfib_entry->mfe_prefix;
1079 }
1080 
1081 u32
1083 {
1084  mfib_entry_t *mfib_entry;
1085 
1086  mfib_entry = mfib_entry_get(mfib_entry_index);
1087 
1088  return (mfib_entry->mfe_fib_index);
1089 }
1090 
1091 void
1094  dpo_id_t *dpo)
1095 {
1096  /*
1097  * An IP mFIB entry can only provide a forwarding chain that
1098  * is the same IP proto as the prefix.
1099  * No use-cases (i know of) for other combinations.
1100  */
1101  mfib_entry_t *mfib_entry;
1102  dpo_proto_t dp;
1103 
1104  mfib_entry = mfib_entry_get(mfib_entry_index);
1105 
1106  dp = fib_proto_to_dpo(mfib_entry->mfe_prefix.fp_proto);
1107 
1108  if (type == fib_forw_chain_type_from_dpo_proto(dp))
1109  {
1110  dpo_copy(dpo, &mfib_entry->mfe_rep);
1111  }
1112  else
1113  {
1114  dpo_copy(dpo, drop_dpo_get(dp));
1115  }
1116 }
1117 
1118 u32
1120 {
1121  return (pool_elts(mfib_entry_pool));
1122 }
1123 
1124 static clib_error_t *
1126  unformat_input_t * input,
1127  vlib_cli_command_t * cmd)
1128 {
1129  fib_node_index_t fei;
1130 
1131  if (unformat (input, "%d", &fei))
1132  {
1133  /*
1134  * show one in detail
1135  */
1136  if (!pool_is_free_index(mfib_entry_pool, fei))
1137  {
1138  vlib_cli_output (vm, "%d@%U",
1139  fei,
1140  format_mfib_entry, fei,
1142  }
1143  else
1144  {
1145  vlib_cli_output (vm, "entry %d invalid", fei);
1146  }
1147  }
1148  else
1149  {
1150  /*
1151  * show all
1152  */
1153  vlib_cli_output (vm, "FIB Entries:");
1154  pool_foreach_index(fei, mfib_entry_pool,
1155  ({
1156  vlib_cli_output (vm, "%d@%U",
1157  fei,
1158  format_mfib_entry, fei,
1160  }));
1161  }
1162 
1163  return (NULL);
1164 }
1165 
1166 /*?
1167  * This commnad displays an entry, or all entries, in the mfib tables indexed by their unique
1168  * numerical indentifier.
1169  ?*/
1170 VLIB_CLI_COMMAND (show_mfib_entry, static) = {
1171  .path = "show mfib entry",
1172  .function = show_mfib_entry_command,
1173  .short_help = "show mfib entry",
1174 };
int mfib_entry_update(fib_node_index_t mfib_entry_index, mfib_source_t source, mfib_entry_flags_t entry_flags, index_t repi)
Definition: mfib_entry.c:689
int fib_path_is_resolved(fib_node_index_t path_index)
Definition: fib_path.c:1932
static int mfib_entry_src_n_itfs(const mfib_entry_src_t *msrc)
Definition: mfib_entry.c:318
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:335
#define MFIB_ENTRY_FORMAT_DETAIL
Definition: mfib_entry.h:84
static void mfib_entry_recalculate_forwarding(mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:618
static const char *const mfib_entry_ip4_nodes[]
Definition: mfib_entry.c:1031
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:105
ip46_address_t fp_src_addr
Definition: mfib_types.h:47
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:85
#define hash_set(h, key, value)
Definition: hash.h:254
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
static mfib_entry_src_t * mfib_entry_src_find_or_create(mfib_entry_t *mfib_entry, mfib_source_t source)
Definition: mfib_entry.c:250
fib_node_index_t path_index
The index of the FIB path.
Definition: load_balance.h:71
#define CLIB_UNUSED(x)
Definition: clib.h:79
A virtual function table regisitered for a DPO type.
Definition: dpo.h:330
A representation of a fib path for fib_path_encode to convey the information to the caller...
Definition: fib_types.h:358
fib_forward_chain_type_t fct
Definition: mfib_entry.c:437
void fib_path_contribute_forwarding(fib_node_index_t path_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
Definition: fib_path.c:1742
static const char *const *const mfib_entry_nodes[DPO_PROTO_NUM]
Definition: mfib_entry.c:1042
u32 mfib_entry_pool_size(void)
Definition: mfib_entry.c:1119
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
int mfib_entry_delete(fib_node_index_t mfib_entry_index, mfib_source_t source)
mfib_entry_delete
Definition: mfib_entry.c:900
enum mfib_entry_flags_t_ mfib_entry_flags_t
#define hash_unset(h, key)
Definition: hash.h:260
A representation of a path as described by a route producer.
Definition: fib_types.h:308
dpo_id_t path_dpo
ID of the Data-path object.
Definition: load_balance.h:66
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:183
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
Definition: dpo.h:185
void mfib_entry_unlock(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1006
struct mfib_entry_src_t_ * mfe_srcs
A vector of sources contributing forwarding.
Definition: mfib_entry.h:60
#define NULL
Definition: clib.h:55
An entry in a FIB table.
Definition: mfib_entry.h:31
u32 mfe_sibling
index of this entry in the parent&#39;s child list.
Definition: mfib_entry.h:55
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
static int mfib_entry_forwarding_path_remove(mfib_entry_src_t *msrc, const fib_route_path_t *rpath)
Definition: mfib_entry.c:588
#define MFIB_SOURCE_NAMES
Definition: mfib_types.h:172
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:224
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:41
static void mfib_entry_dpo_unlock(dpo_id_t *dpo)
Definition: mfib_entry.c:1020
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
static fib_node_t * mfib_entry_get_node(fib_node_index_t index)
Definition: mfib_entry.c:88
static void mfib_entry_itf_remove(mfib_entry_src_t *msrc, u32 sw_if_index)
Definition: mfib_entry.c:753
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:561
static fib_node_index_t mfib_entry_get_index(const mfib_entry_t *mfe)
Definition: mfib_entry.h:147
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
fib_node_index_t mfib_entry_create(u32 fib_index, mfib_source_t source, const mfib_prefix_t *prefix, mfib_entry_flags_t entry_flags)
Definition: mfib_entry.c:656
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:81
void fib_node_deinit(fib_node_t *node)
Definition: fib_node.c:198
u32 mfib_entry_child_add(fib_node_index_t mfib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: mfib_entry.c:382
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
static const char *const mfib_entry_ip6_nodes[]
Definition: mfib_entry.c:1036
#define MFIB_ENTRY_FORMAT_BRIEF
Definition: mfib_entry.h:83
mfib_itf_t * mfes_itfs
The hash table of all interfaces.
Definition: mfib_entry.c:74
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:200
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:121
fib_forward_chain_type_t mfib_entry_get_default_chain_type(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:100
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static mfib_entry_t * mfib_entry_from_fib_node(fib_node_t *node)
Definition: mfib_entry.c:187
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:96
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:58
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
u8 * format_mfib_entry_flags(u8 *s, va_list *args)
Definition: mfib_types.c:85
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
static mfib_entry_t * mfib_entry_alloc(u32 fib_index, const mfib_prefix_t *prefix, fib_node_index_t *mfib_entry_index)
Definition: mfib_entry.c:402
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
Definition: dpo.c:249
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:334
The source of an MFIB entry.
Definition: mfib_entry.c:54
mfib_source_t mfes_src
Which source this is.
Definition: mfib_entry.c:59
#define hash_foreach(key_var, value_var, h, body)
Definition: hash.h:418
load_balance_path_t * next_hops
Definition: mfib_entry.c:436
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static fib_protocol_t mfib_entry_get_proto(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:94
mfib_prefix_t mfe_prefix
The prefix of the route.
Definition: mfib_entry.h:40
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:221
void mfib_entry_module_init(void)
Definition: mfib_entry.c:1049
struct mfib_entry_collect_forwarding_ctx_t_ mfib_entry_collect_forwarding_ctx_t
Contribute an object that is to be used to forward Ethernet packets.
Definition: fib_types.h:109
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
index_t mfib_itf_create(u32 sw_if_index, mfib_itf_flags_t mfi_flags)
Definition: mfib_itf.c:24
u32 mfib_entry_get_fib_index(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:1082
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:146
Contribute an object that is to be used to forward end-of-stack MPLS packets.
Definition: fib_types.h:97
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
dpo_id_t mfe_rep
The Replicate DPO used for forwarding.
Definition: mfib_entry.h:70
static void mfib_entry_src_flush(mfib_entry_src_t *msrc)
Definition: mfib_entry.c:286
void fib_node_lock(fib_node_t *node)
Definition: fib_node.c:204
static int fib_ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
Definition: mfib_entry.c:928
struct _unformat_input_t unformat_input_t
#define hash_free(h)
Definition: hash.h:286
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:241
fib_node_t mfe_node
Base class.
Definition: mfib_entry.h:36
int mfib_entry_cmp_for_sort(void *i1, void *i2)
Definition: mfib_entry.c:987
void mfib_entry_path_update(fib_node_index_t mfib_entry_index, mfib_source_t source, const fib_route_path_t *rpath, mfib_itf_flags_t itf_flags)
Definition: mfib_entry.c:766
mfib_entry_t * mfib_entry_pool
Definition: mfib_entry.c:85
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:805
void fib_path_list_lock(fib_node_index_t path_list_index)
fib_node_type_t fn_type
The node&#39;s type.
Definition: fib_node.h:282
static void mfib_entry_dpo_lock(dpo_id_t *dpo)
Definition: mfib_entry.c:1016
An node in the FIB graph.
Definition: fib_node.h:277
void fib_node_unlock(fib_node_t *node)
Definition: fib_node.c:210
void mfib_entry_lock(fib_node_index_t mfib_entry_index)
Definition: mfib_entry.c:996
u32 mfe_fib_index
The index of the FIB table this entry is in.
Definition: mfib_entry.h:44
static mfib_entry_t * mfib_entry_get(fib_node_index_t index)
Definition: mfib_entry.h:142
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
static void mfib_entry_forwarding_path_add(mfib_entry_src_t *msrc, const fib_route_path_t *rpath)
Definition: mfib_entry.c:552
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
Definition: fib_node.h:294
static u8 * format_mfib_entry_dpo(u8 *s, va_list *args)
Definition: mfib_entry.c:116
vlib_main_t * vm
Definition: buffer.c:276
static mfib_entry_src_t * mfib_entry_src_find(const mfib_entry_t *mfib_entry, mfib_source_t source, u32 *index)
Definition: mfib_entry.c:221
static void mfib_entry_stack(mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:486
Contribute an object that is to be used to forward NSH packets.
Definition: fib_types.h:115
u8 * format_mfib_entry(u8 *s, va_list *args)
Definition: mfib_entry.c:127
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:340
static mfib_itf_t * mfib_entry_itf_find(mfib_itf_t *itfs, u32 sw_if_index)
Definition: mfib_entry.h:154
mfib_itf_flags_t mfi_flags
Falags on the entry.
Definition: mfib_itf.h:30
fib_node_get_t fnv_get
Definition: fib_node.h:265
static int mfib_entry_src_collect_forwarding(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
Definition: mfib_entry.c:441
int fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
Definition: fib_path.c:1955
fib_node_index_t mfes_pl
The path-list of forwarding interfaces.
Definition: mfib_entry.c:64
mfib_itf_t * mfe_itfs
A hash table of interfaces.
Definition: mfib_entry.h:80
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
mfib_entry_flags_t mfe_flags
Route flags.
Definition: mfib_entry.h:75
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:238
#define ARRAY_LEN(x)
Definition: clib.h:59
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:157
void fib_path_list_unlock(fib_node_index_t path_list_index)
index_t replicate_create(u32 n_buckets, dpo_proto_t rep_proto)
static void mfib_entry_itf_add(mfib_entry_src_t *msrc, u32 sw_if_index, index_t mi)
Definition: mfib_entry.c:745
void mfib_entry_contribute_forwarding(fib_node_index_t mfib_entry_index, fib_forward_chain_type_t type, dpo_id_t *dpo)
Definition: mfib_entry.c:1092
Aggregrate type for a prefix.
Definition: mfib_types.h:24
Context passed between object during a back walk.
Definition: fib_node.h:190
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:154
static void mfib_entry_last_lock_gone(fib_node_t *node)
Definition: mfib_entry.c:325
void mfib_entry_get_prefix(fib_node_index_t mfib_entry_index, mfib_prefix_t *pfx)
Definition: mfib_entry.c:1072
static uword hash_elts(void *v)
Definition: hash.h:117
#define ASSERT(truth)
unsigned int u32
Definition: types.h:88
fib_node_index_t mfe_parent
the path-list for which this entry is a child.
Definition: mfib_entry.h:49
struct mfib_entry_src_t_ mfib_entry_src_t
The source of an MFIB entry.
An interface associated with a particular MFIB entry.
Definition: mfib_itf.h:25
static int mfib_entry_ok_for_delete(mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:676
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
u8 * format_fib_forw_chain_type(u8 *s, va_list *args)
Definition: fib_types.c:46
static int mfib_entry_cmp(fib_node_index_t mfib_entry_index1, fib_node_index_t mfib_entry_index2)
Definition: mfib_entry.c:943
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:121
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:220
int fib_path_get_weight(fib_node_index_t path_index)
Definition: fib_path.c:1666
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
Definition: dpo.c:121
static clib_error_t * show_mfib_entry_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: mfib_entry.c:1125
void mfib_entry_encode(fib_node_index_t mfib_entry_index, fib_route_path_encode_t **api_rpaths)
Definition: mfib_entry.c:1056
#define MFIB_ENTRY_DBG(_e, _fmt, _args...)
Debug macro.
Definition: mfib_entry.c:48
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
#define DPO_PROTO_NUM
Definition: dpo.h:73
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:29
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
u32 path_weight
weight for the path.
Definition: load_balance.h:76
u32 fn_locks
Number of dependents on this node.
Definition: fib_node.h:300
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:960
static int fib_ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
Definition: mfib_entry.c:914
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:173
One path from an [EU]CMP set that the client wants to add to a load-balance object.
Definition: load_balance.h:62
static mfib_entry_src_t * mfib_entry_get_best_src(const mfib_entry_t *mfib_entry)
Definition: mfib_entry.c:266
enum mfib_itf_flags_t_ mfib_itf_flags_t
Definition: mfib_entry.c:434
static int mfib_entry_src_ok_for_delete(const mfib_entry_src_t *msrc)
Definition: mfib_entry.c:682
A FIB graph nodes virtual function table.
Definition: fib_node.h:264
static const char * mfib_source_names[]
String names for each source.
Definition: mfib_entry.c:80
static void mfib_entry_src_init(mfib_entry_t *mfib_entry, mfib_source_t source)
Definition: mfib_entry.c:205
mfib_entry_flags_t mfes_flags
Route flags.
Definition: mfib_entry.c:69
static fib_node_back_walk_rc_t mfib_entry_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Definition: mfib_entry.c:354
int dpo_is_drop(const dpo_id_t *dpo)
The Drop DPO will drop all packets, no questions asked.
Definition: drop_dpo.c:33
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:194
#define vec_foreach(var, vec)
Vector iterator.
void mfib_itf_delete(mfib_itf_t *mfi)
Definition: mfib_itf.c:40
static void mfib_entry_show_memory(void)
Definition: mfib_entry.c:363
u16 as_u16[8]
Definition: ip6_packet.h:49
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
Definition: fib_types.h:90
static void mfib_entry_src_remove(mfib_entry_t *mfib_entry, mfib_source_t source)
Definition: mfib_entry.c:301
#define pool_foreach_index(i, v, body)
Iterate pool by index.
Definition: pool.h:418
#define MFIB_ENTRY_FORMAT_DETAIL2
Definition: mfib_entry.h:85
u16 fp_len
The mask length.
Definition: mfib_types.h:28
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
Definition: fib_node.c:174
void mfib_entry_child_remove(fib_node_index_t mfib_entry_index, u32 sibling_index)
Definition: mfib_entry.c:393
static int mfib_entry_src_cmp_for_sort(void *v1, void *v2)
Definition: mfib_entry.c:196
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:101
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:577
fib_forward_chain_type_t fib_forw_chain_type_from_dpo_proto(dpo_proto_t proto)
Convert from a payload-protocol to a chain type.
Definition: fib_types.c:270
fib_node_index_t fib_path_list_create_special(fib_protocol_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
u8 * format_mfib_prefix(u8 *s, va_list *args)
Definition: mfib_types.c:30
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:971
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
Definition: mfib_types.h:46
int mfib_entry_path_remove(fib_node_index_t mfib_entry_index, mfib_source_t source, const fib_route_path_t *rpath)
Definition: mfib_entry.c:832
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
Definition: dpo.c:405
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:109