summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-02-11 22:27:06 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-02-11 22:27:06 +0100
commitc83876265eeae3591bfe90375503728e633cb807 (patch)
treeee5302b85bf3d9dc1da67a9d59ca9eb4bbfd83f9 /proto
parenta2ea1bac601ca79946e2a215dac9427c526cedab (diff)
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.
Diffstat (limited to 'proto')
-rw-r--r--proto/pipe/pipe.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c
index aa76a152..d9df03ba 100644
--- a/proto/pipe/pipe.c
+++ b/proto/pipe/pipe.c
@@ -138,6 +138,9 @@ pipe_start(struct proto *P)
* end of the pipe (we need to do this in order to get different
* filters and announce functions and it unfortunately involves
* a couple of magic trickery).
+ *
+ * The phantom protocol is used ONLY in announce hooks and
+ * therefore in do_rte_announce() function.
*/
ph = mb_alloc(P->pool, sizeof(struct pipe_proto));
memcpy(ph, p, sizeof(struct pipe_proto));
@@ -170,20 +173,10 @@ pipe_start(struct proto *P)
*/
a = proto_add_announce_hook(P, p->peer);
a->proto = &ph->p;
- rt_lock_table(p->peer);
return PS_UP;
}
-static int
-pipe_shutdown(struct proto *P)
-{
- struct pipe_proto *p = (struct pipe_proto *) P;
-
- rt_unlock_table(p->peer);
- return PS_DOWN;
-}
-
static struct proto *
pipe_init(struct proto_config *C)
{
@@ -234,13 +227,19 @@ pipe_reconfigure(struct proto *P, struct proto_config *new)
return 1;
}
+struct rtable *
+pipe_get_peer_table(struct proto *P)
+{
+ struct pipe_proto *p = (struct pipe_proto *) P;
+ return p->peer;
+}
+
struct protocol proto_pipe = {
name: "Pipe",
template: "pipe%d",
postconfig: pipe_postconfig,
init: pipe_init,
start: pipe_start,
- shutdown: pipe_shutdown,
reconfigure: pipe_reconfigure,
get_status: pipe_get_status,
};