| RT_TIMER(9) | Kernel Developer's Manual | RT_TIMER(9) |
rt_timer,
rt_timer_add,
rt_timer_queue_create,
rt_timer_queue_change,
rt_timer_queue_destroy,
rt_timer_remove_all — route
callout functions
#include
<net/route.h>
struct rttimer_queue *
rt_timer_queue_create(time_t
timeout);
void
rt_timer_queue_change(struct
rttimer_queue *q, time_t
timeout);
void
rt_timer_queue_destroy(struct
rttimer_queue *q, int
destroy);
int
rt_timer_add(struct
rtentry *rt,
void(*f)(struct rtentry *,
struct rttimer *), struct
rttimer_queue *q);
void
rt_timer_remove_all(struct
rtentry *rt);
The rt_timer functions provide a generic
route callout functionality. They allow a function to be called for a route
at any time. This was originally intended to be used to remove routes added
by path MTU discovery code.
For maximum efficiency, a separate queue should be defined for each timeout period. For example, one queue should be created for the 10 minute path MTU discovery timeouts, another for 20 minute ARP timeouts after 20 minutes, and so on. This permits extremely fast queue manipulations so that the timeout functions remain scalable, even in the face of thousands of route manipulations per minute.
It is possible to create only a single timeout queue for all possible timeout values, but doing so is not scalable as queue manipulations become quite expensive if the timeout deltas are not roughly constant.
The rt_timer interface provides the
following functions:
rt_timer_queue_create(time_t
timeout)rt_timer_queue_change(rttimer_queue
*q, time_t timeout)rt_timer_queue_destroy(rttimer_queue
*q, int destroy)rt_timer_add(struct
rtentry *rt, void(*f)(struct rtentry *, struct rttimer
*), struct rttimer_queue *q)rt_timer_remove_all(struct
rtentry *rt)rt_timer subsystem. This is used when a route is
deleted to ensure that no dangling references remain.The rt_timer interface is implemented in
sys/net/route.h and
sys/net/route.c.
The rt_timer interface appeared in
NetBSD 1.4.
This interface is roughly based on (but, alas, not compatible with) one designed by David Borman of BSDI. This implementation is by Kevin Lahey of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
| June 1, 2016 | NetBSD 11.0 |