mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Hostentry application locking
Due to a race condition between rta_apply_hostentry() and rt_update_hostentry(), happening when a new route is inserted to a table, this commit makes it mandatory to lock the next hop resolution table while resolving the next hop. This may be slow, we'll fix it better in some future release
This commit is contained in:
parent
7776e47e32
commit
510b1046e1
@ -3416,7 +3416,7 @@ ea_set_hostentry(ea_list **to, rtable *dep, rtable *src, ip_addr gw, ip_addr ll,
|
||||
|
||||
|
||||
static void
|
||||
rta_apply_hostentry(ea_list **to, struct hostentry_adata *head)
|
||||
rta_apply_hostentry(struct rtable_private *tab UNUSED, ea_list **to, struct hostentry_adata *head)
|
||||
{
|
||||
struct hostentry *he = head->he;
|
||||
u32 *labels = head->labels;
|
||||
@ -3544,7 +3544,8 @@ rt_next_hop_update_rte(rte *old, rte *new)
|
||||
return 0;
|
||||
|
||||
*new = *old;
|
||||
rta_apply_hostentry(&new->attrs, head);
|
||||
RT_LOCKED(head->he->owner, tab)
|
||||
rta_apply_hostentry(tab, &new->attrs, head);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -3557,7 +3558,8 @@ rt_next_hop_resolve_rte(rte *r)
|
||||
|
||||
struct hostentry_adata *head = (struct hostentry_adata *) heea->u.ptr;
|
||||
|
||||
rta_apply_hostentry(&r->attrs, head);
|
||||
RT_LOCKED(head->he->owner, tab)
|
||||
rta_apply_hostentry(tab, &r->attrs, head);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BGP
|
||||
@ -4875,6 +4877,7 @@ rt_get_hostentry(struct rtable_private *tab, ip_addr a, ip_addr ll, rtable *dep)
|
||||
if (!he)
|
||||
{
|
||||
he = hc_new_hostentry(hc, tab->rp, a, link, dep, k);
|
||||
he->owner = RT_PUB(tab);
|
||||
rt_update_hostentry(tab, he);
|
||||
}
|
||||
|
||||
|
@ -489,6 +489,7 @@ struct hostentry {
|
||||
ip_addr link; /* (link-local) IP address of host, used as gw
|
||||
if host is directly attached */
|
||||
rtable *tab; /* Dependent table, part of key */
|
||||
rtable *owner; /* Nexthop owner table */
|
||||
struct hostentry *next; /* Next in hash chain */
|
||||
unsigned hash_key; /* Hash key */
|
||||
unsigned uc; /* Use count */
|
||||
|
Loading…
Reference in New Issue
Block a user