summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2016-12-22 22:56:53 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2016-12-22 22:56:53 +0000
commitbcb7f6934b9232265a829a3506d46d0278040bfd (patch)
tree6855da895dd4e0c07270aa1990d5185a22ca5e00
parent064b335f9fea15a569e5d86ae7aef78de00e3b0b (diff)
Don't run the FSM if the interface state hasn't changed.
ok benno@ claudio@
-rw-r--r--usr.sbin/ospf6d/ospfe.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c
index 2bed57df8e0..91bf90be4c3 100644
--- a/usr.sbin/ospf6d/ospfe.c
+++ b/usr.sbin/ospf6d/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.49 2016/09/03 10:25:36 renato Exp $ */
+/* $OpenBSD: ospfe.c,v 1.50 2016/12/22 22:56:52 jca Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -260,7 +260,7 @@ ospfe_dispatch_main(int fd, short event, void *bula)
struct imsg imsg;
struct imsgev *iev = bula;
struct imsgbuf *ibuf = &iev->ibuf;
- int n, stub_changed, shut = 0;
+ int n, stub_changed, shut = 0, isvalid, wasvalid;
unsigned int ifindex;
if (event & EV_READ) {
@@ -293,11 +293,19 @@ ospfe_dispatch_main(int fd, short event, void *bula)
if (iface == NULL)
fatalx("interface lost in ospfe");
+ wasvalid = (iface->flags & IFF_UP) &&
+ LINK_STATE_IS_UP(iface->linkstate);
+
if_update(iface, ifp->mtu, ifp->flags, ifp->if_type,
ifp->linkstate, ifp->baudrate);
- if ((iface->flags & IFF_UP) &&
- LINK_STATE_IS_UP(iface->linkstate)) {
+ isvalid = (iface->flags & IFF_UP) &&
+ LINK_STATE_IS_UP(iface->linkstate);
+
+ if (wasvalid == isvalid)
+ break;
+
+ if (isvalid) {
if_fsm(iface, IF_EVT_UP);
log_warnx("interface %s up", iface->name);
} else {