summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/interface.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2005-10-12 09:25:57 +0000
committerclaudio <claudio@openbsd.org>2005-10-12 09:25:57 +0000
commitae00ee2bf03c0d0b9f3e77f115bb5cb3081db5f6 (patch)
treec68a6e27603f1aa2ce3cd7a5220a0416d6c210d3 /usr.sbin/ospfd/interface.c
parentMinor cleanup. Use iface->state & IF_STA_DRORBDR as used in other places (diff)
downloadwireguard-openbsd-ae00ee2bf03c0d0b9f3e77f115bb5cb3081db5f6.tar.xz
wireguard-openbsd-ae00ee2bf03c0d0b9f3e77f115bb5cb3081db5f6.zip
If router is DR or BDR join the AllDRouter list (and leave it if otherwise).
OK norby@
Diffstat (limited to 'usr.sbin/ospfd/interface.c')
-rw-r--r--usr.sbin/ospfd/interface.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index ea89f4564ea..9c021077fc8 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.35 2005/09/28 20:38:31 msf Exp $ */
+/* $OpenBSD: interface.c,v 1.36 2005/10/12 09:25:57 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -411,6 +411,7 @@ if_elect(struct nbr *a, struct nbr *b)
int
if_act_elect(struct iface *iface)
{
+ struct in_addr addr;
struct nbr *nbr, *bdr = NULL, *dr = NULL;
int round = 0;
int changed = 0;
@@ -512,10 +513,30 @@ start:
iface->bdr = bdr;
if (changed) {
+ inet_aton(AllDRouters, &addr);
+ if (old_state & IF_STA_DRORBDR &&
+ (iface->state & IF_STA_DRORBDR) == 0) {
+ if (if_leave_group(iface, &addr)) {
+ log_warnx("if_act_elect: "
+ "error leaving group %s, interface %s",
+ inet_ntoa(addr), iface->name);
+ return (-1);
+ }
+ } else if ((old_state & IF_STA_DRORBDR) == 0 &&
+ iface->state & IF_STA_DRORBDR) {
+ if (if_join_group(iface, &addr)) {
+ log_warnx("if_act_elect: "
+ "error joining group %s, interface %s",
+ inet_ntoa(addr), iface->name);
+ return (-1);
+ }
+ }
+
LIST_FOREACH(nbr, &iface->nbr_list, entry) {
if (nbr->state & NBR_STA_BIDIR)
nbr_fsm(nbr, NBR_EVT_ADJ_OK);
}
+
orig_rtr_lsa(iface->area);
if (iface->state & IF_STA_DR || old_state & IF_STA_DR)
orig_net_lsa(iface);