summaryrefslogtreecommitdiff
path: root/nest/rt-dev.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-11-29 22:03:58 +0000
committerMartin Mares <mj@ucw.cz>1998-11-29 22:03:58 +0000
commit50d8424ad1f40f9979214c1d6cbf8e290ba9a5cb (patch)
tree59f58fdb5b3e37c00c9d4955ed671e4dcec9f814 /nest/rt-dev.c
parent66efdf962a343c7cf5aef475f35f9e3864cb4fdd (diff)
Added configuration of the device internal protocol. This is primarily
intended to serve as an example of interface pattern list use. As a side effect, you can disable generating of device routes by disabling this protocol.
Diffstat (limited to 'nest/rt-dev.c')
-rw-r--r--nest/rt-dev.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index 7ef04f09..e7d43fb1 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -14,11 +14,20 @@
#include "nest/iface.h"
#include "nest/protocol.h"
#include "nest/route.h"
+#include "nest/rt-dev.h"
+#include "conf/conf.h"
#include "lib/resource.h"
+struct proto *cf_dev_proto;
+
static void
dev_if_notify(struct proto *p, unsigned c, struct iface *old, struct iface *new)
{
+ struct rt_dev_proto *P = (void *) p;
+
+ if (old && !iface_patt_match(&P->iface_list, old) ||
+ new && !iface_patt_match(&P->iface_list, new))
+ return;
if (c & IF_CHANGE_DOWN)
{
net *n;
@@ -72,11 +81,17 @@ dev_init(struct protocol *p)
static void
dev_preconfig(struct protocol *x)
{
- struct proto *p = proto_new(&proto_device, sizeof(struct proto));
+ struct rt_dev_proto *P = proto_new(&proto_device, sizeof(struct rt_dev_proto));
+ struct proto *p = &P->p;
+ struct iface_patt *k = cfg_alloc(sizeof(struct iface_patt));
+ cf_dev_proto = p;
p->preference = DEF_PREF_DIRECT;
p->start = dev_start;
p->if_notify = dev_if_notify;
+ init_list(&P->iface_list);
+ k->pattern = "*";
+ add_tail(&P->iface_list, &k->n);
}
static void