Deleted Added
full compact
route.h (185747) route.h (186119)
1/*-
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)route.h 8.4 (Berkeley) 1/9/95
1/*-
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)route.h 8.4 (Berkeley) 1/9/95
30 * $FreeBSD: head/sys/net/route.h 185747 2008-12-07 21:15:43Z kmacy $
30 * $FreeBSD: head/sys/net/route.h 186119 2008-12-15 06:10:57Z qingli $
31 */
32
33#ifndef _NET_ROUTE_H_
34#define _NET_ROUTE_H_
35
36/*
37 * Kernel resident routing tables.
38 *

--- 91 unchanged lines hidden (view full) ---

130 /*
131 * XXX struct rtentry must begin with a struct radix_node (or two!)
132 * because the code does some casts of a 'struct radix_node *'
133 * to a 'struct rtentry *'
134 */
135#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key)))
136#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask)))
137 struct sockaddr *rt_gateway; /* value */
31 */
32
33#ifndef _NET_ROUTE_H_
34#define _NET_ROUTE_H_
35
36/*
37 * Kernel resident routing tables.
38 *

--- 91 unchanged lines hidden (view full) ---

130 /*
131 * XXX struct rtentry must begin with a struct radix_node (or two!)
132 * because the code does some casts of a 'struct radix_node *'
133 * to a 'struct rtentry *'
134 */
135#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key)))
136#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask)))
137 struct sockaddr *rt_gateway; /* value */
138 u_long rt_flags; /* up/down?, host/net */
138 int rt_flags; /* up/down?, host/net */
139 int rt_refcnt; /* # held references */
139 struct ifnet *rt_ifp; /* the answer: interface to use */
140 struct ifaddr *rt_ifa; /* the answer: interface address to use */
141 struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */
140 struct ifnet *rt_ifp; /* the answer: interface to use */
141 struct ifaddr *rt_ifa; /* the answer: interface address to use */
142 struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */
142 long rt_refcnt; /* # held references */
143 struct sockaddr *rt_genmask; /* for generation of cloned routes */
144 caddr_t rt_llinfo; /* pointer to link level info cache */
145 struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
146 struct rtentry *rt_parent; /* cloning parent of this route */
147 u_int rt_fibnum; /* which FIB */
148#ifdef _KERNEL
149 /* XXX ugly, user apps use this definition but don't have a mtx def */
150 struct mtx rt_mtx; /* mutex for routing entry */
151#endif
152};
153
154/*

--- 15 unchanged lines hidden (view full) ---

170#define RTF_UP 0x1 /* route usable */
171#define RTF_GATEWAY 0x2 /* destination is a gateway */
172#define RTF_HOST 0x4 /* host entry (net otherwise) */
173#define RTF_REJECT 0x8 /* host or net unreachable */
174#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
175#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
176#define RTF_DONE 0x40 /* message confirmed */
177/* 0x80 unused, was RTF_DELCLONE */
143 u_int rt_fibnum; /* which FIB */
144#ifdef _KERNEL
145 /* XXX ugly, user apps use this definition but don't have a mtx def */
146 struct mtx rt_mtx; /* mutex for routing entry */
147#endif
148};
149
150/*

--- 15 unchanged lines hidden (view full) ---

166#define RTF_UP 0x1 /* route usable */
167#define RTF_GATEWAY 0x2 /* destination is a gateway */
168#define RTF_HOST 0x4 /* host entry (net otherwise) */
169#define RTF_REJECT 0x8 /* host or net unreachable */
170#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
171#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
172#define RTF_DONE 0x40 /* message confirmed */
173/* 0x80 unused, was RTF_DELCLONE */
178#define RTF_CLONING 0x100 /* generate new routes on use */
174/* 0x100 unused, was RTF_CLONING */
179#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
175#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
180#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */
176/* 0x400 unused, was RTF_LLINFO */
181#define RTF_STATIC 0x800 /* manually added */
182#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
183#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
184#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
185
186/* XXX: temporary to stay API/ABI compatible with userland */
187#ifndef _KERNEL
188#define RTF_PRCLONING 0x10000 /* unused, for compatibility */
189#endif
190
177#define RTF_STATIC 0x800 /* manually added */
178#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
179#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
180#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
181
182/* XXX: temporary to stay API/ABI compatible with userland */
183#ifndef _KERNEL
184#define RTF_PRCLONING 0x10000 /* unused, for compatibility */
185#endif
186
191#define RTF_WASCLONED 0x20000 /* route generated through cloning */
187/* 0x20000 unused, was RTF_WASCLONED */
192#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
193/* 0x80000 unused */
194#define RTF_PINNED 0x100000 /* future use */
195#define RTF_LOCAL 0x200000 /* route represents a local address */
196#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
197#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
198 /* 0x1000000 and up unassigned */
199#define RTF_RNH_LOCKED 0x40000000 /* radix node head locked by caller */

--- 121 unchanged lines hidden (view full) ---

321#define RT_TRYLOCK(_rt) mtx_trylock(&(_rt)->rt_mtx)
322#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx)
323#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx)
324#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED)
325
326#define RT_ADDREF(_rt) do { \
327 RT_LOCK_ASSERT(_rt); \
328 KASSERT((_rt)->rt_refcnt >= 0, \
188#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
189/* 0x80000 unused */
190#define RTF_PINNED 0x100000 /* future use */
191#define RTF_LOCAL 0x200000 /* route represents a local address */
192#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
193#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
194 /* 0x1000000 and up unassigned */
195#define RTF_RNH_LOCKED 0x40000000 /* radix node head locked by caller */

--- 121 unchanged lines hidden (view full) ---

317#define RT_TRYLOCK(_rt) mtx_trylock(&(_rt)->rt_mtx)
318#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx)
319#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx)
320#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED)
321
322#define RT_ADDREF(_rt) do { \
323 RT_LOCK_ASSERT(_rt); \
324 KASSERT((_rt)->rt_refcnt >= 0, \
329 ("negative refcnt %ld", (_rt)->rt_refcnt)); \
325 ("negative refcnt %d", (_rt)->rt_refcnt)); \
330 (_rt)->rt_refcnt++; \
331} while (0)
332
333#define RT_REMREF(_rt) do { \
334 RT_LOCK_ASSERT(_rt); \
335 KASSERT((_rt)->rt_refcnt > 0, \
326 (_rt)->rt_refcnt++; \
327} while (0)
328
329#define RT_REMREF(_rt) do { \
330 RT_LOCK_ASSERT(_rt); \
331 KASSERT((_rt)->rt_refcnt > 0, \
336 ("bogus refcnt %ld", (_rt)->rt_refcnt)); \
332 ("bogus refcnt %d", (_rt)->rt_refcnt)); \
337 (_rt)->rt_refcnt--; \
338} while (0)
339
340#define RTFREE_LOCKED(_rt) do { \
341 if ((_rt)->rt_refcnt <= 1) \
342 rtfree(_rt); \
343 else { \
344 RT_REMREF(_rt); \

--- 59 unchanged lines hidden (view full) ---

404void rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */
405struct rtentry *rtalloc1(struct sockaddr *, int, u_long);
406int rtinit(struct ifaddr *, int, int);
407int rtioctl(u_long, caddr_t);
408void rtredirect(struct sockaddr *, struct sockaddr *,
409 struct sockaddr *, int, struct sockaddr *);
410int rtrequest(int, struct sockaddr *,
411 struct sockaddr *, struct sockaddr *, int, struct rtentry **);
333 (_rt)->rt_refcnt--; \
334} while (0)
335
336#define RTFREE_LOCKED(_rt) do { \
337 if ((_rt)->rt_refcnt <= 1) \
338 rtfree(_rt); \
339 else { \
340 RT_REMREF(_rt); \

--- 59 unchanged lines hidden (view full) ---

400void rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */
401struct rtentry *rtalloc1(struct sockaddr *, int, u_long);
402int rtinit(struct ifaddr *, int, int);
403int rtioctl(u_long, caddr_t);
404void rtredirect(struct sockaddr *, struct sockaddr *,
405 struct sockaddr *, int, struct sockaddr *);
406int rtrequest(int, struct sockaddr *,
407 struct sockaddr *, struct sockaddr *, int, struct rtentry **);
412int rtrequest1(int, struct rt_addrinfo *, struct rtentry **);
413
414/* defaults to "all" FIBs */
415int rtinit_fib(struct ifaddr *, int, int);
416
417/* XXX MRT NEW VERSIONS THAT USE FIBs
418 * For now the protocol indepedent versions are the same as the AF_INET ones
419 * but this will change..
420 */

--- 19 unchanged lines hidden ---
408
409/* defaults to "all" FIBs */
410int rtinit_fib(struct ifaddr *, int, int);
411
412/* XXX MRT NEW VERSIONS THAT USE FIBs
413 * For now the protocol indepedent versions are the same as the AF_INET ones
414 * but this will change..
415 */

--- 19 unchanged lines hidden ---