summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-05-12 10:14:40 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-05-12 10:14:40 +0000
commitf965686ac692468246735f9cb9c555817771f2c2 (patch)
tree9a62e03b5613e02dcd60a19682d91c0ed9752f9b /usr.sbin/ospfd
parent06b569a937023fdb27fa0ee2db42b416602450ab (diff)
Fix multiple bugs in if_act_elect(). In some cases DR were set wrongly
because of a stupid typo that I fixed in rev. 1.6 but forgot to fix the bug I introduced before because of that typo. Also reset the DR/BDR fields of iface->self when going to round two. Without the reset it is e.g. not possible to drop from DR to BDR. Issue found and patch tested by Stephen Marley OK norby@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/interface.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index f8fdeac424b..24c1be02654 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.20 2005/04/25 11:31:50 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.21 2005/05/12 10:14:39 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -427,6 +427,11 @@ start:
nbr->dr.s_addr == nbr->addr.s_addr) /* don't elect DR */
continue;
if (bdr != NULL) {
+ /*
+ * routers announcing themselfs as BDR have higher
+ * precedence over those routers announcing a
+ * different BDR.
+ */
if (nbr->bdr.s_addr == nbr->addr.s_addr) {
if (bdr->bdr.s_addr == bdr->addr.s_addr)
bdr = if_elect(bdr, nbr);
@@ -445,7 +450,7 @@ start:
(nbr != dr && nbr->dr.s_addr != nbr->addr.s_addr))
/* only DR may be elected check priority too */
continue;
- if (dr == NULL || bdr == NULL)
+ if (dr == NULL)
dr = nbr;
else
dr = if_elect(dr, nbr);
@@ -467,6 +472,14 @@ start:
(iface->self != dr && iface->self == iface->dr) ||
(iface->self == bdr && iface->self != iface->bdr) ||
(iface->self != bdr && iface->self == iface->bdr))) {
+ /*
+ * Reset announced DR/DBR to calculated one, so
+ * that we may get elected in the second round.
+ * This is needed to drop from a DR to a BDR.
+ */
+ iface->self->dr.s_addr = dr->addr.s_addr;
+ if (bdr)
+ iface->self->bdr.s_addr = dr->addr.s_addr;
log_debug("if_act_elect: round two");
round = 1;
goto start;