mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 07:03:57 +00:00
Merge pull request #5450 from donaldsharp/rpki_node_issues
bgpd: Prevent crash in bgp_table_range_lookup
This commit is contained in:
commit
96fda36733
@ -159,7 +159,8 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
|
||||
if (node == NULL)
|
||||
return;
|
||||
|
||||
while (node->p.prefixlen <= p->prefixlen && prefix_match(&node->p, p)) {
|
||||
while (node &&
|
||||
node->p.prefixlen <= p->prefixlen && prefix_match(&node->p, p)) {
|
||||
if (bgp_node_has_bgp_path_info_data(node)
|
||||
&& node->p.prefixlen == p->prefixlen) {
|
||||
matched = node;
|
||||
@ -169,14 +170,20 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
|
||||
&p->u.prefix, node->p.prefixlen)]);
|
||||
}
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (matched == NULL && node->p.prefixlen <= maxlen
|
||||
&& prefix_match(p, &node->p) && node->parent == NULL)
|
||||
matched = node;
|
||||
else if ((matched == NULL && node->p.prefixlen > maxlen) || !node->parent)
|
||||
return;
|
||||
else if (matched == NULL)
|
||||
else if (matched == NULL && node->parent)
|
||||
matched = node = bgp_node_from_rnode(node->parent);
|
||||
|
||||
if (!matched)
|
||||
return;
|
||||
|
||||
if (bgp_node_has_bgp_path_info_data(matched)) {
|
||||
bgp_lock_node(matched);
|
||||
listnode_add(matches, matched);
|
||||
|
Loading…
Reference in New Issue
Block a user