aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-21 02:09:25 -0700
committerDave Barach <openvpp@barachs.net>2019-07-03 11:31:16 +0000
commit3eea9de899f4affbe6695bb314989981fca8f234 (patch)
treefe40b4ae071bdd399c78b3825a3def4fc966e868 /src
parent7bf7ea3ce39c1d70c0409dcbecd5c4aaf26fae13 (diff)
gbp: Consider data-plane learnt source better than control-plane
Type: feature Change-Id: Ice8fc0da6450d2aa8ba63ca1277393ac3605aa2c Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gbp/gbp_endpoint.c10
-rw-r--r--src/plugins/gbp/gbp_endpoint.h6
-rw-r--r--src/plugins/gbp/gbp_learn_node.c4
3 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/gbp/gbp_endpoint.c b/src/plugins/gbp/gbp_endpoint.c
index da15b49d81b..d759da2bece 100644
--- a/src/plugins/gbp/gbp_endpoint.c
+++ b/src/plugins/gbp/gbp_endpoint.c
@@ -101,6 +101,16 @@ gbp_endpoint_is_external (const gbp_endpoint_t * ge)
return (! !(ge->ge_fwd.gef_flags & GBP_ENDPOINT_FLAG_EXTERNAL));
}
+int
+gbp_endpoint_is_learnt (const gbp_endpoint_t * ge)
+{
+ if (0 == vec_len (ge->ge_locs))
+ return 0;
+
+ /* DP is the highest source so if present it will be first */
+ return (ge->ge_locs[0].gel_src == GBP_ENDPOINT_SRC_DP);
+}
+
static void
gbp_endpoint_extract_key_mac_itf (const clib_bihash_kv_16_8_t * key,
mac_address_t * mac, u32 * sw_if_index)
diff --git a/src/plugins/gbp/gbp_endpoint.h b/src/plugins/gbp/gbp_endpoint.h
index a0d354ab8ab..27df6447e20 100644
--- a/src/plugins/gbp/gbp_endpoint.h
+++ b/src/plugins/gbp/gbp_endpoint.h
@@ -58,11 +58,13 @@ extern u8 *format_gbp_endpoint_flags (u8 * s, va_list * args);
/**
* Sources of Endpoints in priority order. The best (lowest value) source
- * provides the forwarding information
+ * provides the forwarding information.
+ * Data-plane takes preference because the CP data is not always complete,
+ * it may not have the sclass.
*/
#define foreach_gbp_endpoint_src \
- _(CP, "control-plane") \
_(DP, "data-plane") \
+ _(CP, "control-plane") \
_(RR, "recursive-resolution")
typedef enum gbp_endpoint_src_t_
diff --git a/src/plugins/gbp/gbp_learn_node.c b/src/plugins/gbp/gbp_learn_node.c
index 8c623e8bd3e..42d1ceb83e1 100644
--- a/src/plugins/gbp/gbp_learn_node.c
+++ b/src/plugins/gbp/gbp_learn_node.c
@@ -543,7 +543,7 @@ gbp_learn_l3 (vlib_main_t * vm,
ge0 = gbp_endpoint_find_ip6 (&ip6_0->src_address, fib_index0);
- if (NULL == ge0)
+ if ((NULL == ge0) || !gbp_endpoint_is_learnt (ge0))
{
t0 = throttle_check (&glm->gl_l3_throttle,
thread_index,
@@ -576,7 +576,7 @@ gbp_learn_l3 (vlib_main_t * vm,
gbp_learn_get_outer (eth0, &outer_src, &outer_dst);
ge0 = gbp_endpoint_find_ip4 (&ip4_0->src_address, fib_index0);
- if (NULL == ge0)
+ if ((NULL == ge0) || !gbp_endpoint_is_learnt (ge0))
{
t0 = throttle_check (&glm->gl_l3_throttle, thread_index,
ip4_0->src_address.as_u32, seed);