From b37aead99b7e1923618de0ef0860784f3ea96b54 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 19 Jul 2017 16:54:24 +0000 Subject: [PATCH] lib: route_node_lookup() needs to apply_mask() to prefix Signed-off-by: Daniel Walton Reviewed-by: --- lib/table.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/table.c b/lib/table.c index 8e84d803ea..2defa4fb62 100644 --- a/lib/table.c +++ b/lib/table.c @@ -277,10 +277,12 @@ struct route_node *route_node_match_ipv6(const struct route_table *table, struct route_node *route_node_lookup(const struct route_table *table, union prefixconstptr pu) { - const struct prefix *p = pu.p; + struct prefix p; struct route_node *node; + prefix_copy(&p, pu.p); + apply_mask(&p); - node = hash_get(table->hash, (void *)p, NULL); + node = hash_get(table->hash, (void *)&p, NULL); return (node && node->info) ? route_lock_node(node) : NULL; } @@ -288,10 +290,12 @@ struct route_node *route_node_lookup(const struct route_table *table, struct route_node *route_node_lookup_maynull(const struct route_table *table, union prefixconstptr pu) { - const struct prefix *p = pu.p; + struct prefix p; struct route_node *node; + prefix_copy(&p, pu.p); + apply_mask(&p); - node = hash_get(table->hash, (void *)p, NULL); + node = hash_get(table->hash, (void *)&p, NULL); return node ? route_lock_node(node) : NULL; } -- 2.39.5