routes) from kernel routing tables unless the "persist" switch is set.
krt.h
krt-set.c
krt-set.h
+krt-set.Y
krt-iface.h
krt-iface.Y
--- /dev/null
+/*
+ * BIRD -- UNIX Kernel Syncer Configuration
+ *
+ * (c) 1998--1999 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(PERSIST)
+
+CF_GRAMMAR
+
+CF_ADDTO(kern_proto, kern_proto krt_set_item ';')
+
+krt_set_item:
+ PERSIST bool {
+ ((struct krt_config *) this_proto)->setopt.persist = $2;
+ }
+ ;
+
+CF_CODE
+
+CF_END
krt_set_preconfig(struct krt_config *c)
{
}
+
+void
+krt_set_shutdown(struct krt_proto *x)
+{
+ struct rtable *t = &master_table;
+
+ if (((struct krt_config *) x->p.cf)->setopt.persist)
+ return;
+ DBG("Flushing kernel routes...\n");
+ while (t && t->tos)
+ t = t->sibling;
+ if (!t)
+ return;
+ FIB_WALK(&t->fib, f)
+ {
+ net *n = (net *) f;
+ rte *e = n->routes;
+ if (e)
+ {
+ rta *a = e->attrs;
+ if (a->source != RTS_DEVICE && a->source != RTS_INHERIT)
+ krt_remove_route(e);
+ }
+ }
+ FIB_WALK_END;
+}
#define _BIRD_KRT_SET_H_
struct krt_set_params {
+ int persist;
};
struct krt_set_status {
void krt_set_preconfig(struct krt_config *);
void krt_set_start(struct krt_proto *);
+void krt_set_shutdown(struct krt_proto *);
/* sync-if.c */
krt_scan_shutdown(k);
krt_if_shutdown(k);
+ krt_set_shutdown(k);
return PS_DOWN;
}