diff options
author | ume <ume@FreeBSD.org> | 2002-06-13 16:59:31 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2002-06-13 16:59:31 +0000 |
commit | a748c142252522c9e5c2e11945e8245cc9871e46 (patch) | |
tree | 7d4549a8306821ec107a61d4cbb9e7353e39fc92 /usr.sbin/rtadvd/timer.c | |
parent | 041d0fbbd905c0e30b4155f0bbdfbafd459b50d8 (diff) | |
download | FreeBSD-src-a748c142252522c9e5c2e11945e8245cc9871e46.zip FreeBSD-src-a748c142252522c9e5c2e11945e8245cc9871e46.tar.gz |
Changed the behavior when an interface-direct prefix being advertised
was removed from the kernel;
Advertise the prefix with zero lifetimes rather than to remove the prefix
from the prefix list to be advertised.
This will help renumber a receiving host by deprecating the address
derived from the old prefix.
Obtained from: KAME
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/rtadvd/timer.c')
-rw-r--r-- | usr.sbin/rtadvd/timer.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/usr.sbin/rtadvd/timer.c b/usr.sbin/rtadvd/timer.c index 439cbb2..646b5ee 100644 --- a/usr.sbin/rtadvd/timer.c +++ b/usr.sbin/rtadvd/timer.c @@ -59,9 +59,9 @@ rtadvd_timer_init() } struct rtadvd_timer * -rtadvd_add_timer(void (*timeout) __P((void *)), - void (*update) __P((void *, struct timeval *)), - void *timeodata, void *updatedata) +rtadvd_add_timer(struct rtadvd_timer *(*timeout) __P((void *)), + void (*update) __P((void *, struct timeval *)), + void *timeodata, void *updatedata) { struct rtadvd_timer *newtimer; @@ -78,11 +78,6 @@ rtadvd_add_timer(void (*timeout) __P((void *)), "<%s> timeout function unspecfied", __FUNCTION__); exit(1); } - if (update == NULL) { - syslog(LOG_ERR, - "<%s> update function unspecfied", __FUNCTION__); - exit(1); - } newtimer->expire = timeout; newtimer->update = update; newtimer->expire_data = timeodata; @@ -121,7 +116,7 @@ rtadvd_set_timer(struct timeval *tm, struct rtadvd_timer *timer) } /* - * Check expiration for each timer. If a timer is expired, + * Check expiration for each timer. If a timer expires, * call the expire function for the timer and update the timer. * Return the next interval for select() call. */ @@ -130,23 +125,25 @@ rtadvd_check_timer() { static struct timeval returnval; struct timeval now; - struct rtadvd_timer *tm = timer_head.next; + struct rtadvd_timer *tm = timer_head.next, *tm_next; gettimeofday(&now, NULL); timer_head.tm = tm_max; - while(tm != &timer_head) { + for (tm = timer_head.next; tm != &timer_head; tm = tm_next) { + tm_next = tm->next; + if (TIMEVAL_LEQ(tm->tm, now)) { - (*tm->expire)(tm->expire_data); - (*tm->update)(tm->update_data, &tm->tm); + if (((*tm->expire)(tm->expire_data) == NULL)) + continue; /* the timer was removed */ + if (tm->update) + (*tm->update)(tm->update_data, &tm->tm); TIMEVAL_ADD(&tm->tm, &now, &tm->tm); } if (TIMEVAL_LT(tm->tm, timer_head.tm)) timer_head.tm = tm->tm; - - tm = tm->next; } if (TIMEVAL_EQUAL(&tm_max, &timer_head.tm)) { |