summaryrefslogtreecommitdiff
path: root/proto/static
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-02-13 21:59:48 +0000
committerMartin Mares <mj@ucw.cz>1999-02-13 21:59:48 +0000
commitd88e99a92ae688cc7f6534af4c2555fe6f6709f6 (patch)
tree27de6df9a59c4a3980a9cdc0dadc4e641e9a9d26 /proto/static
parentd1f7eab6b5f1bd86a47402cb8fdb5cbcedc8947f (diff)
Implemented static device routes.
Expect for reconfiguration issues, the static protocol is complete now.
Diffstat (limited to 'proto/static')
-rw-r--r--proto/static/static.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index 9216d82b..a0b1c5ac 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -80,8 +80,7 @@ static_start(struct proto *p)
break;
}
case RTD_DEVICE:
- bug("Static device routes are not supported");
- /* FIXME: Static device routes */
+ break;
default:
static_install(p, r, NULL);
}
@@ -134,6 +133,26 @@ static_dump(struct proto *p)
static_dump_rt(r);
}
+static void
+static_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface *old)
+{
+ struct static_route *r;
+ struct static_config *c = (void *) p->cf;
+
+ if (flags & IF_CHANGE_UP)
+ {
+ WALK_LIST(r, c->iface_routes)
+ if (!strcmp(r->if_name, new->name))
+ static_install(p, r, new);
+ }
+ else if (flags & IF_CHANGE_DOWN)
+ {
+ WALK_LIST(r, c->iface_routes)
+ if (!strcmp(r->if_name, old->name))
+ static_remove(p, r);
+ }
+}
+
void
static_init_config(struct static_config *c)
{
@@ -148,6 +167,7 @@ static_init(struct proto_config *c)
struct proto *p = proto_new(c, sizeof(struct proto));
p->neigh_notify = static_neigh_notify;
+ p->if_notify = static_if_notify;
return p;
}