summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-07-04 04:08:35 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-07-04 04:08:35 +0000
commit60cf1b87bd82e8898e79d8188c4d7b8f06f3ee98 (patch)
tree82bd4c62268bffa9f427ee8f08c7d1627f092ad2 /usr.sbin
parentf97b26dfb6b44d8475f6b1bdaa26273f61157388 (diff)
Make sure that passive interfaces (like carp) are added to the
intra-area rtr LSA. Diff initialy made by Patrick Coleman but simplified by myself. Tested and OK dlg@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/interface.c10
-rw-r--r--usr.sbin/ospf6d/rde.c32
2 files changed, 32 insertions, 10 deletions
diff --git a/usr.sbin/ospf6d/interface.c b/usr.sbin/ospf6d/interface.c
index 0d085a15288..6779b962c65 100644
--- a/usr.sbin/ospf6d/interface.c
+++ b/usr.sbin/ospf6d/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.16 2011/05/06 13:48:46 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.17 2011/07/04 04:08:34 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -145,11 +145,11 @@ if_fsm(struct iface *iface, enum iface_event event)
if (iface->state != old_state) {
orig_rtr_lsa(iface);
orig_link_lsa(iface);
-
- /* state change inform RDE */
- ospfe_imsg_compose_rde(IMSG_IFINFO,
- iface->self->peerid, 0, iface, sizeof(struct iface));
}
+
+ /* Inform RDE in any case since the link state may have changed */
+ ospfe_imsg_compose_rde(IMSG_IFINFO,
+ iface->self->peerid, 0, iface, sizeof(struct iface));
if (old_state & (IF_STA_MULTI | IF_STA_POINTTOPOINT) &&
(iface->state & (IF_STA_MULTI | IF_STA_POINTTOPOINT)) == 0)
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c
index a1ed18c72fe..fae779a83fa 100644
--- a/usr.sbin/ospf6d/rde.c
+++ b/usr.sbin/ospf6d/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.52 2011/05/05 15:58:02 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.53 2011/07/04 04:08:34 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/queue.h>
+#include <net/if_types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <err.h>
@@ -585,11 +586,20 @@ rde_dispatch_imsg(int fd, short event, void *bula)
iface = if_find(ifp->ifindex);
if (iface == NULL)
fatalx("interface lost in rde");
- iface->flags = ifp->flags;
- iface->linkstate = ifp->linkstate;
iface->nh_reachable = ifp->nh_reachable;
- if (iface->state != ifp->state) {
+
+ /*
+ * Resend LSAs if interface flags change -
+ * carp/passive interfaces can come up and down
+ * without changing OSPF state.
+ */
+ if ((iface->state != ifp->state) ||
+ (iface->linkstate != ifp->linkstate) ||
+ (iface->flags != ifp->flags)) {
iface->state = ifp->state;
+ iface->flags = ifp->flags;
+ iface->linkstate = ifp->linkstate;
+
area = area_find(rdeconf, iface->area_id);
if (!area)
fatalx("interface lost area");
@@ -1457,8 +1467,20 @@ orig_intra_lsa_rtr(struct area *area, struct vertex *old)
numprefix = 0;
LIST_FOREACH(iface, &area->iface_list, entry) {
- if (iface->state & IF_STA_DOWN)
+ if (!((iface->flags & IFF_UP) &&
+ (LINK_STATE_IS_UP(iface->linkstate) ||
+ (iface->linkstate == LINK_STATE_UNKNOWN &&
+ iface->media_type != IFT_CARP))))
+ /* interface or link state down */
continue;
+ if ((iface->state & IF_STA_DOWN) &&
+ !(iface->cflags & F_IFACE_PASSIVE))
+ /* passive interfaces stay in state DOWN */
+ continue;
+
+ log_debug("orig_intra_lsa_rtr: area %s, interface %s: "
+ "including in intra-area-prefix LSA",
+ inet_ntoa(area->id), iface->name);
/* Broadcast links with adjacencies are handled
* by orig_intra_lsa_net(), ignore. */