diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2023-04-19 13:40:13 +0200 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2023-09-18 14:57:03 +0200 |
commit | 39a8d354c11f6f063fa5154f5807e7a0c9b04b46 (patch) | |
tree | 274eb91b310d78b045f9b00f0dca42a797e30764 /lib/table.c | |
parent | lib: add link-state prefixes (diff) | |
download | frr-39a8d354c11f6f063fa5154f5807e7a0c9b04b46.tar.xz frr-39a8d354c11f6f063fa5154f5807e7a0c9b04b46.zip |
bgpd: store bgp link-state prefixes
Add the ability to store link-state prefixes in the BGP table.
Store a raw copy of the BGP link state NLRI TLVs as received in the
packet in 'p.u.prefix_linkstate.ptr'.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'lib/table.c')
-rw-r--r-- | lib/table.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/table.c b/lib/table.c index 1910bd042..dbfc3f8b9 100644 --- a/lib/table.c +++ b/lib/table.c @@ -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; } |