summaryrefslogtreecommitdiffstats
path: root/proto/static/static.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-11-14 05:49:56 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-11-14 05:49:56 +0100
commit2ef9177a47e7137dd09b06a353a6e5f6e671c951 (patch)
tree3fb8f3e25eec4dd513cb87399caf7c0e6ff5f955 /proto/static/static.c
parent9d35f8c51f1062ddd8e2f41cf535d8a8d69ec6be (diff)
downloadbird-2ef9177a47e7137dd09b06a353a6e5f6e671c951.tar
bird-2ef9177a47e7137dd09b06a353a6e5f6e671c951.zip
Add multicast support to static protocol and generic route handling.
Diffstat (limited to 'proto/static/static.c')
-rw-r--r--proto/static/static.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index 6b42a37..e15a43b 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -23,7 +23,7 @@
* newly added routes and removes the obsolete ones.
*/
-#undef LOCAL_DEBUG
+#define LOCAL_DEBUG
#include "nest/bird.h"
#include "nest/iface.h"
@@ -45,18 +45,18 @@ static_install(struct proto *p, struct static_route *r, struct iface *ifa)
if (r->installed)
return;
- DBG("Installing static route %I/%d, rtd=%d\n", r->net, r->masklen, r->dest);
+ DBG("Installing static route %I/%d, rtd=%d%s\n", r->net, r->masklen, r->dest, (r->cast == RTC_MULTICAST) ? ", multicast" : "");
bzero(&a, sizeof(a));
a.proto = p;
a.source = (r->dest == RTD_DEVICE) ? RTS_STATIC_DEVICE : RTS_STATIC;
a.scope = SCOPE_UNIVERSE;
- a.cast = RTC_UNICAST;
+ a.cast = r->cast;
a.dest = r->dest;
a.gw = r->via;
a.iface = ifa;
aa = rta_lookup(&a);
- n = net_get(p->table, r->net, r->masklen);
+ n = net_get2(p->table, r->net, r->masklen, r->cast);
e = rte_get_temp(aa);
e->net = n;
e->pflags = 0;
@@ -72,8 +72,8 @@ static_remove(struct proto *p, struct static_route *r)
if (!r->installed)
return;
- DBG("Removing static route %I/%d\n", r->net, r->masklen);
- n = net_find(p->table, r->net, r->masklen);
+ DBG("Removing static route %I/%d%s\n", r->net, r->masklen, (r->cast == RTC_MULTICAST) ? ", multicast" : "");
+ n = net_find2(p->table, r->net, r->masklen, r->cast);
if (n)
rte_update(p->table, n, p, p, NULL);
r->installed = 0;
@@ -247,13 +247,13 @@ static_match(struct proto *p, struct static_route *r, struct static_config *n)
if (r->neigh)
r->neigh->data = NULL;
WALK_LIST(t, n->iface_routes)
- if (static_same_net(r, t))
+ if (static_same_net(r, t) && r->cast == t->cast)
{
t->installed = static_same_dest(r, t);
return;
}
WALK_LIST(t, n->other_routes)
- if (static_same_net(r, t))
+ if (static_same_net(r, t) && r->cast == t->cast)
{
t->installed = static_same_dest(r, t);
return;
@@ -311,7 +311,7 @@ static_show_rt(struct static_route *r)
case RTD_PROHIBIT: bsprintf(via, "prohibited"); break;
default: bsprintf(via, "???");
}
- cli_msg(-1009, "%I/%d %s%s", r->net, r->masklen, via, r->installed ? "" : " (dormant)");
+ cli_msg(-1009, "%I/%d %s%s%s", r->net, r->masklen, via, r->cast == RTC_MULTICAST ? "" : " multicast", r->installed ? "" : " (dormant)");
}
void