summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/ospfe.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-07-25 19:11:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-07-25 19:11:28 +0000
commitf87c0abacee8e961fce6f6fab542f60d5d614025 (patch)
tree0d031c2abc7d7876ea317043f2e668cfe90edd5e /usr.sbin/ospfd/ospfe.c
parentd417b66f59a15a5aea30d31a19cd577ae3cde834 (diff)
Don't fatal if the imsg pipe is closed, this is often triggered in the parent
and hides the real cause of the termination. OK norby@, reyk@, pyr@
Diffstat (limited to 'usr.sbin/ospfd/ospfe.c')
-rw-r--r--usr.sbin/ospfd/ospfe.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 8e831593dcd..ceaca7984bb 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.56 2007/06/19 14:42:09 pyr Exp $ */
+/* $OpenBSD: ospfe.c,v 1.57 2007/07/25 19:11:27 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -257,14 +257,14 @@ ospfe_dispatch_main(int fd, short event, void *bula)
struct iface *iface = NULL;
struct kif *kif;
struct auth_md md;
- int n, link_ok, stub_changed;
+ int n, link_ok, stub_changed, shut = 0;
switch (event) {
case EV_READ:
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0) /* connection closed */
- fatalx("pipe closed");
+ shut = 1;
break;
case EV_WRITE:
if (msgbuf_write(&ibuf->w) == -1)
@@ -378,7 +378,13 @@ ospfe_dispatch_main(int fd, short event, void *bula)
}
imsg_free(&imsg);
}
- imsg_event_add(ibuf);
+ if (!shut)
+ imsg_event_add(ibuf);
+ else {
+ /* this pipe is dead, so remove the event handler */
+ event_del(&ibuf->ev);
+ event_loopexit(NULL);
+ }
}
/* ARGSUSED */
@@ -395,7 +401,7 @@ ospfe_dispatch_rde(int fd, short event, void *bula)
struct lsa_entry *le;
struct imsg imsg;
struct abr_rtr ar;
- int n, noack = 0;
+ int n, noack = 0, shut = 0;
u_int16_t l, age;
switch (event) {
@@ -403,7 +409,7 @@ ospfe_dispatch_rde(int fd, short event, void *bula)
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0) /* connection closed */
- fatalx("pipe closed");
+ shut = 1;
break;
case EV_WRITE:
if (msgbuf_write(&ibuf->w) == -1)
@@ -641,7 +647,13 @@ ospfe_dispatch_rde(int fd, short event, void *bula)
}
imsg_free(&imsg);
}
- imsg_event_add(ibuf);
+ if (!shut)
+ imsg_event_add(ibuf);
+ else {
+ /* this pipe is dead, so remove the event handler */
+ event_del(&ibuf->ev);
+ event_loopexit(NULL);
+ }
}
struct iface *