diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-11-01 20:55:41 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-11-01 20:55:41 +0000 |
commit | 314bf6f46dded94031182ce9dc2108e50dec9262 (patch) | |
tree | 2465982c2d9d29088655e382bf3fd18366dd590b /usr.sbin/ripd | |
parent | ad9806335d2e5c5beec50124c11780d676b52fda (diff) |
Stop the running timer in case a neighbor is deleted. This fixes a crash
found by Martin Boehme. ok michele@
Diffstat (limited to 'usr.sbin/ripd')
-rw-r--r-- | usr.sbin/ripd/neighbor.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/usr.sbin/ripd/neighbor.c b/usr.sbin/ripd/neighbor.c index 4dfcf5b3a76..d35cd1d6055 100644 --- a/usr.sbin/ripd/neighbor.c +++ b/usr.sbin/ripd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.2 2006/10/31 23:43:11 michele Exp $ */ +/* $OpenBSD: neighbor.c,v 1.3 2006/11/01 20:55:40 claudio Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -39,8 +39,8 @@ #include "log.h" #include "rde.h" -void nbr_start_timer(struct nbr *); -void nbr_reset_timer(struct nbr *); +void nbr_set_timer(struct nbr *); +void nbr_stop_timer(struct nbr *); LIST_HEAD(nbr_head, nbr); @@ -115,10 +115,10 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event) switch (nbr_fsm_tbl[i].action) { case NBR_ACT_RST_TIMER: - nbr_reset_timer(nbr); + nbr_set_timer(nbr); break; case NBR_ACT_STRT_TIMER: - nbr_start_timer(nbr); + nbr_set_timer(nbr); break; case NBR_ACT_DEL: nbr_act_del(nbr); @@ -222,6 +222,9 @@ nbr_act_del(struct nbr *nbr) log_debug("nbr_del: neighbor ID %s, peerid %lu", inet_ntoa(nbr->id), nbr->peerid); + /* stop timer */ + nbr_stop_timer(nbr); + /* clear lists */ //response_list_clr(&nbr->rr_list); @@ -295,7 +298,7 @@ nbr_timeout_timer(int fd, short event, void *arg) /* actions */ void -nbr_reset_timer(struct nbr *nbr) +nbr_set_timer(struct nbr *nbr) { struct timeval tv; @@ -303,19 +306,14 @@ nbr_reset_timer(struct nbr *nbr) tv.tv_sec = NBR_TIMEOUT; if (evtimer_add(&nbr->timeout_timer, &tv) == -1) - fatal("nbr_reset_timer"); + fatal("nbr_ret_timer"); } void -nbr_start_timer(struct nbr *nbr) +nbr_stop_timer(struct nbr *nbr) { - struct timeval tv; - - timerclear(&tv); - tv.tv_sec = NBR_TIMEOUT; - - if (evtimer_add(&nbr->timeout_timer, &tv) == -1) - fatal("nbr_start_timer"); + if (evtimer_del(&nbr->timeout_timer) == -1) + fatal("nbr_stop_timer"); } /* names */ |