summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsben Norby <norby@cvs.openbsd.org>2005-02-01 21:15:41 +0000
committerEsben Norby <norby@cvs.openbsd.org>2005-02-01 21:15:41 +0000
commitfbfc7897c23382d51bf9270c5986ea78fc80b41e (patch)
tree5900d73f7c0e2341b8af4d9e971bb75813b47911
parente9d4fd79f6d6e5ced20c93dad5cbf733075d4ea6 (diff)
Free neighbors that have been inactive for 24hrs.
OK claudio@
-rw-r--r--usr.sbin/ospfd/neighbor.c18
-rw-r--r--usr.sbin/ospfd/ospf.h4
2 files changed, 19 insertions, 3 deletions
diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c
index 46a2b33fb93..774f8c2c7e8 100644
--- a/usr.sbin/ospfd/neighbor.c
+++ b/usr.sbin/ospfd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.2 2005/01/28 17:53:33 norby Exp $ */
+/* $OpenBSD: neighbor.c,v 1.3 2005/02/01 21:15:40 norby Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -355,7 +355,10 @@ nbr_itimer(int fd, short event, void *arg)
log_debug("nbr_itimer: %s", inet_ntoa(nbr->id));
- nbr_fsm(nbr, NBR_EVT_ITIMER);
+ if (nbr->state == NBR_STA_DOWN) {
+ nbr_del(nbr);
+ } else
+ nbr_fsm(nbr, NBR_EVT_ITIMER);
}
int
@@ -553,6 +556,8 @@ nbr_act_restart_dd(struct nbr *nbr)
int
nbr_act_delete(struct nbr *nbr)
{
+ struct timeval tv;
+
log_debug("nbr_act_delete: neighbor ID %s", inet_ntoa(nbr->id));
/* stop timers */
@@ -566,6 +571,15 @@ nbr_act_delete(struct nbr *nbr)
nbr->dr.s_addr = 0;
nbr->bdr.s_addr = 0;
+ /* schedule kill timer */
+ timerclear(&tv);
+ tv.tv_sec = DEFAULT_NBR_TMOUT;
+
+ if (evtimer_add(&nbr->inactivity_timer, &tv)) {
+ log_warnx("nbr_act_delete: error scheduling neighbor ID %s "
+ "for removal", inet_ntoa(nbr->id));
+ }
+
return (nbr_act_clear_lists(nbr));
}
diff --git a/usr.sbin/ospfd/ospf.h b/usr.sbin/ospfd/ospf.h
index 29be106d629..8b8f4ee77a1 100644
--- a/usr.sbin/ospfd/ospf.h
+++ b/usr.sbin/ospfd/ospf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf.h,v 1.2 2005/01/28 17:53:33 norby Exp $ */
+/* $OpenBSD: ospf.h,v 1.3 2005/02/01 21:15:40 norby Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -58,6 +58,8 @@
#define DEFAULT_ADJ_TMOUT 60 /* XXX sane value? */
+#define DEFAULT_NBR_TMOUT 86400 /* 24 hours */
+
/* OSPF compatibility flags */
#define OSPF_OPTION_E 0x02
#define OSPF_OPTION_MC 0x04