diff options
author | Martin Mares <mj@ucw.cz> | 1998-12-08 16:20:13 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1998-12-08 16:20:13 +0000 |
commit | f39e4713c270752d7bbfcc8115a7ea7f589c3997 (patch) | |
tree | 3ec3307d6b9cd6d75a3eca373941aef4f447afab /sysdep/unix/krt-set.c | |
parent | 04925e9040330afc92f8001e6a19ae2146e36782 (diff) |
Rewritten kernel syncer. Now uses the rta trickery I've introduced yesterday
and does things "the right way". Few things are still missing (device
routes etc.), I'll add them later in the evening.
Diffstat (limited to 'sysdep/unix/krt-set.c')
-rw-r--r-- | sysdep/unix/krt-set.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sysdep/unix/krt-set.c b/sysdep/unix/krt-set.c index 2c355eee..8bc2df11 100644 --- a/sysdep/unix/krt-set.c +++ b/sysdep/unix/krt-set.c @@ -22,7 +22,7 @@ #include "lib/krt.h" int -krt_capable(net *net, rte *e) +krt_capable(rte *e) { rta *a = e->attrs; @@ -40,11 +40,12 @@ krt_capable(net *net, rte *e) } void -krt_remove_route(net *net, rte *old) +krt_remove_route(rte *old) { + net *net = old->net; struct rtentry re; - if (old && !krt_capable(net, old)) + if (!krt_capable(old) || old->attrs->source == RTS_INHERIT) { DBG("krt_remove_route(ignored %I/%d)\n", net->n.prefix, net->n.pxlen); return; @@ -58,12 +59,13 @@ krt_remove_route(net *net, rte *old) } void -krt_add_route(net *net, rte *new) +krt_add_route(rte *new) { + net *net = new->net; struct rtentry re; rta *a = new->attrs; - if (!krt_capable(net, new)) + if (!krt_capable(new) || new->attrs->source == RTS_INHERIT) { DBG("krt_add_route(ignored %I/%d)\n", net->n.prefix, net->n.pxlen); return; @@ -105,9 +107,9 @@ krt_set_notify(struct proto *x, net *net, rte *new, rte *old) if (x->state != PRS_UP) return; if (old) - krt_remove_route(net, old); + krt_remove_route(old); if (new) - krt_add_route(net, new); + krt_add_route(new); } void @@ -117,3 +119,4 @@ krt_set_preconfig(struct krt_proto *x) die("krt set: missing socket"); x->p.rt_notify = krt_set_notify; } + |