Reinstate dropbear 0.54 update
[tomato.git] / release / src / router / radvd / defaults.h
blob55f44d52ba1d305ac589e68cf3af577730e94020
1 /*
2 * $Id: defaults.h,v 1.31 2011/05/04 18:03:57 reubenhwk 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 1
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
59 #define DFLT_DeprecatePrefixFlag 0
60 #define DFLT_DecrementLifetimesFlag 0
62 /* Each route has an associated: */
63 #define DFLT_AdvRouteLifetime(iface) (3 * (iface)->MaxRtrAdvInterval)
65 #define DFLT_AdvRoutePreference 0 /* medium*/
66 #define DFLT_RemoveRouteFlag 1
68 /* RDNSS */
69 #define DFLT_AdvRDNSSLifetime(iface) (iface)->MaxRtrAdvInterval
70 #define DFLT_FlushRDNSSFlag 1
72 /* DNSSL */
73 #define DFLT_AdvDNSSLLifetime(iface) (iface)->MaxRtrAdvInterval
74 #define DFLT_FlushDNSSLFlag 1
76 /* Protocol (RFC4861) constants: */
78 /* Router constants: */
80 #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
81 #define MAX_INITIAL_RTR_ADVERTISEMENTS 3
82 #define MAX_FINAL_RTR_ADVERTISEMENTS 3
83 #define MIN_DELAY_BETWEEN_RAS 3.0
84 #define MIN_DELAY_BETWEEN_RAS_MIPv6 (30.0/1000.0)
85 #define MAX_RA_DELAY_TIME (1000.0/2.0) /* milliseconds */
87 /* Host constants: */
89 #define MAX_RTR_SOLICITATION_DELAY 1
90 #define RTR_SOLICITATION_INTERVAL 4
91 #define MAX_RTR_SOLICITATIONS 3
93 /* Node constants: */
95 #define MAX_MULTICAST_SOLICIT 3
96 #define MAX_UNICAST_SOLICIT 3
97 #define MAX_ANYCAST_DELAY_TIME 1
98 #define MAX_NEIGHBOR_ADVERTISEMENT 3
99 #define REACHABLE_TIME 30000 /* milliseconds */
100 #define RETRANS_TIMER 1000 /* milliseconds */
101 #define DELAY_FIRST_PROBE_TIME 5
102 #define MIN_RANDOM_FACTOR (1.0/2.0)
103 #define MAX_RANDOM_FACTOR (3.0/2.0)
105 /* MAX and MIN (RFC4861), Mobile IPv6 extensions will override if in use */
107 #define MIN_MaxRtrAdvInterval 4
108 #define MAX_MaxRtrAdvInterval 1800
110 #define MIN_MinRtrAdvInterval 3
111 #define MAX_MinRtrAdvInterval(iface) (0.75 * (iface)->MaxRtrAdvInterval)
113 #define MIN_AdvDefaultLifetime(iface) (MAX2(1,(iface)->MaxRtrAdvInterval))
114 #define MAX_AdvDefaultLifetime 9000
116 #define MIN_AdvLinkMTU 1280
117 #define MAX_AdvLinkMTU 131072
119 #define MIN_AdvReachableTime 100
120 #define MAX_AdvReachableTime 3600000 /* 1 hour in milliseconds */
122 #define MIN_AdvRetransTimer 10
123 #define MAX_AdvRetransTimer 3600000
125 #define MIN_AdvCurHopLimit 2
126 #define MAX_AdvCurHopLimit 255
128 #define MAX_PrefixLen 128
130 /* SLAAC (RFC4862) Constants and Derived Values */
131 #define MIN_AdvValidLifetime 7203 /* slight >2 hours in secs */
134 * Mobile IPv6 extensions, off by default
137 #define DFLT_AdvRouterAddr 0
138 #define DFLT_AdvHomeAgentFlag 0
139 #define DFLT_AdvIntervalOpt 0
140 #define DFLT_AdvHomeAgentInfo 0
142 /* Option types (defined also at least in glibc 2.2's netinet/icmp6.h) */
144 #ifndef ND_OPT_RTR_ADV_INTERVAL
145 #define ND_OPT_RTR_ADV_INTERVAL 7
146 #endif
147 #ifndef ND_OPT_HOME_AGENT_INFO
148 #define ND_OPT_HOME_AGENT_INFO 8
149 #endif
151 /* de-facto codepoint used by many implementations was '9',
152 the official IANA assignment is '24' */
153 #undef ND_OPT_ROUTE_INFORMATION
154 #define ND_OPT_ROUTE_INFORMATION 24
156 /* XXX: some libc's like KAME already had nd_opt_route_info! */
157 struct nd_opt_route_info_local /* route information */
159 uint8_t nd_opt_ri_type;
160 uint8_t nd_opt_ri_len;
161 uint8_t nd_opt_ri_prefix_len;
162 uint8_t nd_opt_ri_flags_reserved;
163 uint32_t nd_opt_ri_lifetime;
164 struct in6_addr nd_opt_ri_prefix;
167 /* the reserved field is 8 bits and we're interested of the middle two: 000xx000 */
168 #define ND_OPT_RI_PRF_SHIFT 3
169 #define ND_OPT_RI_PRF_MASK (3 << ND_OPT_RI_PRF_SHIFT) /* 00011000 = 0x18 */
171 #undef ND_OPT_RDNSS_INFORMATION
172 #define ND_OPT_RDNSS_INFORMATION 25
174 /* */
175 struct nd_opt_rdnss_info_local
177 uint8_t nd_opt_rdnssi_type;
178 uint8_t nd_opt_rdnssi_len;
179 uint16_t nd_opt_rdnssi_pref_flag_reserved;
180 uint32_t nd_opt_rdnssi_lifetime;
181 struct in6_addr nd_opt_rdnssi_addr1;
182 struct in6_addr nd_opt_rdnssi_addr2;
183 struct in6_addr nd_opt_rdnssi_addr3;
185 /* pref/flag/reserved field : yyyyx00000000000 (big endian) - 00000000yyyyx000 (little indian); where yyyy = pref, x = flag */
186 #if BYTE_ORDER == BIG_ENDIAN
187 #define ND_OPT_RDNSSI_PREF_SHIFT 12
188 #else
189 #define ND_OPT_RDNSSI_PREF_SHIFT 4
190 #endif
191 #define ND_OPT_RDNSSI_PREF_MASK (0xf << ND_OPT_RDNSSI_PREF_SHIFT)
193 #undef ND_OPT_DNSSL_INFORMATION
194 #define ND_OPT_DNSSL_INFORMATION 31
196 /* */
197 struct nd_opt_dnssl_info_local
199 uint8_t nd_opt_dnssli_type;
200 uint8_t nd_opt_dnssli_len;
201 uint16_t nd_opt_dnssli_reserved;
202 uint32_t nd_opt_dnssli_lifetime;
203 char nd_opt_dnssli_suffixes[];
206 /* Flags */
208 #ifndef ND_RA_FLAG_HOME_AGENT
209 #define ND_RA_FLAG_HOME_AGENT 0x20
210 #endif
211 #ifndef ND_OPT_PI_FLAG_RADDR
212 #define ND_OPT_PI_FLAG_RADDR 0x20
213 #endif
214 #ifndef ND_OPT_RDNSSI_FLAG_S
215 #if BYTE_ORDER == BIG_ENDIAN
216 #define ND_OPT_RDNSSI_FLAG_S 0x0800
217 #else
218 #define ND_OPT_RDNSSI_FLAG_S 0x0008
219 #endif
220 #endif
222 /* Configurable values */
224 #define DFLT_HomeAgentPreference 0
225 #define DFLT_HomeAgentLifetime(iface) ((iface)->AdvDefaultLifetime)
227 /* Other */
229 #define MIN_MinRtrAdvInterval_MIPv6 (3.0/100.0)
230 #define MIN_MaxRtrAdvInterval_MIPv6 (7.0/100.0)
231 #define RTR_SOLICITATION_INTERVAL_MIPv6 1 /* Recommended value by MIPv6 */
233 #define Cautious_MaxRtrAdvInterval (2.0/10.0)
234 #define Cautious_MaxRtrAdvInterval_Leeway (2.0/100.0)
236 #define MIN_HomeAgentLifetime 1 /* 0 must NOT be used */
237 #define MAX_HomeAgentLifetime 65520 /* 18.2 hours in secs */
239 /* #define MAX_RTR_SOLICITATIONS This MAY be ignored by MIPv6 */
241 /* NEMO extensions, off by default */
242 #define DFLT_AdvMobRtrSupportFlag 0
244 /* Flags */
246 #ifndef ND_OPT_HAI_FLAG_SUPPORT_MR
247 #if BYTE_ORDER == BIG_ENDIAN
248 #define ND_OPT_HAI_FLAG_SUPPORT_MR 0x8000
249 #else /* BYTE_ORDER == LITTLE_ENDIAN */
250 #define ND_OPT_HAI_FLAG_SUPPORT_MR 0x0080
251 #endif
252 #endif
254 #endif