summaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-12-06 18:40:42 +0100
committerMartin Mares <mj@ucw.cz>1998-12-06 18:40:42 +0100
commit980ffedbb04bf3beedf147fc7dfed40cdbf968aa (patch)
tree075cadebb6c03fe359f77f51dc11d5e06d66f95f /sysdep
parent0846203e896d8ab009217968e391b5e13ea3c4c6 (diff)
downloadbird-980ffedbb04bf3beedf147fc7dfed40cdbf968aa.tar
bird-980ffedbb04bf3beedf147fc7dfed40cdbf968aa.zip
Kernel syncer is now configurable. It will probably need some more
options, but at least basic tuning is possible now.
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/linux/Modules1
-rw-r--r--sysdep/linux/krt-scan.Y33
-rw-r--r--sysdep/linux/krt-scan.c13
-rw-r--r--sysdep/linux/krt-scan.h1
-rw-r--r--sysdep/unix/Modules1
-rw-r--r--sysdep/unix/krt.Y34
-rw-r--r--sysdep/unix/krt.h2
-rw-r--r--sysdep/unix/main.c2
-rw-r--r--sysdep/unix/sync-rt.c3
9 files changed, 83 insertions, 7 deletions
diff --git a/sysdep/linux/Modules b/sysdep/linux/Modules
index 5562ab2..6244479 100644
--- a/sysdep/linux/Modules
+++ b/sysdep/linux/Modules
@@ -1,2 +1,3 @@
krt-scan.c
krt-scan.h
+krt-scan.Y
diff --git a/sysdep/linux/krt-scan.Y b/sysdep/linux/krt-scan.Y
new file mode 100644
index 0000000..fcdcfe6
--- /dev/null
+++ b/sysdep/linux/krt-scan.Y
@@ -0,0 +1,33 @@
+/*
+ * BIRD -- Linux Kernel Syncer Configuration
+ *
+ * (c) 1998 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+#include "lib/krt-scan.h"
+
+CF_DECLS
+
+CF_KEYWORDS(LEARN, SCAN, TIME)
+
+CF_GRAMMAR
+
+CF_ADDTO(kern_proto, kern_proto krt_scan_item ';')
+
+krt_scan_item:
+ LEARN bool {
+ ((struct krt_proto *) this_proto)->scanopt.learn = $2;
+ }
+ | SCAN TIME expr {
+ /* Scan time of 0 means scan on startup only */
+ ((struct krt_proto *) this_proto)->scanopt.recurrence = $3;
+ }
+ ;
+
+CF_CODE
+
+CF_END
diff --git a/sysdep/linux/krt-scan.c b/sysdep/linux/krt-scan.c
index 6fdb3bf..9d8cf5f 100644
--- a/sysdep/linux/krt-scan.c
+++ b/sysdep/linux/krt-scan.c
@@ -131,11 +131,11 @@ krt_parse_entry(byte *e, struct krt_proto *p)
return;
#endif
DBG("krt_parse_entry: kernel reporting unknown route %I/%d\n", dest, masklen);
-#if 1
- /* FIXME: should be configurable */
- if (flags & RTF_GATEWAY)
- krt_magic_route(p, net, gw);
-#endif
+ if (p->scanopt.learn)
+ {
+ if (flags & RTF_GATEWAY)
+ krt_magic_route(p, net, gw);
+ }
net->n.flags |= KRF_UPDATE;
}
}
@@ -235,7 +235,8 @@ krt_scan_preconfig(struct krt_proto *x)
{
SCANOPT;
- p->recurrence = 10; /* FIXME: use reasonable default value */
+ p->recurrence = 60;
+ p->learn = 0;
}
void
diff --git a/sysdep/linux/krt-scan.h b/sysdep/linux/krt-scan.h
index 1ea1ca7..18073e2 100644
--- a/sysdep/linux/krt-scan.h
+++ b/sysdep/linux/krt-scan.h
@@ -11,6 +11,7 @@
struct krt_scan_params {
int recurrence; /* How often should we scan krt, 0=only on startup */
+ int learn; /* Should we learn routes from the kernel? */
struct timer *timer;
};
diff --git a/sysdep/unix/Modules b/sysdep/unix/Modules
index 70ed145..441c3f0 100644
--- a/sysdep/unix/Modules
+++ b/sysdep/unix/Modules
@@ -5,6 +5,7 @@ io.c
unix.h
sync-if.c
sync-rt.c
+krt.Y
krt.h
krt-set.c
krt-set.h
diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y
new file mode 100644
index 0000000..d4dd082
--- /dev/null
+++ b/sysdep/unix/krt.Y
@@ -0,0 +1,34 @@
+/*
+ * BIRD -- UNIX Kernel Syncer Configuration
+ *
+ * (c) 1998 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+#include "lib/krt.h"
+
+CF_DECLS
+
+CF_KEYWORDS(KERNEL)
+
+CF_GRAMMAR
+
+/* Kernel protocol */
+
+CF_ADDTO(proto, kern_proto '}')
+
+kern_proto_start: proto_start KERNEL {
+ if (!(this_proto = cf_krt_proto)) cf_error("Kernel protocol already defined");
+ cf_krt_proto = NULL;
+ }
+ ;
+
+CF_ADDTO(kern_proto, kern_proto_start '{')
+CF_ADDTO(kern_proto, kern_proto proto_item ';')
+
+CF_CODE
+
+CF_END
diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h
index e7b5597..2da29e5 100644
--- a/sysdep/unix/krt.h
+++ b/sysdep/unix/krt.h
@@ -22,6 +22,8 @@ struct krt_proto {
struct krt_scan_params scanopt;
};
+extern struct proto *cf_krt_proto;
+
/* krt-scan.c */
void krt_scan_preconfig(struct krt_proto *);
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 4aeb9c1..f5076c4 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -82,7 +82,6 @@ read_config(void)
cf_read_hook = cf_read;
cf_lex_init(1);
cf_parse();
- add_tail(&protocol_list, &proto_unix_kernel.n); /* FIXME: Must be _always_ the last one */
protos_postconfig();
}
@@ -104,6 +103,7 @@ main(void)
if_init();
protos_build();
+ add_tail(&protocol_list, &proto_unix_kernel.n);
protos_init();
debug("Reading configuration file.\n");
diff --git a/sysdep/unix/sync-rt.c b/sysdep/unix/sync-rt.c
index 69b2bde..169494e 100644
--- a/sysdep/unix/sync-rt.c
+++ b/sysdep/unix/sync-rt.c
@@ -23,6 +23,8 @@
#include "unix.h"
#include "krt.h"
+struct proto *cf_krt_proto;
+
void
krt_start(struct proto *P)
{
@@ -42,6 +44,7 @@ krt_preconfig(struct protocol *x)
{
struct krt_proto *p = (struct krt_proto *) proto_new(&proto_unix_kernel, sizeof(struct krt_proto));
+ cf_krt_proto = &p->p;
p->p.preference = DEF_PREF_UKR;
p->p.start = krt_start;
p->p.shutdown = krt_shutdown;