summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ospfd/database.c20
-rw-r--r--usr.sbin/ospfd/interface.c79
-rw-r--r--usr.sbin/ospfd/lsack.c26
-rw-r--r--usr.sbin/ospfd/lsreq.c20
-rw-r--r--usr.sbin/ospfd/lsupdate.c11
-rw-r--r--usr.sbin/ospfd/neighbor.c65
-rw-r--r--usr.sbin/ospfd/ospfe.h22
-rw-r--r--usr.sbin/ospfd/rde.h8
-rw-r--r--usr.sbin/ospfd/rde_lsdb.c11
-rw-r--r--usr.sbin/ospfd/rde_spf.c24
10 files changed, 128 insertions, 158 deletions
diff --git a/usr.sbin/ospfd/database.c b/usr.sbin/ospfd/database.c
index 24fed999a7b..0610c84da58 100644
--- a/usr.sbin/ospfd/database.c
+++ b/usr.sbin/ospfd/database.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: database.c,v 1.18 2006/03/09 13:34:19 claudio Exp $ */
+/* $OpenBSD: database.c,v 1.19 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -393,28 +393,30 @@ db_tx_timer(int fd, short event, void *arg)
if (nbr->master) {
timerclear(&tv);
tv.tv_sec = nbr->iface->rxmt_interval;
- evtimer_add(&nbr->db_tx_timer, &tv);
+ if (evtimer_add(&nbr->db_tx_timer, &tv) == -1)
+ fatal("db_tx_timer");
}
}
-int
+void
start_db_tx_timer(struct nbr *nbr)
{
struct timeval tv;
if (nbr == nbr->iface->self)
- return (0);
+ return;
timerclear(&tv);
-
- return (evtimer_add(&nbr->db_tx_timer, &tv));
+ if (evtimer_add(&nbr->db_tx_timer, &tv) == -1)
+ fatal("start_db_tx_timer");
}
-int
+void
stop_db_tx_timer(struct nbr *nbr)
{
if (nbr == nbr->iface->self)
- return (0);
+ return;
- return (evtimer_del(&nbr->db_tx_timer));
+ if (evtimer_del(&nbr->db_tx_timer) == -1)
+ fatal("stop_db_tx_timer");
}
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index 7060c7d21ae..843ef25bf42 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.46 2006/03/09 18:11:34 norby Exp $ */
+/* $OpenBSD: interface.c,v 1.47 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -39,12 +39,12 @@
#include "ospfe.h"
void if_hello_timer(int, short, void *);
-int if_start_hello_timer(struct iface *);
-int if_stop_hello_timer(struct iface *);
-int if_stop_wait_timer(struct iface *);
+void if_start_hello_timer(struct iface *);
+void if_stop_hello_timer(struct iface *);
+void if_stop_wait_timer(struct iface *);
void if_wait_timer(int, short, void *);
-int if_start_wait_timer(struct iface *);
-int if_stop_wait_timer(struct iface *);
+void if_start_wait_timer(struct iface *);
+void if_stop_wait_timer(struct iface *);
struct nbr *if_elect(struct nbr *, struct nbr *);
struct {
@@ -273,22 +273,25 @@ if_hello_timer(int fd, short event, void *arg)
/* reschedule hello_timer */
timerclear(&tv);
tv.tv_sec = iface->hello_interval;
- evtimer_add(&iface->hello_timer, &tv);
+ if (evtimer_add(&iface->hello_timer, &tv) == -1)
+ fatal("if_hello_timer");
}
-int
+void
if_start_hello_timer(struct iface *iface)
{
struct timeval tv;
timerclear(&tv);
- return (evtimer_add(&iface->hello_timer, &tv));
+ if (evtimer_add(&iface->hello_timer, &tv) == -1)
+ fatal("if_start_hello_timer");
}
-int
+void
if_stop_hello_timer(struct iface *iface)
{
- return (evtimer_del(&iface->hello_timer));
+ if (evtimer_del(&iface->hello_timer) == -1)
+ fatal("if_stop_hello_timer");
}
/* ARGSUSED */
@@ -300,20 +303,22 @@ if_wait_timer(int fd, short event, void *arg)
if_fsm(iface, IF_EVT_WTIMER);
}
-int
+void
if_start_wait_timer(struct iface *iface)
{
struct timeval tv;
timerclear(&tv);
tv.tv_sec = iface->dead_interval;
- return (evtimer_add(&iface->wait_timer, &tv));
+ if (evtimer_add(&iface->wait_timer, &tv) == -1)
+ fatal("if_start_wait_timer");
}
-int
+void
if_stop_wait_timer(struct iface *iface)
{
- return (evtimer_del(&iface->wait_timer));
+ if (evtimer_del(&iface->wait_timer) == -1)
+ fatal("if_stop_wait_timer");
}
/* actions */
@@ -357,15 +362,9 @@ if_act_start(struct iface *iface)
return (-1);
}
iface->state = IF_STA_POINTTOPOINT;
- if (if_start_hello_timer(iface))
- log_warnx("if_act_start: cannot schedule hello "
- "timer, interface %s", iface->name);
break;
case IF_TYPE_VIRTUALLINK:
iface->state = IF_STA_POINTTOPOINT;
- if (if_start_hello_timer(iface))
- log_warnx("if_act_start: cannot schedule hello "
- "timer, interface %s", iface->name);
break;
case IF_TYPE_POINTOMULTIPOINT:
case IF_TYPE_NBMA:
@@ -381,23 +380,17 @@ if_act_start(struct iface *iface)
}
if (iface->priority == 0) {
iface->state = IF_STA_DROTHER;
- if (if_start_hello_timer(iface))
- log_warnx("if_act_start: cannot schedule hello "
- "timer, interface %s", iface->name);
} else {
iface->state = IF_STA_WAITING;
- if (if_start_hello_timer(iface))
- log_warnx("if_act_start: cannot schedule hello "
- "timer, interface %s", iface->name);
- if (if_start_wait_timer(iface))
- log_warnx("if_act_start: cannot schedule wait "
- "timer, interface %s", iface->name);
+ if_start_wait_timer(iface);
}
break;
default:
fatalx("if_act_start: unknown interface type");
}
+ /* hello timer needs to be started in any case */
+ if_start_hello_timer(iface);
return (0);
}
@@ -547,11 +540,7 @@ start:
orig_net_lsa(iface);
}
- if (if_start_hello_timer(iface)) {
- log_warnx("if_act_elect: cannot schedule hello_timer");
- return (-1);
- }
-
+ if_start_hello_timer(iface);
return (0);
}
@@ -599,23 +588,9 @@ if_act_reset(struct iface *iface)
iface->bdr = NULL;
ls_ack_list_clr(iface);
- if (stop_ls_ack_tx_timer(iface)) {
- log_warnx("if_act_reset: error removing ls_ack_tx_timer, "
- "interface %s", iface->name);
- return (-1);
- }
-
- if (if_stop_hello_timer(iface)) {
- log_warnx("if_act_reset: error removing hello_timer, "
- "interface %s", iface->name);
- return (-1);
- }
-
- if (if_stop_wait_timer(iface)) {
- log_warnx("if_act_reset: error removing wait_timer, "
- "interface %s", iface->name);
- return (-1);
- }
+ stop_ls_ack_tx_timer(iface);
+ if_stop_hello_timer(iface);
+ if_stop_wait_timer(iface);
return (0);
}
diff --git a/usr.sbin/ospfd/lsack.c b/usr.sbin/ospfd/lsack.c
index 11bfceb831a..2a71bb356e0 100644
--- a/usr.sbin/ospfd/lsack.c
+++ b/usr.sbin/ospfd/lsack.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsack.c,v 1.15 2005/11/12 18:18:24 deraadt Exp $ */
+/* $OpenBSD: lsack.c,v 1.16 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -31,7 +31,7 @@
#include "log.h"
#include "ospfe.h"
-int start_ls_ack_tx_timer_now(struct iface *);
+void start_ls_ack_tx_timer_now(struct iface *);
/* link state acknowledgement packet handling */
int
@@ -96,9 +96,9 @@ recv_ls_ack(struct nbr *nbr, char *buf, u_int16_t len)
if (lsa_hdr_check(nbr, &lsa_hdr)) {
/* try both list in case of DROTHER */
if (nbr->iface->state & IF_STA_DROTHER)
- ls_retrans_list_del(nbr->iface->self,
- &lsa_hdr);
- ls_retrans_list_del(nbr, &lsa_hdr);
+ (void)ls_retrans_list_del(
+ nbr->iface->self, &lsa_hdr);
+ (void)ls_retrans_list_del(nbr, &lsa_hdr);
}
buf += sizeof(lsa_hdr);
@@ -265,7 +265,7 @@ ls_ack_tx_timer(int fd, short event, void *arg)
free(buf);
}
-int
+void
start_ls_ack_tx_timer(struct iface *iface)
{
struct timeval tv;
@@ -273,21 +273,23 @@ start_ls_ack_tx_timer(struct iface *iface)
timerclear(&tv);
tv.tv_sec = iface->rxmt_interval / 2;
- return (evtimer_add(&iface->lsack_tx_timer, &tv));
+ if (evtimer_add(&iface->lsack_tx_timer, &tv) == -1)
+ fatal("start_ls_ack_tx_timer");
}
-int
+void
start_ls_ack_tx_timer_now(struct iface *iface)
{
struct timeval tv;
timerclear(&tv);
-
- return (evtimer_add(&iface->lsack_tx_timer, &tv));
+ if (evtimer_add(&iface->lsack_tx_timer, &tv) == -1)
+ fatal("start_ls_ack_tx_timer_now");
}
-int
+void
stop_ls_ack_tx_timer(struct iface *iface)
{
- return (evtimer_del(&iface->lsack_tx_timer));
+ if (evtimer_del(&iface->lsack_tx_timer) == -1)
+ fatal("stop_ls_ack_tx_timer");
}
diff --git a/usr.sbin/ospfd/lsreq.c b/usr.sbin/ospfd/lsreq.c
index 5f55e5f98c2..99df7da5272 100644
--- a/usr.sbin/ospfd/lsreq.c
+++ b/usr.sbin/ospfd/lsreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsreq.c,v 1.13 2006/03/09 13:34:19 claudio Exp $ */
+/* $OpenBSD: lsreq.c,v 1.14 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -220,28 +220,30 @@ ls_req_tx_timer(int fd, short event, void *arg)
if (nbr->state == NBR_STA_LOAD) {
timerclear(&tv);
tv.tv_sec = nbr->iface->rxmt_interval;
- evtimer_add(&nbr->lsreq_tx_timer, &tv);
+ if (evtimer_add(&nbr->lsreq_tx_timer, &tv) == -1)
+ fatal("ls_req_tx_timer");
}
}
-int
+void
start_ls_req_tx_timer(struct nbr *nbr)
{
struct timeval tv;
if (nbr == nbr->iface->self)
- return (0);
+ return;
timerclear(&tv);
-
- return (evtimer_add(&nbr->lsreq_tx_timer, &tv));
+ if (evtimer_add(&nbr->lsreq_tx_timer, &tv) == -1)
+ fatal("start_ls_req_tx_timer");
}
-int
+void
stop_ls_req_tx_timer(struct nbr *nbr)
{
if (nbr == nbr->iface->self)
- return (0);
+ return;
- return (evtimer_del(&nbr->lsreq_tx_timer));
+ if (evtimer_del(&nbr->lsreq_tx_timer) == -1)
+ fatal("stop_ls_req_tx_timer");
}
diff --git a/usr.sbin/ospfd/lsupdate.c b/usr.sbin/ospfd/lsupdate.c
index ce54f431aa6..f1e5b23f3d2 100644
--- a/usr.sbin/ospfd/lsupdate.c
+++ b/usr.sbin/ospfd/lsupdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsupdate.c,v 1.28 2006/03/08 15:35:07 claudio Exp $ */
+/* $OpenBSD: lsupdate.c,v 1.29 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -311,7 +311,7 @@ ls_retrans_list_add(struct nbr *nbr, struct lsa_hdr *lsa,
tv.tv_sec = TAILQ_FIRST(&nbr->ls_retrans_list)->le_when;
if (evtimer_add(&nbr->ls_retrans_timer, &tv) == -1)
- log_warn("ls_retrans_list_add: evtimer_add failed");
+ fatal("ls_retrans_list_add");
}
}
@@ -387,13 +387,14 @@ ls_retrans_list_remove(struct nbr *nbr, struct lsa_entry *le)
nbr->ls_ret_cnt--;
if (reset && TAILQ_FIRST(&nbr->ls_retrans_list)) {
- evtimer_del(&nbr->ls_retrans_timer);
+ if (evtimer_del(&nbr->ls_retrans_timer) == -1)
+ fatal("ls_retrans_list_remove");
timerclear(&tv);
tv.tv_sec = TAILQ_FIRST(&nbr->ls_retrans_list)->le_when;
if (evtimer_add(&nbr->ls_retrans_timer, &tv) == -1)
- log_warn("ls_retrans_timer: evtimer_add failed");
+ fatal("ls_retrans_list_remove");
}
}
@@ -501,7 +502,7 @@ done:
tv.tv_sec = le->le_when;
if (evtimer_add(&nbr->ls_retrans_timer, &tv) == -1)
- log_warn("ls_retrans_timer: evtimer_add failed");
+ fatal("ls_retrans_timer");
}
}
diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c
index e19c521124e..e2c4d639a34 100644
--- a/usr.sbin/ospfd/neighbor.c
+++ b/usr.sbin/ospfd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.31 2006/03/09 15:43:21 claudio Exp $ */
+/* $OpenBSD: neighbor.c,v 1.32 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -358,27 +358,27 @@ nbr_find_id(struct iface *iface, u_int32_t rtr_id)
struct nbr *nbr = NULL;
LIST_FOREACH(nbr, &iface->nbr_list, entry) {
- if (nbr->id.s_addr == rtr_id) {
+ if (nbr->id.s_addr == rtr_id)
return (nbr);
- }
}
return (NULL);
}
/* timers */
+/* ARGSUSED */
void
nbr_itimer(int fd, short event, void *arg)
{
struct nbr *nbr = arg;
- if (nbr->state == NBR_STA_DOWN) {
+ if (nbr->state == NBR_STA_DOWN)
nbr_del(nbr);
- } else
+ else
nbr_fsm(nbr, NBR_EVT_ITIMER);
}
-int
+void
nbr_start_itimer(struct nbr *nbr)
{
struct timeval tv;
@@ -386,16 +386,18 @@ nbr_start_itimer(struct nbr *nbr)
timerclear(&tv);
tv.tv_sec = nbr->iface->dead_interval;
- return (evtimer_add(&nbr->inactivity_timer, &tv));
+ if (evtimer_add(&nbr->inactivity_timer, &tv) == -1)
+ fatal("nbr_start_itimer");
}
-int
+void
nbr_stop_itimer(struct nbr *nbr)
{
- return (evtimer_del(&nbr->inactivity_timer));
+ if (evtimer_del(&nbr->inactivity_timer) == -1)
+ fatal("nbr_stop_itimer");
}
-int
+void
nbr_reset_itimer(struct nbr *nbr)
{
struct timeval tv;
@@ -403,9 +405,11 @@ nbr_reset_itimer(struct nbr *nbr)
timerclear(&tv);
tv.tv_sec = nbr->iface->dead_interval;
- return (evtimer_add(&nbr->inactivity_timer, &tv));
+ if (evtimer_add(&nbr->inactivity_timer, &tv) == -1)
+ fatal("nbr_reset_itimer");
}
+/* ARGSUSED */
void
nbr_adj_timer(int fd, short event, void *arg)
{
@@ -421,7 +425,7 @@ nbr_adj_timer(int fd, short event, void *arg)
}
}
-int
+void
nbr_start_adj_timer(struct nbr *nbr)
{
struct timeval tv;
@@ -429,18 +433,15 @@ nbr_start_adj_timer(struct nbr *nbr)
timerclear(&tv);
tv.tv_sec = DEFAULT_ADJ_TMOUT;
- return (evtimer_add(&nbr->adj_timer, &tv));
+ if (evtimer_add(&nbr->adj_timer, &tv) == -1)
+ fatal("nbr_start_adj_timer");
}
/* actions */
int
nbr_act_reset_itimer(struct nbr *nbr)
{
- if (nbr_reset_itimer(nbr)) {
- log_warnx("nbr_act_reset_itimer: cannot schedule inactivity "
- "timer, neighbor ID %s", inet_ntoa(nbr->id));
- return (-1);
- }
+ nbr_reset_itimer(nbr);
return (0);
}
@@ -448,12 +449,7 @@ nbr_act_reset_itimer(struct nbr *nbr)
int
nbr_act_start_itimer(struct nbr *nbr)
{
- if (nbr_start_itimer(nbr)) {
- log_warnx("nbr_act_start_itimer: cannot schedule inactivity "
- "timer, neighbor ID %s",
- inet_ntoa(nbr->id));
- return (-1);
- }
+ nbr_start_itimer(nbr);
return (0);
}
@@ -581,16 +577,11 @@ nbr_act_delete(struct nbr *nbr)
return (0);
/* stop timers */
- if (nbr_stop_itimer(nbr)) {
- log_warnx("nbr_act_delete: error removing inactivity timer, "
- "neighbor ID %s", inet_ntoa(nbr->id));
- return (-1);
- }
+ nbr_stop_itimer(nbr);
/* clear dr and bdr */
nbr->dr.s_addr = 0;
nbr->bdr.s_addr = 0;
-
nbr->crypt_seq_num = 0;
/* schedule kill timer */
@@ -608,17 +599,9 @@ nbr_act_delete(struct nbr *nbr)
int
nbr_act_clear_lists(struct nbr *nbr)
{
- if (stop_db_tx_timer(nbr)) {
- log_warnx("nbr_act_clear_lists: error removing db_tx_timer, "
- "neighbor ID %s", inet_ntoa(nbr->id));
- return (-1);
- }
-
- if (stop_ls_req_tx_timer(nbr)) {
- log_warnx("nbr_act_clear_lists: error removing lsreq_tx_timer, "
- "neighbor ID %s", inet_ntoa(nbr->id));
- return (-1);
- }
+ /* stop timers */
+ stop_db_tx_timer(nbr);
+ stop_ls_req_tx_timer(nbr);
/* clear lists */
ls_retrans_list_clr(nbr);
diff --git a/usr.sbin/ospfd/ospfe.h b/usr.sbin/ospfd/ospfe.h
index b61812265b4..96a072506c7 100644
--- a/usr.sbin/ospfd/ospfe.h
+++ b/usr.sbin/ospfd/ospfe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.h,v 1.26 2006/03/09 15:43:21 claudio Exp $ */
+/* $OpenBSD: ospfe.h,v 1.27 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -109,8 +109,8 @@ void db_sum_list_add(struct nbr *, struct lsa_hdr *);
int db_sum_list_del(struct nbr *, struct lsa_hdr *);
void db_sum_list_clr(struct nbr *);
void db_tx_timer(int, short, void *);
-int start_db_tx_timer(struct nbr *);
-int stop_db_tx_timer(struct nbr *);
+void start_db_tx_timer(struct nbr *);
+void stop_db_tx_timer(struct nbr *);
/* hello.c */
int send_hello(struct iface *);
@@ -161,8 +161,8 @@ void ls_ack_list_free(struct iface *, struct lsa_entry *);
void ls_ack_list_clr(struct iface *);
int ls_ack_list_empty(struct iface *);
void ls_ack_tx_timer(int, short, void *);
-int start_ls_ack_tx_timer(struct iface *);
-int stop_ls_ack_tx_timer(struct iface *);
+void start_ls_ack_tx_timer(struct iface *);
+void stop_ls_ack_tx_timer(struct iface *);
/* lsreq.c */
int send_ls_req(struct nbr *);
@@ -174,8 +174,8 @@ void ls_req_list_free(struct nbr *, struct lsa_entry *);
void ls_req_list_clr(struct nbr *);
int ls_req_list_empty(struct nbr *);
void ls_req_tx_timer(int, short, void *);
-int start_ls_req_tx_timer(struct nbr *);
-int stop_ls_req_tx_timer(struct nbr *);
+void start_ls_req_tx_timer(struct nbr *);
+void stop_ls_req_tx_timer(struct nbr *);
/* lsupdate.c */
int lsa_flood(struct iface *, struct nbr *, struct lsa_hdr *,
@@ -207,12 +207,12 @@ struct nbr *nbr_find_peerid(u_int32_t);
int nbr_fsm(struct nbr *, enum nbr_event);
void nbr_itimer(int, short, void *);
-int nbr_start_itimer(struct nbr *);
-int nbr_stop_itimer(struct nbr *);
-int nbr_reset_itimer(struct nbr *);
+void nbr_start_itimer(struct nbr *);
+void nbr_stop_itimer(struct nbr *);
+void nbr_reset_itimer(struct nbr *);
void nbr_adj_timer(int, short, void *);
-int nbr_start_adj_timer(struct nbr *);
+void nbr_start_adj_timer(struct nbr *);
int nbr_act_reset_itimer(struct nbr *);
int nbr_act_start_itimer(struct nbr *);
diff --git a/usr.sbin/ospfd/rde.h b/usr.sbin/ospfd/rde.h
index f5c988dcd5d..4c543cbb958 100644
--- a/usr.sbin/ospfd/rde.h
+++ b/usr.sbin/ospfd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.26 2006/02/24 21:06:47 norby Exp $ */
+/* $OpenBSD: rde.h,v 1.27 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -131,9 +131,9 @@ int cand_list_present(struct vertex *);
void cand_list_clr(void);
void spf_timer(int, short, void *);
-int start_spf_timer(void);
-int stop_spf_timer(struct ospfd_conf *);
-int start_spf_holdtimer(struct ospfd_conf *);
+void start_spf_timer(void);
+void stop_spf_timer(struct ospfd_conf *);
+void start_spf_holdtimer(struct ospfd_conf *);
void rt_init(void);
int rt_compare(struct rt_node *, struct rt_node *);
diff --git a/usr.sbin/ospfd/rde_lsdb.c b/usr.sbin/ospfd/rde_lsdb.c
index 795d126699a..2f91f646d8d 100644
--- a/usr.sbin/ospfd/rde_lsdb.c
+++ b/usr.sbin/ospfd/rde_lsdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_lsdb.c,v 1.28 2006/03/08 15:35:07 claudio Exp $ */
+/* $OpenBSD: rde_lsdb.c,v 1.29 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -94,7 +94,7 @@ vertex_free(struct vertex *v)
if (v == NULL)
return;
- evtimer_del(&v->ev);
+ (void)evtimer_del(&v->ev);
free(v->lsa);
free(v);
}
@@ -545,6 +545,7 @@ lsa_dump(struct lsa_tree *tree, int imsg_type, pid_t pid)
}
}
+/* ARGSUSED */
void
lsa_timeout(int fd, short event, void *bula)
{
@@ -585,7 +586,8 @@ lsa_refresh(struct vertex *v)
timerclear(&tv);
tv.tv_sec = LS_REFRESH_TIME;
- evtimer_add(&v->ev, &tv);
+ if (evtimer_add(&v->ev, &tv) == -1)
+ fatal("lsa_refresh");
}
void
@@ -629,7 +631,8 @@ lsa_merge(struct rde_nbr *nbr, struct lsa *lsa, struct vertex *v)
timerclear(&tv);
if (v->changed + MIN_LS_INTERVAL >= now)
tv.tv_sec = MIN_LS_INTERVAL;
- evtimer_add(&v->ev, &tv);
+ if (evtimer_add(&v->ev, &tv) == -1)
+ fatal("lsa_merge");
}
void
diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c
index 46fd3a83be9..e6d51a11051 100644
--- a/usr.sbin/ospfd/rde_spf.c
+++ b/usr.sbin/ospfd/rde_spf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_spf.c,v 1.49 2006/02/24 21:06:47 norby Exp $ */
+/* $OpenBSD: rde_spf.c,v 1.50 2006/03/13 09:36:06 claudio Exp $ */
/*
* Copyright (c) 2005 Esben Norby <norby@openbsd.org>
@@ -519,6 +519,7 @@ cand_list_clr(void)
}
/* timers */
+/* ARGSUSED */
void
spf_timer(int fd, short event, void *arg)
{
@@ -583,7 +584,7 @@ spf_timer(int fd, short event, void *arg)
}
}
-int
+void
start_spf_timer(void)
{
struct timeval tv;
@@ -594,7 +595,9 @@ start_spf_timer(void)
timerclear(&tv);
tv.tv_sec = rdeconf->spf_delay;
rdeconf->spf_state = SPF_DELAY;
- return (evtimer_add(&rdeconf->ev, &tv));
+ if (evtimer_add(&rdeconf->ev, &tv) == -1)
+ fatal("start_spf_timer");
+ break;
case SPF_DELAY:
/* ignore */
break;
@@ -608,17 +611,16 @@ start_spf_timer(void)
default:
fatalx("start_spf_timer: invalid spf_state");
}
-
- return (1);
}
-int
+void
stop_spf_timer(struct ospfd_conf *conf)
{
- return (evtimer_del(&conf->ev));
+ if (evtimer_del(&conf->ev) == -1)
+ fatal("stop_spf_timer");
}
-int
+void
start_spf_holdtimer(struct ospfd_conf *conf)
{
struct timeval tv;
@@ -629,7 +631,9 @@ start_spf_holdtimer(struct ospfd_conf *conf)
tv.tv_sec = conf->spf_hold_time;
conf->spf_state = SPF_HOLD;
log_debug("spf_start_holdtimer: DELAY -> HOLD");
- return (evtimer_add(&conf->ev, &tv));
+ if (evtimer_add(&conf->ev, &tv) == -1)
+ fatal("start_spf_holdtimer");
+ break;
case SPF_IDLE:
case SPF_HOLD:
case SPF_HOLDQUEUE:
@@ -637,8 +641,6 @@ start_spf_holdtimer(struct ospfd_conf *conf)
default:
fatalx("spf_start_holdtimer: unknown state");
}
-
- return (1);
}
/* route table */