options, but at least basic tuning is possible now.
# disabled
# interface "-eth*", "*"
}
+
+protocol kernel {
+# disabled
+ learn; # Learn all routes from the kernel
+ scan time 10; # Scan kernel tables every 10 seconds
+}
krt-scan.c
krt-scan.h
+krt-scan.Y
--- /dev/null
+/*
+ * 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
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;
}
}
{
SCANOPT;
- p->recurrence = 10; /* FIXME: use reasonable default value */
+ p->recurrence = 60;
+ p->learn = 0;
}
void
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;
};
unix.h
sync-if.c
sync-rt.c
+krt.Y
krt.h
krt-set.c
krt-set.h
--- /dev/null
+/*
+ * 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
struct krt_scan_params scanopt;
};
+extern struct proto *cf_krt_proto;
+
/* krt-scan.c */
void krt_scan_preconfig(struct krt_proto *);
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();
}
if_init();
protos_build();
+ add_tail(&protocol_list, &proto_unix_kernel.n);
protos_init();
debug("Reading configuration file.\n");
#include "unix.h"
#include "krt.h"
+struct proto *cf_krt_proto;
+
void
krt_start(struct proto *P)
{
{
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;