From dcd6d6254a2b204a4283c889d1feac8f59a62639 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Fri, 26 May 2017 02:59:16 -0700 Subject: ARP/ND use path_remove to complement path_add don't add duplicate extensions. Change-Id: Icf72d6e1b004d0dda532bec2b51f6b74544925bb Signed-off-by: Neale Ranns --- src/vnet/fib/fib_path_ext.c | 17 ++++++++++++++--- src/vnet/fib/fib_path_ext.h | 10 +++++----- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'src/vnet/fib') diff --git a/src/vnet/fib/fib_path_ext.c b/src/vnet/fib/fib_path_ext.c index 45ab1f1498d..26f2b9b6d5d 100644 --- a/src/vnet/fib/fib_path_ext.c +++ b/src/vnet/fib/fib_path_ext.c @@ -105,7 +105,7 @@ fib_path_ext_resolve (fib_path_ext_t *path_ext, path_ext); } -void +static void fib_path_ext_init (fib_path_ext_t *path_ext, fib_node_index_t path_list_index, fib_path_ext_type_t ext_type, @@ -338,7 +338,18 @@ fib_path_ext_list_insert (fib_path_ext_list_t *list, vec_foreach(path_ext, list->fpel_exts) { - if (fib_path_ext_cmp(path_ext, rpath) < 0) + int res = fib_path_ext_cmp(path_ext, rpath); + + if (0 == res) + { + /* + * don't add duplicate extensions. modify instead + */ + vec_free(path_ext->fpe_label_stack); + *path_ext = new_path_ext; + goto done; + } + else if (res < 0) { i++; } @@ -348,7 +359,7 @@ fib_path_ext_list_insert (fib_path_ext_list_t *list, } } vec_insert_elts(list->fpel_exts, &new_path_ext, 1, i); - +done: return (&(list->fpel_exts[i])); } diff --git a/src/vnet/fib/fib_path_ext.h b/src/vnet/fib/fib_path_ext.h index d1571a1b4ee..d07941c108b 100644 --- a/src/vnet/fib/fib_path_ext.h +++ b/src/vnet/fib/fib_path_ext.h @@ -71,11 +71,6 @@ typedef enum fib_path_ext_adj_flags_t_ */ typedef struct fib_path_ext_t_ { - /** - * The type of path extension - */ - fib_path_ext_type_t fpe_type; - /** * A description of the path that is being extended. * This description is used to match this extension with the [changing] @@ -93,6 +88,11 @@ typedef struct fib_path_ext_t_ fib_path_ext_adj_flags_t fpe_adj_flags; }; + /** + * The type of path extension + */ + fib_path_ext_type_t fpe_type; + /** * The index of the path. This is the global index, not the path's * position in the path-list. -- cgit 1.2.3-korg