summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/fib/fib_entry_src.c19
-rw-r--r--src/vnet/fib/fib_table.c16
-rw-r--r--src/vnet/fib/fib_table.h11
3 files changed, 44 insertions, 2 deletions
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index fd80497c453..ab72565d903 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -447,9 +447,24 @@ fib_entry_src_mk_lb (fib_entry_t *fib_entry,
else
{
flow_hash_config_t fhc;
+ fib_protocol_t fp;
- fhc = fib_table_get_flow_hash_config(fib_entry->fe_fib_index,
- dpo_proto_to_fib(lb_proto));
+ /*
+ * if the protocol for the LB we are building does not match that
+ * of the fib_entry (i.e. we are build the [n]EOS LB for an IPv[46]
+ * then the fib_index is not an index that relates to the table
+ * type we need. So get the default flow-hash config instead.
+ */
+ fp = dpo_proto_to_fib(lb_proto);
+
+ if (fib_entry->fe_prefix.fp_proto != fp)
+ {
+ fhc = fib_table_get_default_flow_hash_config(fp);
+ }
+ else
+ {
+ fhc = fib_table_get_flow_hash_config(fib_entry->fe_fib_index, fp);
+ }
dpo_set(dpo_lb,
DPO_LOAD_BALANCE,
lb_proto,
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index d50f17f1ce4..5aa02dd0042 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -951,6 +951,22 @@ fib_table_get_flow_hash_config (u32 fib_index,
return (fib->ft_flow_hash_config);
}
+flow_hash_config_t
+fib_table_get_default_flow_hash_config (fib_protocol_t proto)
+{
+ switch (proto)
+ {
+ case FIB_PROTOCOL_IP4:
+ case FIB_PROTOCOL_IP6:
+ return (IP_FLOW_HASH_DEFAULT);
+
+ case FIB_PROTOCOL_MPLS:
+ return (MPLS_FLOW_HASH_DEFAULT);
+ }
+
+ ASSERT(0);
+ return (IP_FLOW_HASH_DEFAULT);
+}
/**
* @brief Table set flow hash config context.
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index 21773342428..a65fea741fc 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -667,6 +667,17 @@ extern flow_hash_config_t fib_table_get_flow_hash_config(u32 fib_index,
/**
* @brief
+ * Get the flow hash configured used by the protocol
+ *
+ * @paran proto
+ * The protocol of the FIB (and thus the entries therein)
+ *
+ * @return The flow hash config
+ */
+extern flow_hash_config_t fib_table_get_default_flow_hash_config(fib_protocol_t proto);
+
+/**
+ * @brief
* Set the flow hash configured used by the table
*
* @param fib_index