1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Fixes a tricky bug in the pipe protocol.

When uncofiguring the pipe and the peer table, the peer table was
unlocked when pipe protocol state changed to down/flushing and not to
down/hungry. This leads to the removal of the peer table before
the routes from the pipe were flushed.

The fix leads to adding some pipe-specific hacks to the nest,
but this seems inevitable.
This commit is contained in:
Ondrej Zajicek
2010-02-11 22:27:06 +01:00
parent a2ea1bac60
commit c83876265e
4 changed files with 36 additions and 12 deletions

View File

@@ -133,6 +133,11 @@ proto_init_instance(struct proto *p)
p->attn = ev_new(p->pool);
p->attn->data = p;
rt_lock_table(p->table);
#ifdef CONFIG_PIPE
if (proto_is_pipe(p))
rt_lock_table(pipe_get_peer_table(p));
#endif
}
/**
@@ -583,6 +588,12 @@ proto_fell_down(struct proto *p)
bzero(&p->stats, sizeof(struct proto_stats));
rt_unlock_table(p->table);
#ifdef CONFIG_PIPE
if (proto_is_pipe(p))
rt_unlock_table(pipe_get_peer_table(p));
#endif
proto_rethink_goal(p);
}

View File

@@ -334,4 +334,18 @@ struct announce_hook {
struct announce_hook *proto_add_announce_hook(struct proto *, struct rtable *);
/*
* Some pipe-specific nest hacks
*/
#ifdef CONFIG_PIPE
static inline int proto_is_pipe(struct proto *p)
{ return p->proto == &proto_pipe; }
struct rtable *pipe_get_peer_table(struct proto *p);
#endif
#endif

View File

@@ -642,7 +642,7 @@ rte_update(rtable *table, net *net, struct proto *p, struct proto *src, rte *new
/* Do not filter routes going through the pipe,
they are filtered in the export filter only. */
#ifdef CONFIG_PIPE
if (p->proto == &proto_pipe)
if (proto_is_pipe(p))
filter = FILTER_ACCEPT;
#endif