summaryrefslogtreecommitdiff
path: root/lib/table.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/table.c')
-rw-r--r--lib/table.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/table.c b/lib/table.c
index 3bf93894ec..dbfc3f8b91 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -142,7 +142,7 @@ static void route_common(const struct prefix *n, const struct prefix *p,
const uint8_t *pp;
uint8_t *newp;
- if (n->family == AF_FLOWSPEC)
+ if (n->family == AF_FLOWSPEC || n->family == AF_LINKSTATE)
return prefix_copy(new, p);
np = (const uint8_t *)&n->u.prefix;
pp = (const uint8_t *)&p->u.prefix;
@@ -281,15 +281,22 @@ struct route_node *route_node_get(struct route_table *table,
const uint8_t *prefix = &p->u.prefix;
node = rn_hash_node_find(&table->hash, &search);
- if (node && node->info)
+ if (node && node->info) {
+ if (family2afi(p->family) == AFI_LINKSTATE)
+ prefix_linkstate_ptr_free(p);
+
return route_lock_node(node);
+ }
match = NULL;
node = table->top;
while (node && node->p.prefixlen <= prefixlen
&& prefix_match(&node->p, p)) {
- if (node->p.prefixlen == prefixlen)
+ if (node->p.prefixlen == prefixlen) {
+ if (family2afi(p->family) == AFI_LINKSTATE)
+ prefix_linkstate_ptr_free(p);
return route_lock_node(node);
+ }
match = node;
node = node->link[prefix_bit(prefix, node->p.prefixlen)];
@@ -324,6 +331,9 @@ struct route_node *route_node_get(struct route_table *table,
table->count++;
route_lock_node(new);
+ if (family2afi(p->family) == AFI_LINKSTATE)
+ prefix_linkstate_ptr_free(p);
+
return new;
}