aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/srmpls/sr_mpls_policy.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-08-30 06:12:27 -0700
committerNeale Ranns <nranns@cisco.com>2018-08-31 09:03:07 +0000
commit2da975c4dde45b1421998e54c107cb24d01d10d9 (patch)
tree2b26f835004209c611a846223d341a78d053a0e8 /src/vnet/srmpls/sr_mpls_policy.c
parentfe47e29fc6ddcb664f76f4ebbfd2593cb0282e43 (diff)
SR-MPLS: fixes and tests
- the FIB path takes a vector of type fib_mpls_label_t not u32 so the untype safe vec_add did not work - write som eSR-MPLS tests - allow an MPLS tunnel to resolve through a SR BSID Change-Id: I2a18b9a9bf43584100ac269c4ebc286c9e3b3ea5 Signed-off-by: Neale Ranns <nranns@cisco.com> (cherry picked from commit 7c922dc404c2c0a2d67d53ca05db1c1ae1598f44)
Diffstat (limited to 'src/vnet/srmpls/sr_mpls_policy.c')
-rwxr-xr-xsrc/vnet/srmpls/sr_mpls_policy.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/vnet/srmpls/sr_mpls_policy.c b/src/vnet/srmpls/sr_mpls_policy.c
index 5bb7fb2bff5..86cd169716a 100755
--- a/src/vnet/srmpls/sr_mpls_policy.c
+++ b/src/vnet/srmpls/sr_mpls_policy.c
@@ -61,6 +61,7 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight)
{
mpls_sr_main_t *sm = &sr_mpls_main;
mpls_sr_sl_t *segment_list;
+ u32 ii;
pool_get (sm->sid_lists, segment_list);
memset (segment_list, 0, sizeof (*segment_list));
@@ -85,8 +86,24 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight)
.frp_local_label = sl[0],
};
- if (vec_len (sl) - 1)
- vec_add (path.frp_label_stack, sl + 1, vec_len (sl) - 1);
+ if (vec_len (sl) > 1)
+ {
+ vec_validate (path.frp_label_stack, vec_len (sl) - 2);
+ for (ii = 1; ii < vec_len (sl); ii++)
+ {
+ path.frp_label_stack[ii - 1].fml_value = sl[ii];
+ }
+ }
+ else
+ {
+ /*
+ * add an impliciet NULL label to allow non-eos recursion
+ */
+ fib_mpls_label_t lbl = {
+ .fml_value = MPLS_IETF_IMPLICIT_NULL_LABEL,
+ };
+ vec_add1 (path.frp_label_stack, lbl);
+ }
fib_route_path_t *paths = NULL;
vec_add1 (paths, path);