summaryrefslogtreecommitdiff
path: root/lib/table.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-07-19 16:54:24 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-07-19 16:54:24 +0000
commitb37aead99b7e1923618de0ef0860784f3ea96b54 (patch)
tree44f9d9432b82fdf398f7ef9447673046d42e989d /lib/table.c
parent8ed86a5d2062084ecc5c1d0035f286ff6aad9bd7 (diff)
lib: route_node_lookup() needs to apply_mask() to prefix
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/table.c')
-rw-r--r--lib/table.c12
1 files 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;
}