summaryrefslogtreecommitdiffstats
path: root/sysdep/unix
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-12-08 17:20:13 +0100
committerMartin Mares <mj@ucw.cz>1998-12-08 17:20:13 +0100
commitf39e4713c270752d7bbfcc8115a7ea7f589c3997 (patch)
tree3ec3307d6b9cd6d75a3eca373941aef4f447afab /sysdep/unix
parent04925e9040330afc92f8001e6a19ae2146e36782 (diff)
downloadbird-f39e4713c270752d7bbfcc8115a7ea7f589c3997.tar
bird-f39e4713c270752d7bbfcc8115a7ea7f589c3997.zip
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')
-rw-r--r--sysdep/unix/krt-set.c17
-rw-r--r--sysdep/unix/krt-set.h6
-rw-r--r--sysdep/unix/krt.h3
3 files changed, 16 insertions, 10 deletions
diff --git a/sysdep/unix/krt-set.c b/sysdep/unix/krt-set.c
index 2c355ee..8bc2df1 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;
}
+
diff --git a/sysdep/unix/krt-set.h b/sysdep/unix/krt-set.h
index a2107e1..214d91a 100644
--- a/sysdep/unix/krt-set.h
+++ b/sysdep/unix/krt-set.h
@@ -12,8 +12,8 @@
struct krt_set_params {
};
-void krt_remove_route(net *net, rte *old);
-void krt_add_route(net *net, rte *new);
-int krt_capable(net *net, rte *e);
+void krt_remove_route(rte *old);
+void krt_add_route(rte *new);
+int krt_capable(rte *e);
#endif
diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h
index 24122e9..aae5bd5 100644
--- a/sysdep/unix/krt.h
+++ b/sysdep/unix/krt.h
@@ -14,8 +14,11 @@
/* Flags stored in net->n.flags */
+#define KRF_CREATE 0 /* Not seen in kernel table */
#define KRF_SEEN 1 /* Seen in kernel table during last scan */
#define KRF_UPDATE 2 /* Need to update this entry */
+#define KRF_DELETE 3 /* Should be deleted */
+#define KRF_LEARN 4 /* We should learn this route */
/* sync-rt.c */