diff options
author | Martin Mares <mj@ucw.cz> | 1998-12-08 18:37:58 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1998-12-08 18:37:58 +0000 |
commit | 8e66a0ebb927f40c9fcb48bbf5f2d811d7b7c7f3 (patch) | |
tree | 48925711f0a9e8a943f54a190065668d2edefe72 /sysdep/unix/sync-if.c | |
parent | 980297d2899a5aec6609d1f7b44626e52e6e4417 (diff) |
Hopefully finished kernel syncer (krt) rewrite:
o Interface syncing is now a part of krt and it can have configurable
parameters. Actually, the only one is scan rate now :)
o Kernel routing table syncing is now synchronized with interface
syncing (we need the most recent version of the interface list
to prevent lots of routes to non-existent destinations from
appearing). Instead of its own timer, we just check if it's
route scan time after each iface list scan.
o Syncing of device routes implemented.
o CONFIG_AUTO_ROUTES should control syncing of automatic device routes.
o Rewrote krt_remove_route() to really remove routes :)
o Better diagnostics.
o Fixed a couple of bugs.
Diffstat (limited to 'sysdep/unix/sync-if.c')
-rw-r--r-- | sysdep/unix/sync-if.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/sysdep/unix/sync-if.c b/sysdep/unix/sync-if.c index 76426e73..70a2c0ce 100644 --- a/sysdep/unix/sync-if.c +++ b/sysdep/unix/sync-if.c @@ -17,12 +17,14 @@ #include "nest/bird.h" #include "nest/iface.h" +#include "nest/route.h" +#include "nest/protocol.h" #include "lib/timer.h" +#include "lib/krt.h" #include "unix.h" int if_scan_sock; -int if_scan_period = 60; static timer *if_scan_timer; @@ -131,8 +133,9 @@ scan_if(timer *t) struct ifconf ic; static int last_ifbuf_size = 4*sizeof(struct ifreq); int res; + struct krt_proto *p = t->data; - DBG("Scanning interfaces...\n"); + DBG("It's interface scan time...\n"); for(;;) { if (last_ifbuf_size) @@ -165,6 +168,32 @@ scan_if(timer *t) DBG("Increased ifconf buffer size to %d\n", last_ifbuf_size); #endif } + krt_scan_ifaces_done(p); +} + +void +krt_if_start(struct krt_proto *p) +{ + if_scan_timer = tm_new(&root_pool); + if_scan_timer->hook = scan_if; + if_scan_timer->data = p; + if_scan_timer->recurrent = p->ifopt.scan_time; + scan_if(if_scan_timer); + tm_start(if_scan_timer, p->ifopt.scan_time); +} + +void +krt_if_preconfig(struct krt_proto *p) +{ + p->ifopt.scan_time = 60; +} + +void +krt_if_shutdown(struct krt_proto *p) +{ + tm_stop(if_scan_timer); + rfree(if_scan_timer); + /* FIXME: What should we do with interfaces? */ } void @@ -174,9 +203,4 @@ scan_if_init(void) DBG("Using socket %d for interface and route scanning\n", if_scan_sock); if (if_scan_sock < 0) die("Cannot create scanning socket: %m"); - scan_if(NULL); - if_scan_timer = tm_new(&root_pool); - if_scan_timer->hook = scan_if; - if_scan_timer->recurrent = if_scan_period; - tm_start(if_scan_timer, if_scan_period); } |