summaryrefslogtreecommitdiff
path: root/proto/pipe
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-08-14 16:25:22 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2012-08-14 16:46:43 +0200
commit094d2bdb79e1ffa0a02761fd651aa0f0b6b0c585 (patch)
treef7cb65c540403ed152677dde3b803c3dd117d8e5 /proto/pipe
parentd760229ab897fa1bf1fd0fe7019cc2431d21a1cc (diff)
Implements ADD-PATH extension for BGP.
Allows to send and receive multiple routes for one network by one BGP session. Also contains necessary core changes to support this (routing tables accepting several routes for one network from one protocol). It needs some more cleanup before merging to the master branch.
Diffstat (limited to 'proto/pipe')
-rw-r--r--proto/pipe/pipe.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c
index 6099d284..5bae8614 100644
--- a/proto/pipe/pipe.c
+++ b/proto/pipe/pipe.c
@@ -49,7 +49,7 @@ pipe_rt_notify(struct proto *P, rtable *src_table, net *n, rte *new, rte *old, e
struct pipe_proto *p = (struct pipe_proto *) P;
struct announce_hook *ah = (src_table == P->table) ? p->peer_ahook : P->main_ahook;
rtable *dst_table = ah->table;
- struct proto *src;
+ struct rte_src *src;
net *nn;
rte *e;
@@ -72,7 +72,7 @@ pipe_rt_notify(struct proto *P, rtable *src_table, net *n, rte *new, rte *old, e
if (p->mode == PIPE_OPAQUE)
{
- a.proto = &p->p;
+ a.src = P->main_source;
a.source = RTS_PIPE;
}
@@ -91,16 +91,16 @@ pipe_rt_notify(struct proto *P, rtable *src_table, net *n, rte *new, rte *old, e
e->pflags = new->pflags;
}
- src = new->attrs->proto;
+ src = a.src;
}
else
{
e = NULL;
- src = old->attrs->proto;
+ src = old->attrs->src;
}
src_table->pipe_busy = 1;
- rte_update2(ah, nn, e, (p->mode == PIPE_OPAQUE) ? &p->p : src);
+ rte_update2(ah, nn, e, src);
src_table->pipe_busy = 0;
}
@@ -173,6 +173,12 @@ pipe_start(struct proto *P)
p->peer_ahook->in_limit = cf->c.out_limit;
proto_reset_limit(p->peer_ahook->in_limit);
+ if (p->mode == PIPE_OPAQUE)
+ {
+ P->main_source = rt_get_source(P, 0);
+ rt_lock_source(P->main_source);
+ }
+
return PS_UP;
}
@@ -187,6 +193,10 @@ pipe_cleanup(struct proto *P)
P->main_ahook = NULL;
p->peer_ahook = NULL;
+ if (p->mode == PIPE_OPAQUE)
+ rt_unlock_source(P->main_source);
+ P->main_source = NULL;
+
rt_unlock_table(P->table);
rt_unlock_table(p->peer_table);
}