diff options
author | Pablo Camarillo <pcamaril@cisco.com> | 2018-01-08 15:53:20 +0100 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2018-01-09 21:37:11 +0000 |
commit | d01f4e76bdac94d10f08660b2d42d8d0a37e93ba (patch) | |
tree | 991b5038c154f114ad73f671d29590bf6f33ef9c /src/vnet/srmpls | |
parent | c287cd550b91be7a93bae76d0086db87f575e3d3 (diff) |
VPP-1113 SR MPLS path.frp_label_stack
provide one label stack per fib_table_entry_path_add2 call. otherwise multiple mheap releases take place.
Change-Id: I475ca1b801fc85dddda0b540c69ad628a274df7f
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
Diffstat (limited to 'src/vnet/srmpls')
-rwxr-xr-x | src/vnet/srmpls/sr_mpls_policy.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/vnet/srmpls/sr_mpls_policy.c b/src/vnet/srmpls/sr_mpls_policy.c index d75f2d1e22f..1a5ba6c6c30 100755 --- a/src/vnet/srmpls/sr_mpls_policy.c +++ b/src/vnet/srmpls/sr_mpls_policy.c @@ -75,24 +75,24 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight) (weight != (u32) ~ 0 ? weight : SR_SEGMENT_LIST_WEIGHT_DEFAULT); segment_list->segments = vec_dup (sl); - fib_route_path_t path = { - .frp_proto = DPO_PROTO_MPLS, - .frp_sw_if_index = ~0, - .frp_fib_index = 0, - .frp_weight = segment_list->weight, - .frp_flags = FIB_ROUTE_PATH_FLAG_NONE, - .frp_label_stack = NULL, - .frp_local_label = sl[0], - }; - - vec_add (path.frp_label_stack, sl + 1, vec_len (sl) - 1); - - fib_route_path_t *paths = NULL; - vec_add1 (paths, path); - mpls_eos_bit_t eos; FOR_EACH_MPLS_EOS_BIT (eos) { + fib_route_path_t path = { + .frp_proto = DPO_PROTO_MPLS, + .frp_sw_if_index = ~0, + .frp_fib_index = 0, + .frp_weight = segment_list->weight, + .frp_flags = FIB_ROUTE_PATH_FLAG_NONE, + .frp_label_stack = NULL, + .frp_local_label = sl[0], + }; + + vec_add (path.frp_label_stack, sl + 1, vec_len (sl) - 1); + + fib_route_path_t *paths = NULL; + vec_add1 (paths, path); + /* *INDENT-OFF* */ fib_prefix_t pfx = { .fp_len = 21, @@ -109,10 +109,9 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight) (sr_policy->type == SR_POLICY_TYPE_DEFAULT ? FIB_ENTRY_FLAG_NONE : FIB_ENTRY_FLAG_MULTICAST), paths); + vec_free (paths); } - vec_free (paths); - return segment_list; } |