Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rt_timer_remove_all(9) [netbsd man page]

RT_TIMER(9)						   BSD Kernel Developer's Manual					       RT_TIMER(9)

NAME
rt_timer, rt_timer_add, rt_timer_queue_create, rt_timer_queue_change, rt_timer_queue_destroy, rt_timer_remove_all -- route callout functions SYNOPSIS
#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); DESCRIPTION
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 manip- ulations 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) This function creates a new timer queue with the specified timeout period timeout, expressed in seconds. rt_timer_queue_change(rttimer_queue *q, time_t timeout) This function modifies the timeout period for a timer queue. Any value, including 0, is valid. The next time the timer queue's timeout expires (based on the previous timeout value), all entries which are valid to execute based on the new timeout will be exe- cuted, and the new timeout period scheduled. rt_timer_queue_destroy(rttimer_queue *q, int destroy) This function destroys a timeout queue. All entries are removed, and if the destroy argument is non-zero, the timeout action is performed for each entry. rt_timer_add(struct rtentry *rt, void(*f)(struct rtentry *, struct rttimer *), struct rttimer_queue *q) This function adds an entry to a timeout queue. The function f will be called after the timeout period for queue q has elapsed. If f is NULL the route will be deleted when the timeout expires. rt_timer_remove_all(struct rtentry *rt) This function removes all references to the given route from the rt_timer subsystem. This is used when a route is deleted to ensure that no dangling references remain. SEE ALSO
netstat(1), arp(9) HISTORY
The rt_timer interface appeared in NetBSD 1.4. AUTHORS
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. CODE REFERENCES
The rt_timer interface is implemented in sys/net/route.h and sys/net/route.c. BSD
April 23, 1998 BSD

Check Out this Related Man Page

RTALLOC(9)						   BSD Kernel Developer's Manual						RTALLOC(9)

NAME
rtalloc, rtalloc_ign, rtalloc1, rtfree -- look up a route in the kernel routing table SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <net/route.h> void rtalloc(struct route *ro); void rtalloc_ign(struct route *ro, u_long flags); struct rtentry * rtalloc1(struct sockaddr *sa, int report, u_long flags); void rtfree(struct rt_entry *rt); RTFREE(struct rt_entry *rt); RT_LOCK(struct rt_entry *rt); RT_UNLOCK(struct rt_entry *rt); RT_ADDREF(struct rt_entry *rt); RT_REMREF(struct rt_entry *rt); DESCRIPTION
The kernel uses a radix tree structure to manage routes for the networking subsystem. The rtalloc() family of routines is used by protocols to query this structure for a route corresponding to a particular end-node address, and to cause certain protocol- and interface-specific actions to take place. RTF_PRCLONING flag is obsolete and thus ignored by facility. If the RTF_XRESOLVE flag is set, then the RTM_RESOLVE message is sent instead on the route(4) socket interface, requesting that an external program resolve the address in question and modify the route appropriately. The default interface is rtalloc(). Its only argument is ro, a pointer to a ``struct route'', which is defined as follows: struct route { struct sockaddr ro_dst; struct rtentry *ro_rt; }; Thus, this function can only be used for address families which are smaller than the default ``struct sockaddr''. Before calling rtalloc() for the first time, callers should ensure that unused bits of the structure are set to zero. On subsequent calls, rtalloc() returns without performing a lookup if ro->ro_rt is non-null and the RTF_UP flag is set in the route's rt_flags field. The rtalloc_ign() interface can be used when the caller does not want to receive the returned rtentry locked. The ro argument is the same as rtalloc(), but there is additionally a flags argument, which is now only used to pass RTF_RNH_LOCKED indicating that the radix tree lock is already held. Both rtalloc() and rtalloc_ign() functions return a pointer to an unlocked struct rtentry. The rtalloc1() function is the most general form of rtalloc() (and both of the other forms are implemented as calls to rtalloc1). It does not use the ``struct route'', and is therefore suitable for address families which require more space than is in a traditional ``struct sockaddr''. Instead, it takes a ``struct sockaddr *'' directly as the sa argument. The second argument, report, controls whether the lower layers are notified when a lookup fails. The third argument, flags, is a set of flags to ignore, as in rtalloc_ign(). The rtalloc1() func- tion returns a pointer to a locked struct rtentry. The rtfree() function frees a locked route entry, e.g., a previously allocated by rtalloc1(). The RTFREE() macro is used to free unlocked route entries, previously allocated by rtalloc() or rtalloc_ign(). The RTFREE() macro decrements the reference count on the routing table entry (see below), and frees it if the reference count has reached zero. The preferred usage is allocating a route using rtalloc() or rtalloc_ign() and freeing using RTFREE(). The RT_LOCK() macro is used to lock a routing table entry. The RT_UNLOCK() macro is used to unlock a routing table entry. The RT_ADDREF() macro increments the reference count on a previously locked route entry. The RT_REMREF() macro decrements the reference count on a previously locked route entry. RETURN VALUES
The rtalloc(), rtalloc_ign() and rtfree() functions do not return a value. The rtalloc1() function returns a pointer to a routing-table entry if it succeeds, otherwise a null pointer. Lack of a route should in most cases be translated to the errno(2) value EHOSTUNREACH. SEE ALSO
route(4), rtentry(9) HISTORY
The rtalloc facility first appeared in 4.2BSD, although with much different internals. The rtalloc_ign() function and the flags argument to rtalloc1() first appeared in FreeBSD 2.0. Routing table locking was introduced in FreeBSD 5.2. AUTHORS
This manual page was written by Garrett Wollman, as were the changes to implement RTF_PRCLONING and the rtalloc_ign() function and the flags argument to rtalloc1(). BSD
December 11, 2008 BSD
Man Page