FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
fib_entry_src.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 <vnet/adj/adj.h>
17 #include <vnet/dpo/load_balance.h>
19 #include <vnet/dpo/drop_dpo.h>
20 #include <vnet/dpo/replicate_dpo.h>
21 
22 #include <vnet/fib/fib_entry_src.h>
23 #include <vnet/fib/fib_table.h>
24 #include <vnet/fib/fib_path_ext.h>
25 #include <vnet/fib/fib_urpf_list.h>
26 
27 /*
28  * per-source type vft
29  */
30 static fib_entry_src_vft_t fib_entry_src_vft[FIB_SOURCE_MAX];
31 
32 void
34  const fib_entry_src_vft_t *vft)
35 {
36  fib_entry_src_vft[source] = *vft;
37 }
38 
39 static int
41  void * v2)
42 {
43  fib_entry_src_t *esrc1 = v1, *esrc2 = v2;
44 
45  return (esrc1->fes_src - esrc2->fes_src);
46 }
47 
48 void
50  fib_source_t source)
51 
52 {
53  fib_entry_src_t esrc = {
55  .fes_flags = FIB_ENTRY_SRC_FLAG_NONE,
56  .fes_src = source,
57  };
58 
59  if (NULL != fib_entry_src_vft[source].fesv_init)
60  {
61  fib_entry_src_vft[source].fesv_init(&esrc);
62  }
63 
64  vec_add1(fib_entry->fe_srcs, esrc);
67 }
68 
69 static fib_entry_src_t *
70 fib_entry_src_find (const fib_entry_t *fib_entry,
71  fib_source_t source,
72  u32 *index)
73 
74 {
75  fib_entry_src_t *esrc;
76  int ii;
77 
78  ii = 0;
79  vec_foreach(esrc, fib_entry->fe_srcs)
80  {
81  if (esrc->fes_src == source)
82  {
83  if (NULL != index)
84  {
85  *index = ii;
86  }
87  return (esrc);
88  }
89  else
90  {
91  ii++;
92  }
93  }
94 
95  return (NULL);
96 }
97 
98 int
100  fib_source_t source)
101 {
102  fib_entry_t *fib_entry;
103 
104  fib_entry = fib_entry_get(fib_entry_index);
105 
106  return (NULL != fib_entry_src_find(fib_entry, source, NULL));
107 }
108 
109 static fib_entry_src_t *
111  fib_source_t source,
112  u32 *index)
113 {
114  fib_entry_src_t *esrc;
115 
116  esrc = fib_entry_src_find(fib_entry, source, NULL);
117 
118  if (NULL == esrc)
119  {
120  fib_entry_src_action_init(fib_entry, source);
121  }
122 
123  return (fib_entry_src_find(fib_entry, source, NULL));
124 }
125 
126 void
128  fib_source_t source)
129 
130 {
131  fib_entry_src_t *esrc;
132  u32 index = ~0;
133 
134  esrc = fib_entry_src_find(fib_entry, source, &index);
135 
136  ASSERT(NULL != esrc);
137 
138  if (NULL != fib_entry_src_vft[source].fesv_deinit)
139  {
140  fib_entry_src_vft[source].fesv_deinit(esrc);
141  }
142 
144  vec_del1(fib_entry->fe_srcs, index);
145 }
146 
149  fib_source_t source)
150 {
151  if (NULL != fib_entry_src_vft[source].fesv_cover_change)
152  {
153  return (fib_entry_src_vft[source].fesv_cover_change(
154  fib_entry_src_find(fib_entry, source, NULL),
155  fib_entry));
156  }
157 
159  .install = !0,
160  .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
161  };
162  return (res);
163 }
164 
167  fib_source_t source)
168 {
169  if (NULL != fib_entry_src_vft[source].fesv_cover_update)
170  {
171  return (fib_entry_src_vft[source].fesv_cover_update(
172  fib_entry_src_find(fib_entry, source, NULL),
173  fib_entry));
174  }
175 
177  .install = !0,
178  .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
179  };
180  return (res);
181 }
182 
184 {
192 
193 /**
194  * @brief Determine whether this FIB entry should use a load-balance MAP
195  * to support PIC edge fast convergence
196  */
199 {
200  /**
201  * We'll use a LB map if the path-list has multiple recursive paths.
202  * recursive paths implies BGP, and hence scale.
203  */
204  if (ctx->n_recursive_constrained > 1 &&
206  {
208  }
209  return (LOAD_BALANCE_FLAG_NONE);
210 }
211 
212 static int
214 {
215  return ((MPLS_LABEL_IS_REAL(label) ||
219 }
220 
221 /**
222  * @brief Turn the chain type requested by the client into the one they
223  * really wanted
224  */
228 {
229  /*
230  * The EOS chain is a tricky since one cannot know the adjacency
231  * to link to without knowing what the packets payload protocol
232  * will be once the label is popped.
233  */
235 
236  if (FIB_FORW_CHAIN_TYPE_MPLS_EOS != fct)
237  {
238  return (fct);
239  }
240 
241  dfct = fib_entry_get_default_chain_type(entry);
242 
243  if (FIB_FORW_CHAIN_TYPE_MPLS_EOS == dfct)
244  {
245  /*
246  * If the entry being asked is a eos-MPLS label entry,
247  * then use the payload-protocol field, that we stashed there
248  * for just this purpose
249  */
251  entry->fe_prefix.fp_payload_proto));
252  }
253  /*
254  * else give them what this entry would be by default. i.e. if it's a v6
255  * entry, then the label its local labelled should be carrying v6 traffic.
256  * If it's a non-EOS label entry, then there are more labels and we want
257  * a non-eos chain.
258  */
259  return (dfct);
260 }
261 
262 static dpo_proto_t
264 {
265  switch (pfx->fp_proto)
266  {
267  case FIB_PROTOCOL_IP4:
268  return (DPO_PROTO_IP4);
269  case FIB_PROTOCOL_IP6:
270  return (DPO_PROTO_IP6);
271  case FIB_PROTOCOL_MPLS:
272  return (pfx->fp_payload_proto);
273  }
274 
275  ASSERT(0);
276  return (DPO_PROTO_IP4);
277 }
278 
279 static void
282 {
284 
285  /*
286  * no extension => no out-going label for this path. that's OK
287  * in the case of an IP or EOS chain, but not for non-EOS
288  */
289  switch (ctx->fct)
290  {
296  /*
297  * EOS traffic with no label to stack, we need the IP Adj
298  */
299  vec_add2(ctx->next_hops, nh, 1);
300 
301  nh->path_index = path_index;
302  nh->path_weight = fib_path_get_weight(path_index);
303  fib_path_contribute_forwarding(path_index, ctx->fct, &nh->path_dpo);
304 
305  break;
307  if (fib_path_is_exclusive(path_index) ||
308  fib_path_is_deag(path_index))
309  {
310  vec_add2(ctx->next_hops, nh, 1);
311 
312  nh->path_index = path_index;
313  nh->path_weight = fib_path_get_weight(path_index);
316  &nh->path_dpo);
317  }
318  break;
320  {
321  /*
322  * no label. we need a chain based on the payload. fixup.
323  */
324  vec_add2(ctx->next_hops, nh, 1);
325 
326  nh->path_index = path_index;
327  nh->path_weight = fib_path_get_weight(path_index);
330  ctx->fct),
331  &nh->path_dpo);
332  fib_path_stack_mpls_disp(path_index,
334  &nh->path_dpo);
335 
336  break;
337  }
340  ASSERT(0);
341  break;
342  }
343 }
344 
347  fib_node_index_t path_index,
348  void *arg)
349 {
351  fib_path_ext_t *path_ext;
352 
353  ctx = arg;
354 
355  /*
356  * if the path is not resolved, don't include it.
357  */
358  if (!fib_path_is_resolved(path_index))
359  {
361  }
362 
363  if (fib_path_is_recursive_constrained(path_index))
364  {
365  ctx->n_recursive_constrained += 1;
366  }
367  if (0xffff == ctx->preference)
368  {
369  /*
370  * not set a preference yet, so the first path we encounter
371  * sets the preference we are collecting.
372  */
373  ctx->preference = fib_path_get_preference(path_index);
374  }
375  else if (ctx->preference != fib_path_get_preference(path_index))
376  {
377  /*
378  * this path does not belong to the same preference as the
379  * previous paths encountered. we are done now.
380  */
381  return (FIB_PATH_LIST_WALK_STOP);
382  }
383 
384  /*
385  * get the matching path-extension for the path being visited.
386  */
388  path_index);
389 
390  if (NULL != path_ext)
391  {
392  switch (path_ext->fpe_type)
393  {
394  case FIB_PATH_EXT_MPLS:
395  if (fib_entry_src_valid_out_label(path_ext->fpe_label_stack[0]))
396  {
397  /*
398  * found a matching extension. stack it to obtain the forwarding
399  * info for this path.
400  */
401  ctx->next_hops =
402  fib_path_ext_stack(path_ext,
403  ctx->fct,
405  ctx->fct),
406  ctx->next_hops);
407  }
408  else
409  {
410  fib_entry_src_get_path_forwarding(path_index, ctx);
411  }
412  break;
413  case FIB_PATH_EXT_ADJ:
415  {
416  fib_entry_src_get_path_forwarding(path_index, ctx);
417  }
418  /*
419  * else
420  * the path does not refine the cover, meaning that
421  * the adjacency doesdoes not match the sub-net on the link.
422  * So this path does not contribute forwarding.
423  */
424  break;
425  }
426  }
427  else
428  {
429  fib_entry_src_get_path_forwarding(path_index, ctx);
430  }
431 
433 }
434 
435 void
437  const fib_entry_src_t *esrc,
439  dpo_id_t *dpo_lb)
440 {
441  dpo_proto_t lb_proto;
442 
443  /*
444  * If the entry has path extensions then we construct a load-balance
445  * by stacking the extensions on the forwarding chains of the paths.
446  * Otherwise we use the load-balance of the path-list
447  */
449  .esrc = esrc,
450  .fib_entry = fib_entry,
451  .next_hops = NULL,
452  .n_recursive_constrained = 0,
453  .fct = fct,
454  .preference = 0xffff,
455  };
456 
457  /*
458  * As an optimisation we allocate the vector of next-hops to be sized
459  * equal to the maximum nuber of paths we will need, which is also the
460  * most likely number we will need, since in most cases the paths are 'up'.
461  */
464 
465  lb_proto = fib_forw_chain_type_to_dpo_proto(fct);
466 
469  &ctx);
470 
472  {
473  /*
474  * the client provided the DPO that the entry should link to.
475  * all entries must link to a LB, so if it is an LB already
476  * then we can use it.
477  */
478  if ((1 == vec_len(ctx.next_hops)) &&
480  {
481  dpo_copy(dpo_lb, &ctx.next_hops[0].path_dpo);
482  dpo_reset(&ctx.next_hops[0].path_dpo);
483  return;
484  }
485  }
486 
487  if (!dpo_id_is_valid(dpo_lb))
488  {
489  /*
490  * first time create
491  */
493  {
494  dpo_set(dpo_lb,
496  lb_proto,
497  MPLS_IS_REPLICATE | replicate_create(0, lb_proto));
498  }
499  else
500  {
501  fib_protocol_t flow_hash_proto;
502  flow_hash_config_t fhc;
503 
504  /*
505  * if the protocol for the LB we are building does not match that
506  * of the fib_entry (i.e. we are build the [n]EOS LB for an IPv[46]
507  * then the fib_index is not an index that relates to the table
508  * type we need. So get the default flow-hash config instead.
509  */
510  flow_hash_proto = dpo_proto_to_fib(lb_proto);
511  if (fib_entry->fe_prefix.fp_proto != flow_hash_proto)
512  {
513  fhc = fib_table_get_default_flow_hash_config(flow_hash_proto);
514  }
515  else
516  {
518  flow_hash_proto);
519  }
520 
521  dpo_set(dpo_lb,
523  lb_proto,
524  load_balance_create(0, lb_proto, fhc));
525  }
526  }
527 
529  {
530  /*
531  * MPLS multicast
532  */
534  }
535  else
536  {
538  ctx.next_hops,
540  vec_free(ctx.next_hops);
541 
542  /*
543  * if this entry is sourced by the uRPF-exempt source then we
544  * append the always present local0 interface (index 0) to the
545  * uRPF list so it is not empty. that way packets pass the loose check.
546  */
548 
552  (0 == fib_urpf_check_size(ui)))
553  {
554  /*
555  * The uRPF list we get from the path-list is shared by all
556  * other users of the list, but the uRPF exemption applies
557  * only to this prefix. So we need our own list.
558  */
560  fib_urpf_list_append(ui, 0);
561  fib_urpf_list_bake(ui);
562  load_balance_set_urpf(dpo_lb->dpoi_index, ui);
564  }
565  else
566  {
567  load_balance_set_urpf(dpo_lb->dpoi_index, ui);
568  }
570  fib_entry_get_flags_i(fib_entry));
571  }
572 }
573 
574 void
576  fib_source_t source)
577 {
578  /*
579  * Install the forwarding chain for the given source into the forwarding
580  * tables
581  */
584  int insert;
585 
586  fct = fib_entry_get_default_chain_type(fib_entry);
587  esrc = fib_entry_src_find(fib_entry, source, NULL);
588 
589  /*
590  * Every entry has its own load-balance object. All changes to the entry's
591  * forwarding result in an inplace modify of the load-balance. This means
592  * the load-balance object only needs to be added to the forwarding
593  * DB once, when it is created.
594  */
595  insert = !dpo_id_is_valid(&fib_entry->fe_lb);
596 
597  fib_entry_src_mk_lb(fib_entry, esrc, fct, &fib_entry->fe_lb);
598 
599  ASSERT(dpo_id_is_valid(&fib_entry->fe_lb));
600  FIB_ENTRY_DBG(fib_entry, "install: %d", fib_entry->fe_lb);
601 
602  /*
603  * insert the adj into the data-plane forwarding trie
604  */
605  if (insert)
606  {
608  &fib_entry->fe_prefix,
609  &fib_entry->fe_lb);
610  }
611 
612  /*
613  * if any of the other chain types are already created they will need
614  * updating too
615  */
618 
619  FOR_EACH_DELEGATE_CHAIN(fib_entry, fdt, fed,
620  {
621  fib_entry_src_mk_lb(fib_entry, esrc,
623  &fed->fd_dpo);
624  });
625 }
626 
627 void
629 {
630  /*
631  * uninstall the forwarding chain from the forwarding tables
632  */
633  FIB_ENTRY_DBG(fib_entry, "uninstall: %d",
634  fib_entry->fe_adj_index);
635 
636  if (dpo_id_is_valid(&fib_entry->fe_lb))
637  {
639  fib_entry->fe_fib_index,
640  &fib_entry->fe_prefix,
641  &fib_entry->fe_lb);
642 
643  dpo_reset(&fib_entry->fe_lb);
644  }
645 }
646 
647 static void
649 {
650  fib_node_index_t *entries = NULL;
651 
652  fib_path_list_recursive_loop_detect(path_list_index, &entries);
653 
654  vec_free(entries);
655 }
656 
657 void
659  fib_source_t source)
660 
661 {
662  int houston_we_are_go_for_install;
664 
665  esrc = fib_entry_src_find(fib_entry, source, NULL);
666 
669 
671 
672  if (NULL != fib_entry_src_vft[source].fesv_activate)
673  {
674  houston_we_are_go_for_install =
675  fib_entry_src_vft[source].fesv_activate(esrc, fib_entry);
676  }
677  else
678  {
679  /*
680  * the source is not providing an activate function, we'll assume
681  * therefore it has no objection to installing the entry
682  */
683  houston_we_are_go_for_install = !0;
684  }
685 
686  /*
687  * link to the path-list provided by the source, and go check
688  * if that forms any loops in the graph.
689  */
690  fib_entry->fe_parent = esrc->fes_pl;
691  fib_entry->fe_sibling =
694  fib_entry_get_index(fib_entry));
695 
697 
698  FIB_ENTRY_DBG(fib_entry, "activate: %d",
699  fib_entry->fe_parent);
700 
701  if (0 != houston_we_are_go_for_install)
702  {
703  fib_entry_src_action_install(fib_entry, source);
704  }
705  else
706  {
708  }
709 }
710 
711 void
713  fib_source_t source)
714 
715 {
716  fib_node_index_t path_list_index;
718 
719  esrc = fib_entry_src_find(fib_entry, source, NULL);
720 
722 
723  if (NULL != fib_entry_src_vft[source].fesv_deactivate)
724  {
725  fib_entry_src_vft[source].fesv_deactivate(esrc, fib_entry);
726  }
727 
729 
730  FIB_ENTRY_DBG(fib_entry, "deactivate: %d", fib_entry->fe_parent);
731 
732  /*
733  * un-link from an old path-list. Check for any loops this will clear
734  */
735  path_list_index = fib_entry->fe_parent;
736  fib_entry->fe_parent = FIB_NODE_INDEX_INVALID;
737 
738  fib_entry_recursive_loop_detect_i(path_list_index);
739 
740  /*
741  * this will unlock the path-list, so it may be invalid thereafter.
742  */
743  fib_path_list_child_remove(path_list_index, fib_entry->fe_sibling);
744  fib_entry->fe_sibling = FIB_NODE_INDEX_INVALID;
745 }
746 
747 static void
749  fib_source_t source)
750 {
752 
753  vec_foreach(esrc, fib_entry->fe_srcs)
754  {
755  if (NULL != fib_entry_src_vft[esrc->fes_src].fesv_fwd_update)
756  {
757  fib_entry_src_vft[esrc->fes_src].fesv_fwd_update(esrc,
758  fib_entry,
759  source);
760  }
761  }
762 }
763 
764 void
766  fib_source_t source)
767 {
768  fib_node_index_t path_list_index;
770 
771  esrc = fib_entry_src_find(fib_entry, source, NULL);
772 
774 
775  FIB_ENTRY_DBG(fib_entry, "reactivate: %d to %d",
776  fib_entry->fe_parent,
777  esrc->fes_pl);
778 
779  if (fib_entry->fe_parent != esrc->fes_pl)
780  {
781  /*
782  * un-link from an old path-list. Check for any loops this will clear
783  */
784  path_list_index = fib_entry->fe_parent;
785  fib_entry->fe_parent = FIB_NODE_INDEX_INVALID;
786 
787  /*
788  * temporary lock so it doesn't get deleted when this entry is no
789  * longer a child.
790  */
791  fib_path_list_lock(path_list_index);
792 
793  /*
794  * this entry is no longer a child. after unlinking check if any loops
795  * were broken
796  */
797  fib_path_list_child_remove(path_list_index,
798  fib_entry->fe_sibling);
799 
800  fib_entry_recursive_loop_detect_i(path_list_index);
801 
802  /*
803  * link to the path-list provided by the source, and go check
804  * if that forms any loops in the graph.
805  */
806  fib_entry->fe_parent = esrc->fes_pl;
807  fib_entry->fe_sibling =
810  fib_entry_get_index(fib_entry));
811 
813  fib_path_list_unlock(path_list_index);
814  }
815  fib_entry_src_action_install(fib_entry, source);
816  fib_entry_src_action_fwd_update(fib_entry, source);
817 }
818 
819 void
821  fib_source_t source)
822 {
824 
825  esrc = fib_entry_src_find(fib_entry, source, NULL);
826 
827  if (NULL != fib_entry_src_vft[source].fesv_installed)
828  {
829  fib_entry_src_vft[source].fesv_installed(esrc,
830  fib_entry);
831  }
832 
833  fib_entry_src_action_fwd_update(fib_entry, source);
834 }
835 
836 /*
837  * fib_entry_src_action_add
838  *
839  * Adding a source can result in a new fib_entry being created, which
840  * can inturn mean the pool is realloc'd and thus the entry passed as
841  * an argument it also realloc'd
842  * @return the original entry
843  */
844 fib_entry_t *
846  fib_source_t source,
848  const dpo_id_t *dpo)
849 {
850  fib_node_index_t fib_entry_index;
852 
853  esrc = fib_entry_src_find_or_create(fib_entry, source, NULL);
854 
855  esrc->fes_ref_count++;
856 
857  if (1 != esrc->fes_ref_count)
858  {
859  /*
860  * we only want to add the source on the 0->1 transition
861  */
862  return (fib_entry);
863  }
864 
865  esrc->fes_entry_flags = flags;
866 
867  /*
868  * save variable so we can recover from a fib_entry realloc.
869  */
870  fib_entry_index = fib_entry_get_index(fib_entry);
871 
872  if (NULL != fib_entry_src_vft[source].fesv_add)
873  {
874  fib_entry_src_vft[source].fesv_add(esrc,
875  fib_entry,
876  flags,
877  fib_entry_get_dpo_proto(fib_entry),
878  dpo);
879  }
880 
881  fib_entry = fib_entry_get(fib_entry_index);
882 
884 
885  fib_path_list_lock(esrc->fes_pl);
886 
887  /*
888  * the source owns a lock on the entry
889  */
891 
892  return (fib_entry);
893 }
894 
895 /*
896  * fib_entry_src_action_update
897  *
898  * Adding a source can result in a new fib_entry being created, which
899  * can inturn mean the pool is realloc'd and thus the entry passed as
900  * an argument it also realloc'd
901  * @return the original entry
902  */
903 fib_entry_t *
905  fib_source_t source,
907  const dpo_id_t *dpo)
908 {
909  fib_node_index_t fib_entry_index, old_path_list_index;
911 
912  esrc = fib_entry_src_find_or_create(fib_entry, source, NULL);
913 
914  if (NULL == esrc)
915  return (fib_entry_src_action_add(fib_entry, source, flags, dpo));
916 
917  old_path_list_index = esrc->fes_pl;
918  esrc->fes_entry_flags = flags;
919 
920  /*
921  * save variable so we can recover from a fib_entry realloc.
922  */
923  fib_entry_index = fib_entry_get_index(fib_entry);
924 
925  if (NULL != fib_entry_src_vft[source].fesv_add)
926  {
927  fib_entry_src_vft[source].fesv_add(esrc,
928  fib_entry,
929  flags,
930  fib_entry_get_dpo_proto(fib_entry),
931  dpo);
932  }
933 
934  fib_entry = fib_entry_get(fib_entry_index);
935 
937 
938  fib_path_list_lock(esrc->fes_pl);
939  fib_path_list_unlock(old_path_list_index);
940 
941  return (fib_entry);
942 }
943 
944 
947  fib_source_t source)
948 
949 {
950  fib_node_index_t old_path_list;
951  fib_entry_src_flag_t sflags;
953 
954  esrc = fib_entry_src_find(fib_entry, source, NULL);
955 
956  if (NULL == esrc)
957  return (FIB_ENTRY_SRC_FLAG_ACTIVE);
958 
959  esrc->fes_ref_count--;
960  sflags = esrc->fes_flags;
961 
962  if (0 != esrc->fes_ref_count)
963  {
964  /*
965  * only remove the source on the 1->0 transisition
966  */
967  return (sflags);
968  }
969 
971  {
972  fib_entry_src_action_deactivate(fib_entry, source);
973  }
974 
975  old_path_list = esrc->fes_pl;
976 
977  if (NULL != fib_entry_src_vft[source].fesv_remove)
978  {
979  fib_entry_src_vft[source].fesv_remove(esrc);
980  }
981 
982  fib_path_list_unlock(old_path_list);
984 
985  sflags &= ~FIB_ENTRY_SRC_FLAG_ADDED;
986  fib_entry_src_action_deinit(fib_entry, source);
987 
988  return (sflags);
989 }
990 
991 /*
992  * fib_route_attached_cross_table
993  *
994  * Return true the the route is attached via an interface that
995  * is not in the same table as the route
996  */
997 static inline int
999  const fib_route_path_t *rpath)
1000 {
1001  /*
1002  * - All zeros next-hop
1003  * - a valid interface
1004  * - entry's fib index not equeal to interface's index
1005  */
1006  if (ip46_address_is_zero(&rpath->frp_addr) &&
1007  (~0 != rpath->frp_sw_if_index) &&
1008  (fib_entry->fe_fib_index !=
1010  rpath->frp_sw_if_index)))
1011  {
1012  return (!0);
1013  }
1014  return (0);
1015 }
1016 
1017 /*
1018  * fib_route_attached_cross_table
1019  *
1020  * Return true the the route is attached via an interface that
1021  * is not in the same table as the route
1022  */
1023 static inline int
1025 {
1026  /*
1027  * - All zeros next-hop
1028  * - a valid interface
1029  */
1030  if (ip46_address_is_zero(&rpath->frp_addr) &&
1031  (~0 != rpath->frp_sw_if_index))
1032  {
1033  return (!0);
1034  }
1035  else if (rpath->frp_flags & FIB_ROUTE_PATH_ATTACHED)
1036  {
1037  return (!0);
1038  }
1039  return (0);
1040 }
1041 
1044 {
1046 
1047  if (eflags & FIB_ENTRY_FLAG_DROP)
1048  {
1049  plf |= FIB_PATH_LIST_FLAG_DROP;
1050  }
1051  if (eflags & FIB_ENTRY_FLAG_EXCLUSIVE)
1052  {
1054  }
1055  if (eflags & FIB_ENTRY_FLAG_LOCAL)
1056  {
1057  plf |= FIB_PATH_LIST_FLAG_LOCAL;
1058  }
1059 
1060  return (plf);
1061 }
1062 
1063 static void
1065  const fib_route_path_t *rpath,
1066  fib_path_list_flags_t *pl_flags,
1068 {
1069  if ((esrc->fes_src == FIB_SOURCE_API) ||
1070  (esrc->fes_src == FIB_SOURCE_CLI))
1071  {
1072  if (fib_path_is_attached(rpath))
1073  {
1075  }
1076  else
1077  {
1079  }
1080  if (rpath->frp_flags & FIB_ROUTE_PATH_DEAG)
1081  {
1083  }
1084  }
1085  if (fib_route_attached_cross_table(fib_entry, rpath))
1086  {
1088  }
1089  else
1090  {
1092  }
1093 }
1094 
1095 /*
1096  * fib_entry_src_action_add
1097  *
1098  * Adding a source can result in a new fib_entry being created, which
1099  * can inturn mean the pool is realloc'd and thus the entry passed as
1100  * an argument it also realloc'd
1101  * @return the entry
1102  */
1103 fib_entry_t*
1105  fib_source_t source,
1107  const fib_route_path_t *rpath)
1108 {
1109  fib_node_index_t old_path_list, fib_entry_index;
1110  fib_path_list_flags_t pl_flags;
1112 
1113  /*
1114  * save variable so we can recover from a fib_entry realloc.
1115  */
1116  fib_entry_index = fib_entry_get_index(fib_entry);
1117 
1118  esrc = fib_entry_src_find(fib_entry, source, NULL);
1119  if (NULL == esrc)
1120  {
1121  fib_entry =
1122  fib_entry_src_action_add(fib_entry,
1123  source,
1124  flags,
1125  drop_dpo_get(
1126  fib_entry_get_dpo_proto(fib_entry)));
1127  esrc = fib_entry_src_find(fib_entry, source, NULL);
1128  }
1129 
1130  /*
1131  * we are no doubt modifying a path-list. If the path-list
1132  * is shared, and hence not modifiable, then the index returned
1133  * will be for a different path-list. This FIB entry to needs
1134  * to maintain its lock appropriately.
1135  */
1136  old_path_list = esrc->fes_pl;
1137 
1138  ASSERT(NULL != fib_entry_src_vft[source].fesv_path_add);
1139 
1141  fib_entry_flags_update(fib_entry, rpath, &pl_flags, esrc);
1142 
1143  fib_entry_src_vft[source].fesv_path_add(esrc, fib_entry, pl_flags, rpath);
1144  fib_entry = fib_entry_get(fib_entry_index);
1145 
1146  fib_path_list_lock(esrc->fes_pl);
1147  fib_path_list_unlock(old_path_list);
1148 
1149  return (fib_entry);
1150 }
1151 
1152 /*
1153  * fib_entry_src_action_swap
1154  *
1155  * The source is providing new paths to replace the old ones.
1156  * Adding a source can result in a new fib_entry being created, which
1157  * can inturn mean the pool is realloc'd and thus the entry passed as
1158  * an argument it also realloc'd
1159  * @return the entry
1160  */
1161 fib_entry_t*
1163  fib_source_t source,
1165  const fib_route_path_t *rpaths)
1166 {
1167  fib_node_index_t old_path_list, fib_entry_index;
1168  fib_path_list_flags_t pl_flags;
1169  const fib_route_path_t *rpath;
1171 
1172  esrc = fib_entry_src_find(fib_entry, source, NULL);
1173 
1174  /*
1175  * save variable so we can recover from a fib_entry realloc.
1176  */
1177  fib_entry_index = fib_entry_get_index(fib_entry);
1178 
1179  if (NULL == esrc)
1180  {
1181  fib_entry = fib_entry_src_action_add(fib_entry,
1182  source,
1183  flags,
1184  drop_dpo_get(
1185  fib_entry_get_dpo_proto(fib_entry)));
1186  esrc = fib_entry_src_find(fib_entry, source, NULL);
1187  }
1188 
1189  /*
1190  * swapping paths may create a new path-list (or may use an existing shared)
1191  * but we are certainly getting a different one. This FIB entry to needs
1192  * to maintain its lock appropriately.
1193  */
1194  old_path_list = esrc->fes_pl;
1195 
1196  ASSERT(NULL != fib_entry_src_vft[source].fesv_path_swap);
1197 
1198  pl_flags = fib_entry_src_flags_2_path_list_flags(flags);
1199 
1200  vec_foreach(rpath, rpaths)
1201  {
1202  fib_entry_flags_update(fib_entry, rpath, &pl_flags, esrc);
1203  }
1204 
1205  fib_entry_src_vft[source].fesv_path_swap(esrc,
1206  fib_entry,
1207  pl_flags,
1208  rpaths);
1209 
1210  fib_entry = fib_entry_get(fib_entry_index);
1211 
1212  fib_path_list_lock(esrc->fes_pl);
1213  fib_path_list_unlock(old_path_list);
1214 
1215  return (fib_entry);
1216 }
1217 
1220  fib_source_t source,
1221  const fib_route_path_t *rpath)
1222 {
1223  fib_path_list_flags_t pl_flags;
1224  fib_node_index_t old_path_list;
1226 
1227  esrc = fib_entry_src_find(fib_entry, source, NULL);
1228 
1229  ASSERT(NULL != esrc);
1231 
1232  /*
1233  * we no doubt modifying a path-list. If the path-list
1234  * is shared, and hence not modifiable, then the index returned
1235  * will be for a different path-list. This FIB entry to needs
1236  * to maintain its lock appropriately.
1237  */
1238  old_path_list = esrc->fes_pl;
1239 
1240  ASSERT(NULL != fib_entry_src_vft[source].fesv_path_remove);
1241 
1243  fib_entry_flags_update(fib_entry, rpath, &pl_flags, esrc);
1244 
1245  fib_entry_src_vft[source].fesv_path_remove(esrc, pl_flags, rpath);
1246 
1247  /*
1248  * lock the new path-list, unlock the old if it had one
1249  */
1250  fib_path_list_unlock(old_path_list);
1251 
1252  if (FIB_NODE_INDEX_INVALID != esrc->fes_pl) {
1253  fib_path_list_lock(esrc->fes_pl);
1254  return (FIB_ENTRY_SRC_FLAG_ADDED);
1255  }
1256  else
1257  {
1258  /*
1259  * no more paths left from this source
1260  */
1261  fib_entry_src_action_remove(fib_entry, source);
1262  return (FIB_ENTRY_SRC_FLAG_NONE);
1263  }
1264 }
1265 
1266 u8*
1268  fib_source_t source,
1269  u8* s)
1270 {
1272 
1273  esrc = fib_entry_src_find(fib_entry, source, NULL);
1274 
1275  if (NULL != fib_entry_src_vft[source].fesv_format)
1276  {
1277  return (fib_entry_src_vft[source].fesv_format(esrc, s));
1278  }
1279  return (s);
1280 }
1281 
1284  fib_source_t source)
1285 {
1288 
1289  if (FIB_NODE_INDEX_INVALID == fib_entry_index)
1290  return (ADJ_INDEX_INVALID);
1291 
1292  fib_entry = fib_entry_get(fib_entry_index);
1293  esrc = fib_entry_src_find(fib_entry, source, NULL);
1294 
1295  if (NULL != esrc)
1296  {
1297  if (FIB_NODE_INDEX_INVALID != esrc->fes_pl)
1298  {
1299  return (fib_path_list_get_adj(
1300  esrc->fes_pl,
1301  fib_entry_get_default_chain_type(fib_entry)));
1302  }
1303  }
1304  return (ADJ_INDEX_INVALID);
1305 }
1306 
1307 const int
1309  fib_source_t source,
1310  dpo_id_t *dpo)
1311 {
1314 
1315  if (FIB_NODE_INDEX_INVALID == fib_entry_index)
1316  return (0);
1317 
1318  fib_entry = fib_entry_get(fib_entry_index);
1319  esrc = fib_entry_src_find(fib_entry, source, NULL);
1320 
1321  if (NULL != esrc)
1322  {
1323  if (FIB_NODE_INDEX_INVALID != esrc->fes_pl)
1324  {
1326  esrc->fes_pl,
1329  dpo);
1330 
1331  return (dpo_id_is_valid(dpo));
1332  }
1333  }
1334  return (0);
1335 }
1336 
1337 u32
1339  fib_source_t source)
1340 {
1343 
1344  fib_entry = fib_entry_get(entry_index);
1345 
1346  esrc = fib_entry_src_find(fib_entry, source, NULL);
1347 
1348  if (NULL != esrc)
1349  {
1350  if (FIB_NODE_INDEX_INVALID != esrc->fes_pl)
1351  {
1353  }
1354  }
1355  return (~0);
1356 }
1357 
1360  fib_source_t source)
1361 {
1364 
1365  fib_entry = fib_entry_get(entry_index);
1366 
1367  esrc = fib_entry_src_find(fib_entry, source, NULL);
1368 
1369  if (NULL != esrc)
1370  {
1371  return (esrc->fes_entry_flags);
1372  }
1373 
1374  return (FIB_ENTRY_FLAG_NONE);
1375 }
1376 
1379 {
1381 
1382  /*
1383  * the vector of sources is deliberately arranged in priority order
1384  */
1385  if (0 == vec_len(fib_entry->fe_srcs))
1386  {
1387  flags = FIB_ENTRY_FLAG_NONE;
1388  }
1389  else
1390  {
1392 
1393  esrc = vec_elt_at_index(fib_entry->fe_srcs, 0);
1394  flags = esrc->fes_entry_flags;
1395  }
1396 
1397  return (flags);
1398 }
1399 
1400 void
1402  fib_source_t source,
1403  const void *data)
1404 {
1407 
1408  fib_entry = fib_entry_get(fib_entry_index);
1409  esrc = fib_entry_src_find(fib_entry, source, NULL);
1410 
1411  if (NULL != esrc &&
1412  NULL != fib_entry_src_vft[source].fesv_set_data)
1413  {
1414  fib_entry_src_vft[source].fesv_set_data(esrc, fib_entry, data);
1415  }
1416 }
1417 
1418 const void*
1420  fib_source_t source)
1421 {
1424 
1425  fib_entry = fib_entry_get(fib_entry_index);
1426  esrc = fib_entry_src_find(fib_entry, source, NULL);
1427 
1428  if (NULL != esrc &&
1429  NULL != fib_entry_src_vft[source].fesv_get_data)
1430  {
1431  return (fib_entry_src_vft[source].fesv_get_data(esrc, fib_entry));
1432  }
1433  return (NULL);
1434 }
1435 
1436 void
1438 {
1447 }
static int fib_entry_src_cmp_for_sort(void *v1, void *v2)
Definition: fib_entry_src.c:40
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:432
fib_entry_src_cover_res_t fib_entry_src_action_cover_change(fib_entry_t *fib_entry, fib_source_t source)
int fib_path_is_resolved(fib_node_index_t path_index)
Definition: fib_path.c:2528
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:181
Contribute an object that is to be used to forward BIER packets.
Definition: fib_types.h:101
fib_entry_src_init_t fesv_init
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:116
#define FIB_ENTRY_DBG(_e, _fmt, _args...)
Debug macro.
Definition: fib_entry_src.h:42
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:393
void fib_table_fwding_dpo_remove(u32 fib_index, const fib_prefix_t *prefix, const dpo_id_t *dpo)
remove an entry in the FIB&#39;s forwarding table
Definition: fib_table.c:261
fib_path_ext_type_t fpe_type
The type of path extension.
Definition: fib_path_ext.h:94
void fib_entry_unlock(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1517
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:92
An entry in a FIB table.
Definition: fib_entry.h:385
fib_node_index_t path_index
The index of the FIB path.
Definition: load_balance.h:71
static int fib_entry_src_valid_out_label(mpls_label_t label)
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:2258
fib_entry_src_set_data_t fesv_set_data
struct fib_entry_src_collect_forwarding_ctx_t_ fib_entry_src_collect_forwarding_ctx_t
static int fib_urpf_check_size(index_t ui)
Data-Plane function to check the size of an uRPF list, (i.e.
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
fib_protocol_t fib_entry_get_proto(const fib_entry_t *fib_entry)
Definition: fib_entry.c:62
fib_entry_flag_t fib_entry_get_flags_i(const fib_entry_t *fib_entry)
A representation of a path as described by a route producer.
Definition: fib_types.h:377
dpo_id_t path_dpo
ID of the Data-path object.
Definition: load_balance.h:66
fib_forward_chain_type_t fct
static void fib_entry_src_action_fwd_update(const fib_entry_t *fib_entry, fib_source_t source)
adj_index_t fib_path_list_get_adj(fib_node_index_t path_list_index, fib_forward_chain_type_t type)
Virtual function table each FIB entry source will register.
u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index)
Definition: fib_entry.h:281
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
Definition: dpo.h:205
static fib_entry_src_t * fib_entry_src_find_or_create(fib_entry_t *fib_entry, fib_source_t source, u32 *index)
#define NULL
Definition: clib.h:55
Information related to the source of a FIB entry.
Definition: fib_entry.h:294
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:931
Definition: fib_entry.h:244
void load_balance_set_urpf(index_t lbi, index_t urpf)
Definition: load_balance.c:265
An MPLS extension that maintains the path&#39;s outgoing labels,.
Definition: fib_path_ext.h:31
int fib_path_is_exclusive(fib_node_index_t path_index)
Definition: fib_path.c:2508
void fib_entry_src_action_deactivate(fib_entry_t *fib_entry, fib_source_t source)
load_balance_path_t * next_hops
enum fib_entry_delegate_type_t_ fib_entry_delegate_type_t
Delegate types.
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
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:311
#define MPLS_IETF_IMPLICIT_NULL_LABEL
Definition: mpls_types.h:30
From the CLI.
Definition: fib_entry.h:74
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:258
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
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:518
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:557
Result from a cover update/change.
Definition: fib_entry_src.h:87
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:88
Definition: fib_entry.h:246
u32 fe_fib_index
The index of the FIB table this entry is in.
Definition: fib_entry.h:398
uRPF bypass/exemption.
Definition: fib_entry.h:122
Definition: fib_entry.h:240
fib_entry_src_t * fe_srcs
Vector of source infos.
Definition: fib_entry.h:417
static void fib_entry_recursive_loop_detect_i(fib_node_index_t path_list_index)
void fib_entry_src_action_deinit(fib_entry_t *fib_entry, fib_source_t source)
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
dpo_id_t fd_dpo
Valid for the forwarding chain delegates.
fib_node_index_t fe_parent
the path-list for which this entry is a child.
Definition: fib_entry.h:422
void fib_entry_src_mpls_register(void)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
flow_hash_config_t fib_table_get_flow_hash_config(u32 fib_index, fib_protocol_t proto)
Get the flow hash configured used by the table.
Definition: fib_table.c:947
index_t load_balance_create(u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
Definition: load_balance.c:194
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
void fib_entry_src_adj_register(void)
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:205
u32 fe_sibling
index of this entry in the parent&#39;s child list.
Definition: fib_entry.h:428
Definition: fib_entry.h:245
flow_hash_config_t fib_table_get_default_flow_hash_config(fib_protocol_t proto)
Get the flow hash configured used by the protocol.
Definition: fib_table.c:958
fib_entry_flag_t fib_entry_get_flags_for_source(fib_node_index_t entry_index, fib_source_t source)
const int fib_entry_get_dpo_for_source(fib_node_index_t fib_entry_index, fib_source_t source, dpo_id_t *dpo)
u32 fib_entry_get_resolving_interface_for_source(fib_node_index_t entry_index, fib_source_t source)
void fib_entry_src_lisp_register(void)
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:412
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 *rpath)
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 *rpath)
index_t fib_urpf_list_alloc_and_lock(void)
Definition: fib_urpf_list.c:55
#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:58
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregrate type for a prefix.
Definition: fib_types.h:172
fib_entry_src_path_add_t fesv_path_add
fib_node_index_t fib_entry_get_index(const fib_entry_t *fib_entry)
Definition: fib_entry.c:56
void load_balance_multipath_update(const dpo_id_t *dpo, const load_balance_path_t *raw_nhs, load_balance_flags_t flags)
Definition: load_balance.c:494
Contribute an object that is to be used to forward Ethernet packets.
Definition: fib_types.h:120
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto)
Definition: fib_types.c:227
void fib_entry_src_api_register(void)
u16 fib_path_get_weight(fib_node_index_t path_index)
Definition: fib_path.c:2094
void fib_urpf_list_append(index_t ui, u32 sw_if_index)
Append another interface to the list.
fib_path_ext_t * fib_path_ext_list_find_by_path_index(const fib_path_ext_list_t *list, fib_node_index_t path_index)
Definition: fib_path_ext.c:292
u16 install
Definition: fib_entry_src.h:88
Definition: fib_entry.h:238
u16 preference
A adj-source extension indicating the path&#39;s refinement criteria result.
Definition: fib_path_ext.h:36
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:166
Contribute an object that is to be used to forward end-of-stack MPLS packets.
Definition: fib_types.h:108
Definition: fib_entry.h:243
void fib_entry_src_mk_lb(fib_entry_t *fib_entry, const fib_entry_src_t *esrc, fib_forward_chain_type_t fct, dpo_id_t *dpo_lb)
void fib_path_ext_list_flush(fib_path_ext_list_t *list)
Definition: fib_path_ext.c:411
void fib_entry_src_default_route_register(void)
Definition: fib_entry.h:242
#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
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)
static int fib_route_attached_cross_table(const fib_entry_t *fib_entry, const fib_route_path_t *rpath)
enum fib_source_t_ fib_source_t
The different sources that can create a route.
fib_entry_src_fwd_update_t fesv_fwd_update
#define FOR_EACH_DELEGATE_CHAIN(_entry, _fdt, _fed, _body)
fib_entry_src_deinit_t fesv_deinit
dpo_type_t dpoi_type
the type
Definition: dpo.h:170
void load_balance_set_fib_entry_flags(index_t lbi, fib_entry_flag_t flags)
Definition: load_balance.c:254
load-balancing over a choice of [un]equal cost paths
Definition: dpo.h:102
#define MPLS_LABEL_IS_REAL(_lbl)
Definition: mpls_types.h:50
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:801
void fib_table_fwding_dpo_update(u32 fib_index, const fib_prefix_t *prefix, const dpo_id_t *dpo)
Add or update an entry in the FIB&#39;s forwarding table.
Definition: fib_table.c:234
static void fib_entry_src_get_path_forwarding(fib_node_index_t path_index, fib_entry_src_collect_forwarding_ctx_t *ctx)
void fib_path_list_lock(fib_node_index_t path_list_index)
static fib_entry_src_t * fib_entry_src_find(const fib_entry_t *fib_entry, fib_source_t source, u32 *index)
Definition: fib_entry_src.c:70
#define FIB_SOURCE_MAX
The maximum number of sources.
Definition: fib_entry.h:142
void fib_entry_src_action_init(fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry_src.c:49
enum load_balance_flags_t_ load_balance_flags_t
Flags controlling load-balance creation and modification.
fib_entry_src_flag_t fib_entry_src_action_remove(fib_entry_t *fib_entry, fib_source_t source)
static void fib_entry_flags_update(const fib_entry_t *fib_entry, const fib_route_path_t *rpath, fib_path_list_flags_t *pl_flags, fib_entry_src_t *esrc)
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
int fib_path_list_is_popular(fib_node_index_t path_list_index)
void fib_entry_src_action_installed(const fib_entry_t *fib_entry, fib_source_t source)
Definition: fib_entry.h:279
Contribute an object that is to be used to forward NSH packets.
Definition: fib_types.h:126
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
void fib_entry_src_action_activate(fib_entry_t *fib_entry, fib_source_t source)
void fib_urpf_list_bake(index_t ui)
Convert the uRPF list from the itf set obtained during the walk to a unique list. ...
void fib_entry_src_rr_register(void)
#define MPLS_IETF_IPV4_EXPLICIT_NULL_LABEL
Definition: mpls_types.h:27
fib_path_list_flags_t fib_entry_src_flags_2_path_list_flags(fib_entry_flag_t eflags)
fib_entry_src_remove_t fesv_remove
Definition: fib_entry.h:241
fib_entry_src_deactivate_t fesv_deactivate
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
fib_forward_chain_type_t fib_entry_delegate_type_to_chain_type(fib_entry_delegate_type_t fdt)
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:182
void fib_path_list_unlock(fib_node_index_t path_list_index)
index_t replicate_create(u32 n_buckets, dpo_proto_t rep_proto)
fib_entry_t * fib_entry_get(fib_node_index_t index)
Definition: fib_entry.c:44
enum fib_entry_flag_t_ fib_entry_flag_t
void fib_entry_src_interface_register(void)
void fib_entry_lock(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:1507
int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies)
fib_entry_flag_t fes_entry_flags
Flags the source contributes to the entry.
Definition: fib_entry.h:323
int n_recursive_constrained
fib_source_t fes_src
Which source this info block is for.
Definition: fib_entry.h:307
fib_entry_src_cover_res_t fib_entry_src_action_cover_update(fib_entry_t *fib_entry, fib_source_t source)
#define ASSERT(truth)
fib_entry_src_flag_t fes_flags
Flags on the source.
Definition: fib_entry.h:311
void fib_entry_src_special_register(void)
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)
unsigned int u32
Definition: types.h:88
int fib_path_is_deag(fib_node_index_t path_index)
Definition: fib_path.c:2518
long ctx[MAX_CONNS]
Definition: main.c:122
void fib_entry_src_module_init(void)
void fib_entry_src_register(fib_source_t source, const fib_entry_src_vft_t *vft)
Definition: fib_entry_src.c:33
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_route_path_flags_t frp_flags
flags on the path
Definition: fib_types.h:469
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.h:280
From the control plane API.
Definition: fib_entry.h:70
enum fib_entry_src_flag_t_ fib_entry_src_flag_t
A path that resolves via another table.
Definition: fib_types.h:346
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
Definition: lookup.h:82
fib_entry_src_path_remove_t fesv_path_remove
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
Definition: fib_entry_src.c:99
fib_entry_src_path_swap_t fesv_path_swap
dpo_id_t fe_lb
The load-balance used for forwarding.
Definition: fib_entry.h:411
fib_node_index_t fes_pl
The path-list created by the source.
Definition: fib_entry.h:303
static dpo_proto_t fib_prefix_get_payload_proto(const fib_prefix_t *pfx)
int fib_path_is_recursive_constrained(fib_node_index_t path_index)
Definition: fib_path.c:2496
fib_path_ext_adj_flags_t fpe_adj_flags
For an ADJ type extension.
Definition: fib_path_ext.h:88
unsigned short u16
Definition: types.h:57
const fib_entry_src_t * esrc
enum fib_path_list_walk_rc_t_ fib_path_list_walk_rc_t
return code to control pat-hlist walk
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:182
void fib_path_stack_mpls_disp(fib_node_index_t path_index, dpo_proto_t payload_proto, dpo_id_t *dpo)
Definition: fib_path.c:2205
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
#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
u16 fib_path_get_preference(fib_node_index_t path_index)
Definition: fib_path.c:2106
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:956
fib_entry_src_activate_t fesv_activate
void fib_urpf_list_unlock(index_t ui)
Definition: fib_urpf_list.c:68
#define MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL
Definition: mpls_types.h:29
One path from an [EU]CMP set that the client wants to add to a load-balance object.
Definition: load_balance.h:62
u8 * fib_entry_src_format(fib_entry_t *fib_entry, fib_source_t source, u8 *s)
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
void fib_entry_set_source_data(fib_node_index_t fib_entry_index, fib_source_t source, const void *data)
fib_entry_src_add_t fesv_add
index_t fib_path_list_get_urpf(fib_node_index_t path_list_index)
Return the the child the RPF list pre-built for this path list.
fib_forward_chain_type_t fib_entry_chain_type_fixup(const fib_entry_t *entry, fib_forward_chain_type_t fct)
Turn the chain type requested by the client into the one they really wanted.
void fib_entry_src_action_reactivate(fib_entry_t *fib_entry, fib_source_t source)
load_balance_flags_t fib_entry_calc_lb_flags(fib_entry_src_collect_forwarding_ctx_t *ctx)
Determine whether this FIB entry should use a load-balance MAP to support PIC edge fast convergence...
const fib_entry_t * fib_entry
static fib_path_list_walk_rc_t fib_entry_src_collect_forwarding(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:228
#define vec_foreach(var, vec)
Vector iterator.
A path extension is a per-entry addition to the forwarding information when packets are sent for that...
Definition: fib_path_ext.h:72
adj_index_t fib_entry_get_adj_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
u8 fes_ref_count
1 bytes ref count.
Definition: fib_entry.h:318
fib_path_ext_list_t fes_path_exts
A vector of path extensions.
Definition: fib_entry.h:298
dpo_proto_t fib_entry_get_dpo_proto(const fib_entry_t *fib_entry)
Definition: fib_entry.c:68
static int fib_path_is_attached(const fib_route_path_t *rpath)
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
Definition: fib_types.h:97
const void * fib_entry_get_source_data(fib_node_index_t fib_entry_index, fib_source_t source)
Attached path.
Definition: fib_types.h:305
enum fib_path_list_flags_t_ fib_path_list_flags_t
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...
u32 flags
Definition: vhost-user.h:77
#define ip46_address_is_zero(ip46)
Definition: ip6_packet.h:81
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:112
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:261
fib_forward_chain_type_t fib_entry_get_default_chain_type(const fib_entry_t *fib_entry)
Definition: fib_entry.c:74
void fib_entry_src_action_install(fib_entry_t *fib_entry, fib_source_t source)
fib_entry_src_installed_t fesv_installed
const fib_prefix_t fe_prefix
The prefix of the route.
Definition: fib_entry.h:394
void fib_entry_src_action_uninstall(fib_entry_t *fib_entry)
load_balance_path_t * fib_path_ext_stack(fib_path_ext_t *path_ext, fib_forward_chain_type_t child_fct, fib_forward_chain_type_t imp_null_fct, load_balance_path_t *nhs)
Definition: fib_path_ext.c:133