diff options
| author | Russ White <russ@riw.us> | 2023-09-26 10:07:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-26 10:07:02 -0400 |
| commit | 8e755a03a3257644c0542a8ee658d2c08230c0ae (patch) | |
| tree | a4d58a1595c3884d9555d88d533fd2043a8de21d /lib/table.c | |
| parent | c0a681eed504398fc1fef11bd62b3667c93d8048 (diff) | |
| parent | 8074d6f438bfb6c0cc98626b54919ce10f190125 (diff) | |
Merge pull request #12649 from louis-6wind/bgp-link-state
bgpd: add basic support of BGP Link-State RFC7752
Diffstat (limited to 'lib/table.c')
| -rw-r--r-- | lib/table.c | 16 |
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; } |
