-/*
- * mpls_tunnel_path_ext_add
- *
- * append a path extension to the entry's list
- */
-static void
-mpls_tunnel_path_ext_append (mpls_tunnel_t *mt,
- const fib_route_path_t *rpath)
-{
- if (NULL != rpath->frp_label_stack)
- {
- fib_path_ext_t *path_ext;
-
- vec_add2(mt->mt_path_exts, path_ext, 1);
-
- fib_path_ext_init(path_ext, mt->mt_path_list, rpath);
- }
-}
-
-/*
- * mpls_tunnel_path_ext_insert
- *
- * insert, sorted, a path extension to the entry's list.
- * It's not strictly necessary in sort the path extensions, since each
- * extension has the path index to which it resolves. However, by being
- * sorted the load-balance produced has a deterministic order, not an order
- * based on the sequence of extension additions. this is a considerable benefit.
- */
-static void
-mpls_tunnel_path_ext_insert (mpls_tunnel_t *mt,
- const fib_route_path_t *rpath)
-{
- if (0 == vec_len(mt->mt_path_exts))
- return (mpls_tunnel_path_ext_append(mt, rpath));
-
- if (NULL != rpath->frp_label_stack)
- {
- fib_path_ext_t path_ext;
- int i = 0;
-
- fib_path_ext_init(&path_ext, mt->mt_path_list, rpath);
-
- while (i < vec_len(mt->mt_path_exts) &&
- (fib_path_ext_cmp(&mt->mt_path_exts[i], rpath) < 0))
- {
- i++;
- }
-
- vec_insert_elts(mt->mt_path_exts, &path_ext, 1, i);
- }
-}
-