{
fib_path_list_t *path_list;
+ if (FIB_NODE_INDEX_INVALID == path_list_index)
+ {
+ return (0);
+ }
+
path_list = fib_path_list_get(path_list_index);
return (vec_len(path_list->fpl_paths));
return (sw_if_index);
}
-fib_protocol_t
+dpo_proto_t
fib_path_list_get_proto (fib_node_index_t path_list_index)
{
fib_path_list_t *path_list;
fib_path_create(path_list_index,
&rpaths[i]));
}
+ /*
+ * we sort the paths since the key for the path-list is
+ * the description of the paths it contains. The paths need to
+ * be sorted else this description will differ.
+ */
+ if (vec_len(path_list->fpl_paths) > 1)
+ {
+ vec_sort_with_function(path_list->fpl_paths,
+ fib_path_cmp_for_sort);
+ }
}
/*
}
fib_node_index_t
-fib_path_list_create_special (fib_protocol_t nh_proto,
+fib_path_list_create_special (dpo_proto_t nh_proto,
fib_path_list_flags_t flags,
const dpo_id_t *dpo)
{
* If we find one then we can return the existing one and destroy the
* new one just created.
*/
- exist_path_list_index = fib_path_list_db_find(path_list);
- if (FIB_NODE_INDEX_INVALID != exist_path_list_index)
+ if (path_list->fpl_flags & FIB_PATH_LIST_FLAG_SHARED)
{
- fib_path_list_destroy(path_list);
+ exist_path_list_index = fib_path_list_db_find(path_list);
+ if (FIB_NODE_INDEX_INVALID != exist_path_list_index)
+ {
+ fib_path_list_destroy(path_list);
- path_list_index = exist_path_list_index;
+ path_list_index = exist_path_list_index;
+ }
+ else
+ {
+ /*
+ * if there was not a matching path-list, then this
+ * new one will need inserting into the DB and resolving.
+ */
+ fib_path_list_db_insert(path_list_index);
+
+ path_list = fib_path_list_resolve(path_list);
+ }
}
else
{
/*
- * if there was not a matching path-list, then this
- * new one will need inserting into the DB and resolving.
+ * no shared path list requested. resolve and use the one
+ * just created.
*/
- fib_path_list_db_insert(path_list_index);
-
path_list = fib_path_list_resolve(path_list);
}
vec_foreach(path_index, path_list->fpl_paths)
{
- if (!func(path_list_index, *path_index, ctx))
+ if (FIB_PATH_LIST_WALK_STOP == func(path_list_index,
+ *path_index,
+ ctx))
break;
}
}