radvd 1.6 update
[tomato.git] / release / src / router / radvd / defaults.h
blob15f1c40896cebca38a1889a7eb36e84c4720c218
1 /*
2 * $Id: defaults.h,v 1.22 2010/01/28 13:34:26 psavola Exp $
4 * Authors:
5 * Lars Fenneberg <lf@elemental.net>
7 * This software is Copyright 1996,1997 by the above mentioned author(s),
8 * All Rights Reserved.
10 * The license which is distributed with this software in the file COPYRIGHT
11 * applies to this software. If your distribution is missing this file, you
12 * may request it from <pekkas@netcore.fi>.
16 #ifndef DEFAULTS_H
17 #define DEFAULTS_H
19 #include <config.h>
20 #include <includes.h>
21 #include <radvd.h>
23 /* maximum message size for incoming and outgoing RSs and RAs */
24 #define MSG_SIZE_RECV 1500
25 #define MSG_SIZE_SEND 1452
27 #define MAX2(X,Y) ( (( X ) >= ( Y )) ? ( X ) : ( Y ))
30 /* Router Configuration Variables: */
32 /* For each multicast interface: */
34 #define DFLT_IgnoreIfMissing 0
35 #define DFLT_AdvSendAdv 0
36 #define DFLT_MaxRtrAdvInterval 600
37 #define DFLT_MinRtrAdvInterval(iface) (0.33 * (iface)->MaxRtrAdvInterval)
38 #define DFLT_AdvManagedFlag 0
39 #define DFLT_AdvOtherConfigFlag 0
40 #define DFLT_AdvLinkMTU 0
41 #define DFLT_AdvReachableTime 0
42 #define DFLT_AdvRetransTimer 0
43 #define DFLT_AdvCurHopLimit 64 /* as per RFC 1700 or the
44 next incarnation of it :) */
45 #define DFLT_AdvDefaultLifetime(iface) MAX2(1, (int)(3.0 * (iface)->MaxRtrAdvInterval))
46 #define DFLT_MinDelayBetweenRAs MIN_DELAY_BETWEEN_RAS
47 #define DFLT_AdvDefaultPreference 0
49 /* Options sent with RA */
51 #define DFLT_AdvSourceLLAddress 1
53 /* Each prefix has an associated: */
55 #define DFLT_AdvValidLifetime 86400 /* seconds */
56 #define DFLT_AdvOnLinkFlag 1
57 #define DFLT_AdvPreferredLifetime 14400 /* seconds */
58 #define DFLT_AdvAutonomousFlag 1
60 /* Each route has an associated: */
61 #define DFLT_AdvRouteLifetime(iface) (3 * (iface)->MaxRtrAdvInterval)
63 #define DFLT_AdvRoutePreference 0 /* medium*/
65 /* RDNSS */
66 #define DFLT_AdvRDNSSPreference 8 /* medium */
67 #define DFLT_AdvRDNSSOpenFlag 0
68 #define DFLT_AdvRDNSSLifetime(iface) (iface)->MaxRtrAdvInterval
70 /* Protocol (RFC4861) constants: */
72 /* Router constants: */
74 #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
75 #define MAX_INITIAL_RTR_ADVERTISEMENTS 3
76 #define MAX_FINAL_RTR_ADVERTISEMENTS 3
77 #define MIN_DELAY_BETWEEN_RAS 3.0
78 #define MIN_DELAY_BETWEEN_RAS_MIPv6 (30.0/1000.0)
79 #define MAX_RA_DELAY_TIME (1000.0/2.0) /* milliseconds */
81 /* Host constants: */
83 #define MAX_RTR_SOLICITATION_DELAY 1
84 #define RTR_SOLICITATION_INTERVAL 4
85 #define MAX_RTR_SOLICITATIONS 3
87 /* Node constants: */
89 #define MAX_MULTICAST_SOLICIT 3
90 #define MAX_UNICAST_SOLICIT 3
91 #define MAX_ANYCAST_DELAY_TIME 1
92 #define MAX_NEIGHBOR_ADVERTISEMENT 3
93 #define REACHABLE_TIME 30000 /* milliseconds */
94 #define RETRANS_TIMER 1000 /* milliseconds */
95 #define DELAY_FIRST_PROBE_TIME 5
96 #define MIN_RANDOM_FACTOR (1.0/2.0)
97 #define MAX_RANDOM_FACTOR (3.0/2.0)
99 /* MAX and MIN (RFC4861), Mobile IPv6 extensions will override if in use */
101 #define MIN_MaxRtrAdvInterval 4
102 #define MAX_MaxRtrAdvInterval 1800
104 #define MIN_MinRtrAdvInterval 3
105 #define MAX_MinRtrAdvInterval(iface) (0.75 * (iface)->MaxRtrAdvInterval)
107 #define MIN_AdvDefaultLifetime(iface) (MAX2(1,(iface)->MaxRtrAdvInterval))
108 #define MAX_AdvDefaultLifetime 9000
110 #define MIN_AdvLinkMTU 1280
111 #define MAX_AdvLinkMTU 131072
113 #define MIN_AdvReachableTime 100
114 #define MAX_AdvReachableTime 3600000 /* 1 hour in milliseconds */
116 #define MIN_AdvRetransTimer 10
117 #define MAX_AdvRetransTimer 3600000
119 #define MIN_AdvCurHopLimit 2
120 #define MAX_AdvCurHopLimit 255
122 #define MAX_PrefixLen 128
125 * Mobile IPv6 extensions, off by default
128 #define DFLT_AdvRouterAddr 0
129 #define DFLT_AdvHomeAgentFlag 0
130 #define DFLT_AdvIntervalOpt 0
131 #define DFLT_AdvHomeAgentInfo 0
133 /* Option types (defined also at least in glibc 2.2's netinet/icmp6.h) */
135 #ifndef ND_OPT_RTR_ADV_INTERVAL
136 #define ND_OPT_RTR_ADV_INTERVAL 7
137 #endif
138 #ifndef ND_OPT_HOME_AGENT_INFO
139 #define ND_OPT_HOME_AGENT_INFO 8
140 #endif
142 /* de-facto codepoint used by many implementations was '9',
143 the official IANA assignment is '24' */
144 #undef ND_OPT_ROUTE_INFORMATION
145 #define ND_OPT_ROUTE_INFORMATION 24
147 /* XXX: some libc's like KAME already had nd_opt_route_info! */
148 struct nd_opt_route_info_local /* route information */
150 uint8_t nd_opt_ri_type;
151 uint8_t nd_opt_ri_len;
152 uint8_t nd_opt_ri_prefix_len;
153 uint8_t nd_opt_ri_flags_reserved;
154 uint32_t nd_opt_ri_lifetime;
155 struct in6_addr nd_opt_ri_prefix;
158 /* the reserved field is 8 bits and we're interested of the middle two: 000xx000 */
159 #define ND_OPT_RI_PRF_SHIFT 3
160 #define ND_OPT_RI_PRF_MASK (3 << ND_OPT_RI_PRF_SHIFT) /* 00011000 = 0x18 */
162 #undef ND_OPT_RDNSS_INFORMATION
163 #define ND_OPT_RDNSS_INFORMATION 25
165 /* */
166 struct nd_opt_rdnss_info_local
168 uint8_t nd_opt_rdnssi_type;
169 uint8_t nd_opt_rdnssi_len;
170 uint16_t nd_opt_rdnssi_pref_flag_reserved;
171 uint32_t nd_opt_rdnssi_lifetime;
172 struct in6_addr nd_opt_rdnssi_addr1;
173 struct in6_addr nd_opt_rdnssi_addr2;
174 struct in6_addr nd_opt_rdnssi_addr3;
176 /* pref/flag/reserved field : yyyyx00000000000 (big endian) - 00000000yyyyx000 (little indian); where yyyy = pref, x = flag */
177 #if BYTE_ORDER == BIG_ENDIAN
178 #define ND_OPT_RDNSSI_PREF_SHIFT 12
179 #else
180 #define ND_OPT_RDNSSI_PREF_SHIFT 4
181 #endif
182 #define ND_OPT_RDNSSI_PREF_MASK (0xf << ND_OPT_RDNSSI_PREF_SHIFT)
184 /* Flags */
186 #ifndef ND_RA_FLAG_HOME_AGENT
187 #define ND_RA_FLAG_HOME_AGENT 0x20
188 #endif
189 #ifndef ND_OPT_PI_FLAG_RADDR
190 #define ND_OPT_PI_FLAG_RADDR 0x20
191 #endif
192 #ifndef ND_OPT_RDNSSI_FLAG_S
193 #if BYTE_ORDER == BIG_ENDIAN
194 #define ND_OPT_RDNSSI_FLAG_S 0x0800
195 #else
196 #define ND_OPT_RDNSSI_FLAG_S 0x0008
197 #endif
198 #endif
200 /* Configurable values */
202 #define DFLT_HomeAgentPreference 0
203 #define DFLT_HomeAgentLifetime(iface) ((iface)->AdvDefaultLifetime)
205 /* Other */
207 #define MIN_MinRtrAdvInterval_MIPv6 (3.0/100.0)
208 #define MIN_MaxRtrAdvInterval_MIPv6 (7.0/100.0)
209 #define RTR_SOLICITATION_INTERVAL_MIPv6 1 /* Recommended value by MIPv6 */
211 #define Cautious_MaxRtrAdvInterval (2.0/10.0)
212 #define Cautious_MaxRtrAdvInterval_Leeway (2.0/100.0)
214 #define MIN_HomeAgentLifetime 1 /* 0 must NOT be used */
215 #define MAX_HomeAgentLifetime 65520 /* 18.2 hours in secs */
217 /* #define MAX_RTR_SOLICITATIONS This MAY be ignored by MIPv6 */
219 /* NEMO extensions, off by default */
220 #define DFLT_AdvMobRtrSupportFlag 0
222 /* Flags */
224 #ifndef ND_OPT_HAI_FLAG_SUPPORT_MR
225 #if BYTE_ORDER == BIG_ENDIAN
226 #define ND_OPT_HAI_FLAG_SUPPORT_MR 0x8000
227 #else /* BYTE_ORDER == LITTLE_ENDIAN */
228 #define ND_OPT_HAI_FLAG_SUPPORT_MR 0x0080
229 #endif
230 #endif
232 #endif