summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry_src.c
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-12-20 18:18:42 +0000
committerDamjan Marion <dmarion@me.com>2021-12-21 11:13:41 +0000
commit53962fbccb4612af41e3fbd913cc50be09d3b24a (patch)
treeb576686d35593d8e20b8f858eed4585ae3e8ff65 /src/vnet/fib/fib_entry_src.c
parent3aa3d6d3f347784f3df5c164b3078bdc5e80e54a (diff)
fib: MPLS EOS chains built for attached prefixes should link to a lookup DPO
Type: fix Presently a local label associated with an attached or connected prefix will link to the glean. This is a problem since it will never use the adj-fibs that are installed for that attached prefix. Instead link the local label to a lookup in the table in which the attached link is bound. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Iad49fb6168b9ba47216a9a52bd262363b49c3c43
Diffstat (limited to 'src/vnet/fib/fib_entry_src.c')
-rw-r--r--src/vnet/fib/fib_entry_src.c56
1 files changed, 9 insertions, 47 deletions
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index 5e66de7c93b..c0275e898bd 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -257,6 +257,7 @@ typedef struct fib_entry_src_collect_forwarding_ctx_t_
fib_forward_chain_type_t fct;
int n_recursive_constrained;
u16 preference;
+ dpo_proto_t payload_proto;
} fib_entry_src_collect_forwarding_ctx_t;
/**
@@ -289,47 +290,6 @@ fib_entry_src_valid_out_label (mpls_label_t label)
MPLS_IETF_IMPLICIT_NULL_LABEL == label));
}
-/**
- * @brief Turn the chain type requested by the client into the one they
- * really wanted
- */
-fib_forward_chain_type_t
-fib_entry_chain_type_fixup (const fib_entry_t *entry,
- fib_forward_chain_type_t fct)
-{
- /*
- * The EOS chain is a tricky since one cannot know the adjacency
- * to link to without knowing what the packets payload protocol
- * will be once the label is popped.
- */
- fib_forward_chain_type_t dfct;
-
- if (FIB_FORW_CHAIN_TYPE_MPLS_EOS != fct)
- {
- return (fct);
- }
-
- dfct = fib_entry_get_default_chain_type(entry);
-
- if (FIB_FORW_CHAIN_TYPE_MPLS_EOS == dfct)
- {
- /*
- * If the entry being asked is a eos-MPLS label entry,
- * then use the payload-protocol field, that we stashed there
- * for just this purpose
- */
- return (fib_forw_chain_type_from_dpo_proto(
- entry->fe_prefix.fp_payload_proto));
- }
- /*
- * else give them what this entry would be by default. i.e. if it's a v6
- * entry, then the label its local labelled should be carrying v6 traffic.
- * If it's a non-EOS label entry, then there are more labels and we want
- * a non-eos chain.
- */
- return (dfct);
-}
-
static dpo_proto_t
fib_prefix_get_payload_proto (const fib_prefix_t *pfx)
{
@@ -371,7 +331,8 @@ fib_entry_src_get_path_forwarding (fib_node_index_t path_index,
nh->path_index = path_index;
nh->path_weight = fib_path_get_weight(path_index);
- fib_path_contribute_forwarding(path_index, ctx->fct, &nh->path_dpo);
+ fib_path_contribute_forwarding(path_index, ctx->fct,
+ ctx->payload_proto, &nh->path_dpo);
break;
case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
@@ -384,6 +345,7 @@ fib_entry_src_get_path_forwarding (fib_node_index_t path_index,
nh->path_weight = fib_path_get_weight(path_index);
fib_path_contribute_forwarding(path_index,
FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ ctx->payload_proto,
&nh->path_dpo);
}
break;
@@ -397,11 +359,11 @@ fib_entry_src_get_path_forwarding (fib_node_index_t path_index,
nh->path_index = path_index;
nh->path_weight = fib_path_get_weight(path_index);
fib_path_contribute_forwarding(path_index,
- fib_entry_chain_type_fixup(ctx->fib_entry,
- ctx->fct),
+ ctx->fct,
+ ctx->payload_proto,
&nh->path_dpo);
fib_path_stack_mpls_disp(path_index,
- fib_prefix_get_payload_proto(&ctx->fib_entry->fe_prefix),
+ ctx->payload_proto,
FIB_MPLS_LSP_MODE_PIPE,
&nh->path_dpo);
@@ -480,9 +442,8 @@ fib_entry_src_collect_forwarding (fib_node_index_t pl_index,
*/
ctx->next_hops =
fib_path_ext_stack(path_ext,
+ ctx->payload_proto,
ctx->fct,
- fib_entry_chain_type_fixup(ctx->fib_entry,
- ctx->fct),
ctx->next_hops);
}
else
@@ -609,6 +570,7 @@ fib_entry_src_mk_lb (fib_entry_t *fib_entry,
.preference = 0xffff,
.start_source_index = start,
.end_source_index = end,
+ .payload_proto = fib_prefix_get_payload_proto(&fib_entry->fe_prefix),
};
/*