mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Kernel syncer is now configurable. It will probably need some more
options, but at least basic tuning is possible now.
This commit is contained in:
parent
0846203e89
commit
980ffedbb0
@ -17,3 +17,9 @@ protocol device {
|
||||
# disabled
|
||||
# interface "-eth*", "*"
|
||||
}
|
||||
|
||||
protocol kernel {
|
||||
# disabled
|
||||
learn; # Learn all routes from the kernel
|
||||
scan time 10; # Scan kernel tables every 10 seconds
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
krt-scan.c
|
||||
krt-scan.h
|
||||
krt-scan.Y
|
||||
|
33
sysdep/linux/krt-scan.Y
Normal file
33
sysdep/linux/krt-scan.Y
Normal file
@ -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
|
@ -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 (p->scanopt.learn)
|
||||
{
|
||||
if (flags & RTF_GATEWAY)
|
||||
krt_magic_route(p, net, gw);
|
||||
#endif
|
||||
}
|
||||
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
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,7 @@ io.c
|
||||
unix.h
|
||||
sync-if.c
|
||||
sync-rt.c
|
||||
krt.Y
|
||||
krt.h
|
||||
krt-set.c
|
||||
krt-set.h
|
||||
|
34
sysdep/unix/krt.Y
Normal file
34
sysdep/unix/krt.Y
Normal file
@ -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
|
@ -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 *);
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user