summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-02-01 12:51:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-02-01 12:51:02 +0000
commite2261ebe355563b33dcd382ec9bbc2fcdad99c20 (patch)
tree05da16b4badb3d6ddcdc190d3c09fd3dee5dbfbe
parentb16df421e514104e266b667dda80ed27a7582a3a (diff)
kr_reload() -- another helper function for reload support. This one
takes care that redistribution is correct after reload. OK norby@ pyr@
-rw-r--r--usr.sbin/ospfd/kroute.c20
-rw-r--r--usr.sbin/ospfd/ospfd.h3
2 files changed, 21 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c
index 9fc84bbbcfb..285ce2d42df 100644
--- a/usr.sbin/ospfd/kroute.c
+++ b/usr.sbin/ospfd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.39 2006/12/13 13:30:07 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.40 2007/02/01 12:51:01 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -398,6 +398,24 @@ dont_redistribute:
main_imsg_compose_rde(type, 0, &rr, sizeof(struct rroute));
}
+void
+kr_reload(void)
+{
+ struct kroute_node *kr;
+ u_int32_t dummy;
+ int r;
+
+ RB_FOREACH(kr, kroute_tree, &krt) {
+ r = ospf_redistribute(&kr->r, &dummy);
+ if (kr->r.flags & F_REDISTRIBUTED && !r) {
+ kr_redistribute(IMSG_NETWORK_DEL, &kr->r);
+ } else if (r) {
+ /* RIB will cope with duplicates */
+ kr_redistribute(IMSG_NETWORK_ADD, &kr->r);
+ }
+ }
+}
+
/* rb-tree compare */
int
kroute_compare(struct kroute_node *a, struct kroute_node *b)
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 8fc481b6e62..392eb234436 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.63 2006/12/21 17:22:29 claudio Exp $ */
+/* $OpenBSD: ospfd.h,v 1.64 2007/02/01 12:51:01 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -572,6 +572,7 @@ void kr_dispatch_msg(int, short, void *);
void kr_show_route(struct imsg *);
void kr_ifinfo(char *, pid_t);
struct kif *kif_findname(char *, struct in_addr, struct kif_addr **);
+void kr_reload(void);
u_int8_t mask2prefixlen(in_addr_t);
in_addr_t prefixlen2mask(u_int8_t);