From 2ef9177a47e7137dd09b06a353a6e5f6e671c951 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 14 Nov 2010 05:49:56 +0100 Subject: Add multicast support to static protocol and generic route handling. --- proto/static/static.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'proto/static/static.c') 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 -- cgit v1.2.3