diff options
author | Michele Marchetto <michele@cvs.openbsd.org> | 2009-01-27 08:53:48 +0000 |
---|---|---|
committer | Michele Marchetto <michele@cvs.openbsd.org> | 2009-01-27 08:53:48 +0000 |
commit | d04fc03bc9900852eb4b3e5bbc797baecab62f9b (patch) | |
tree | b02a2c420725755993032c5668a858f1c77ad41e /usr.sbin | |
parent | 7e1b3709ca7cd732f4818d07636e237b8e2b35d6 (diff) |
Get rid of the 24h timer as it useless here.
While there fix minor bugs.
ok norby@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dvmrpd/dvmrp.h | 5 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/neighbor.c | 29 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/rde.c | 7 |
3 files changed, 9 insertions, 32 deletions
diff --git a/usr.sbin/dvmrpd/dvmrp.h b/usr.sbin/dvmrpd/dvmrp.h index cc8e264df2c..b043e30644e 100644 --- a/usr.sbin/dvmrpd/dvmrp.h +++ b/usr.sbin/dvmrpd/dvmrp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrp.h,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: dvmrp.h,v 1.2 2009/01/27 08:53:47 michele Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -35,9 +35,6 @@ #define PRUNE_RETRANS_TIME 3 /* with exp. back off */ #define GRAFT_RETRANS_TIME 5 /* with exp. back off */ -#define DEFAULT_NBR_TMOUT 86400 /* 24 hours */ - /* remove neighbor completely */ - #define DEFAULT_CACHE_LIFETIME 300 #define DEFAULT_METRIC 1 diff --git a/usr.sbin/dvmrpd/neighbor.c b/usr.sbin/dvmrpd/neighbor.c index c92f67c48c7..e5ae5ccab18 100644 --- a/usr.sbin/dvmrpd/neighbor.c +++ b/usr.sbin/dvmrpd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.4 2008/12/02 13:42:44 michele Exp $ */ +/* $OpenBSD: neighbor.c,v 1.5 2009/01/27 08:53:47 michele Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -63,7 +63,6 @@ struct { {NBR_STA_1_WAY, NBR_EVT_2_WAY_RCVD, NBR_ACT_STRT_ITIMER, NBR_STA_2_WAY}, {NBR_STA_ACTIVE, NBR_EVT_1_WAY_RCVD, NBR_ACT_RESET, NBR_STA_1_WAY}, {NBR_STA_ANY, NBR_EVT_KILL_NBR, NBR_ACT_DEL, NBR_STA_DOWN}, - {NBR_STA_ANY, NBR_EVT_LL_DOWN, NBR_ACT_DEL, NBR_STA_DOWN}, {NBR_STA_ANY, NBR_EVT_ITIMER, NBR_ACT_DEL, NBR_STA_DOWN}, {-1, NBR_EVT_NOTHING, NBR_ACT_NOTHING, 0}, }; @@ -227,9 +226,6 @@ nbr_new(u_int32_t nbr_id, struct iface *iface, int self) int nbr_del(struct nbr *nbr) { - log_debug("nbr_del: neighbor ID %s, peerid %lu", inet_ntoa(nbr->id), - nbr->peerid); - dvmrpe_imsg_compose_rde(IMSG_NEIGHBOR_DOWN, nbr->peerid, 0, NULL, 0); /* clear lists */ @@ -281,10 +277,7 @@ nbr_itimer(int fd, short event, void *arg) log_debug("nbr_itimer: %s", inet_ntoa(nbr->id)); - if (nbr->state == NBR_STA_DOWN) { - nbr_del(nbr); - } else - nbr_fsm(nbr, NBR_EVT_ITIMER); + nbr_fsm(nbr, NBR_EVT_ITIMER); } int @@ -363,8 +356,6 @@ nbr_act_start_itimer(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 */ @@ -374,16 +365,7 @@ nbr_act_delete(struct nbr *nbr) return (-1); } - /* 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)); + return (nbr_del(nbr)); } int @@ -423,10 +405,7 @@ nbr_to_ctl(struct nbr *nbr) gettimeofday(&now, NULL); if (evtimer_pending(&nbr->inactivity_timer, &tv)) { timersub(&tv, &now, &res); - if (nbr->state & NBR_STA_DOWN) - nctl.dead_timer = DEFAULT_NBR_TMOUT - res.tv_sec; - else - nctl.dead_timer = res.tv_sec; + nctl.dead_timer = res.tv_sec; } else nctl.dead_timer = 0; diff --git a/usr.sbin/dvmrpd/rde.c b/usr.sbin/dvmrpd/rde.c index 578b9706f5c..4492e3e14c1 100644 --- a/usr.sbin/dvmrpd/rde.c +++ b/usr.sbin/dvmrpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.9 2009/01/24 16:25:47 michele Exp $ */ +/* $OpenBSD: rde.c,v 1.10 2009/01/27 08:53:47 michele Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -165,6 +165,7 @@ rde_shutdown(void) LIST_FOREACH(iface, &rdeconf->iface_list, entry) { if_del(iface); } + rde_nbr_free(); msgbuf_clear(&ibuf_dvmrpe->w); free(ibuf_dvmrpe); @@ -281,13 +282,13 @@ rde_dispatch_imsg(int fd, short event, void *bula) fatalx("invalid size of OE request"); memcpy(&rn, imsg.data, sizeof(rn)); - if (rde_nbr_find(imsg.hdr.peerid)) + if (rde_nbr_new(imsg.hdr.peerid, &rn) == NULL) fatalx("rde_rispatch_imsg: " "neighbor already exists"); - rde_nbr_new(imsg.hdr.peerid, &rn); break; case IMSG_NEIGHBOR_DOWN: rde_nbr_del(rde_nbr_find(imsg.hdr.peerid)); + break; default: log_debug("rde_dispatch_msg: unexpected imsg %d", |