1: /*
2: * Copyright (c) 1980, 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)route.h 7.1 (Berkeley) 6/4/86
7: */
8:
9: /*
10: * Kernel resident routing tables.
11: *
12: * The routing tables are initialized when interface addresses
13: * are set by making entries for all directly connected interfaces.
14: */
15:
16: /*
17: * A route consists of a destination address and a reference
18: * to a routing entry. These are often held by protocols
19: * in their control blocks, e.g. inpcb.
20: */
21: struct route {
22: struct rtentry *ro_rt;
23: struct sockaddr ro_dst;
24: };
25:
26: /*
27: * We distinguish between routes to hosts and routes to networks,
28: * preferring the former if available. For each route we infer
29: * the interface to use from the gateway address supplied when
30: * the route was entered. Routes that forward packets through
31: * gateways are marked so that the output routines know to address the
32: * gateway rather than the ultimate destination.
33: */
34: struct rtentry {
35: u_long rt_hash; /* to speed lookups */
36: struct sockaddr rt_dst; /* key */
37: struct sockaddr rt_gateway; /* value */
38: short rt_flags; /* up/down?, host/net */
39: short rt_refcnt; /* # held references */
40: u_long rt_use; /* raw # packets forwarded */
41: struct ifnet *rt_ifp; /* the answer: interface to use */
42: };
43:
44: #define RTF_UP 0x1 /* route useable */
45: #define RTF_GATEWAY 0x2 /* destination is a gateway */
46: #define RTF_HOST 0x4 /* host entry (net otherwise) */
47: #define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
48:
49: /*
50: * Routing statistics.
51: */
52: struct rtstat {
53: short rts_badredirect; /* bogus redirect calls */
54: short rts_dynamic; /* routes created by redirects */
55: short rts_newgateway; /* routes modified by redirects */
56: short rts_unreach; /* lookups which failed */
57: short rts_wildcard; /* lookups satisfied by a wildcard */
58: };
59:
60: #ifdef KERNEL
61: #define RTFREE(rt) \
62: if ((rt)->rt_refcnt == 1) \
63: rtfree(rt); \
64: else \
65: (rt)->rt_refcnt--;
66:
67: #ifdef GATEWAY
68: #define RTHASHSIZ 64
69: #else
70: #define RTHASHSIZ 8
71: #endif
72: #if (RTHASHSIZ & (RTHASHSIZ - 1)) == 0
73: #define RTHASHMOD(h) ((h) & (RTHASHSIZ - 1))
74: #else
75: #define RTHASHMOD(h) ((h) % RTHASHSIZ)
76: #endif
77: struct mbuf *rthost[RTHASHSIZ];
78: struct mbuf *rtnet[RTHASHSIZ];
79: struct rtstat rtstat;
80: #endif
Defined variables
rtnet
defined in line
78; used 2 times
Defined struct's
route
defined in line
21; used 50 times
- in /usr/src/sys/net/route.c line
31(2),
116(2)
- in /usr/src/sys/netinet/in_pcb.c line
138(2)
- in /usr/src/sys/netinet/ip_icmp.c line
413(2)
- in /usr/src/sys/netinet/ip_input.c line
76(2)
- in /usr/src/sys/netinet/ip_output.c line
40(2),
46(2)
- in /usr/src/sys/netinet/tcp_input.c line
1035(2)
- in /usr/src/sys/netinet/tcp_subr.c line
107(2)
- in /usr/src/sys/netns/idp_usrreq.c line
119(2),
192(2)
- in /usr/src/sys/netns/ns_error.c line
113(2),
273(2)
- in /usr/src/sys/netns/ns_input.c line
280-281(4),
403(2),
423(2)
- in /usr/src/sys/netns/ns_ip.c line
43(2),
221(2),
287(2),
362(2)
- in /usr/src/sys/netns/ns_output.c line
33(2),
39(2)
- in /usr/src/sys/netns/ns_pcb.c line
108(2)
- in /usr/src/sys/netns/spp_usrreq.c line
772(2)
rtentry
defined in line
34; used 41 times
- in line 22
- in /usr/src/sys/net/route.c line
33(2),
52(2),
91(2),
117(2),
197(2),
207-211(4),
233(2),
304-305(4),
329(2)
- in /usr/src/sys/netinet/in_pcb.c line
151-154(4),
293(2)
- in /usr/src/sys/netinet/ip_output.c line
79(2)
- in /usr/src/sys/netinet/tcp_input.c line
1042(2)
- in /usr/src/sys/netns/idp_usrreq.c line
231(2)
- in /usr/src/sys/netns/ns_pcb.c line
123-125(4),
167(2)
Defined macros
RTFREE
defined in line
61; used 14 times
RTF_UP
defined in line
44; used 13 times
Usage of this include