File: defaults.h

package info (click to toggle)
radvd 1:0.7.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 608 kB
  • ctags: 280
  • sloc: sh: 5,816; ansic: 2,801; yacc: 415; lex: 121; makefile: 46
file content (184 lines) | stat: -rw-r--r-- 5,117 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 *   $Id: defaults.h,v 1.9 2004/10/26 05:30:34 psavola Exp $
 *
 *   Authors:
 *    Lars Fenneberg		<lf@elemental.net>	 
 *
 *   This software is Copyright 1996,1997 by the above mentioned author(s), 
 *   All Rights Reserved.
 *
 *   The license which is distributed with this software in the file COPYRIGHT
 *   applies to this software. If your distribution is missing this file, you
 *   may request it from <lutchann@litech.org>.
 *
 */

#ifndef DEFAULTS_H
#define DEFAULTS_H

#include <config.h>
#include <includes.h>
#include <radvd.h>

/* maximum message size for incoming and outgoing RSs and RAs */

#define MSG_SIZE			4096

#define MAX2(X,Y) ( (( X ) >=  ( Y )) ? ( X ) : ( Y ))


/* Router Configuration Variables: */

/* For each multicast interface: */

#define DFLT_IgnoreIfMissing		0
#define DFLT_AdvSendAdv			0
#define DFLT_MaxRtrAdvInterval		600
#define DFLT_MinRtrAdvInterval(iface)	(0.33 * (iface)->MaxRtrAdvInterval)
#define DFLT_AdvManagedFlag		0
#define DFLT_AdvOtherConfigFlag		0
#define DFLT_AdvLinkMTU			0
#define DFLT_AdvReachableTime		0
#define DFLT_AdvRetransTimer		0
#define DFLT_AdvCurHopLimit		64	/* as per RFC 1700 or the 
						   next incarnation of it :) */
#define DFLT_AdvDefaultLifetime(iface)	MAX2(1, (int)(3.0 * (iface)->MaxRtrAdvInterval))
#define DFLT_MinDelayBetweenRAs		MIN_DELAY_BETWEEN_RAS
#define DFLT_AdvDefaultPreference	0

/* Options sent with RA */

#define DFLT_AdvSourceLLAddress		1

/* Each prefix has an associated: */

#define DFLT_AdvValidLifetime		2592000 /* seconds */
#define DFLT_AdvOnLinkFlag		1
#define DFLT_AdvPreferredLifetime	604800 /* seconds */
#define DFLT_AdvAutonomousFlag		1

/* Each route has an associated: */
#define DFLT_AdvRouteLifetime(iface)	(3 * (iface)->MaxRtrAdvInterval)

#define DFLT_AdvRoutePreference		0 /* medium*/

/* Protocol (RFC2461) constants: */

/* Router constants: */

#define MAX_INITIAL_RTR_ADVERT_INTERVAL	16
#define MAX_INITIAL_RTR_ADVERTISEMENTS	3
#define MAX_FINAL_RTR_ADVERTISEMENTS	3
#define MIN_DELAY_BETWEEN_RAS		3
#define MIN_DELAY_BETWEEN_RAS_MIPv6     (30.0/1000.0)
#define MAX_RA_DELAY_TIME		(1000.0/2.0) /* milliseconds */

/* Host constants: */

#define MAX_RTR_SOLICITATION_DELAY	1
#define RTR_SOLICITATION_INTERVAL	4
#define MAX_RTR_SOLICITATIONS		3

/* Node constants: */

#define MAX_MULTICAST_SOLICIT		3
#define MAX_UNICAST_SOLICIT		3
#define MAX_ANYCAST_DELAY_TIME		1
#define MAX_NEIGHBOR_ADVERTISEMENT	3
#define REACHABLE_TIME			30000 /* milliseconds */
#define RETRANS_TIMER			1000 /* milliseconds */
#define DELAY_FIRST_PROBE_TIME		5
#define MIN_RANDOM_FACTOR		(1.0/2.0)
#define MAX_RANDOM_FACTOR		(3.0/2.0)

/* MAX and MIN (RFC2461), Mobile IPv6 extensions will override if in use */

#define MIN_MaxRtrAdvInterval		4
#define MAX_MaxRtrAdvInterval		1800

#define MIN_MinRtrAdvInterval		3
#define MAX_MinRtrAdvInterval(iface)	(0.75 * (iface)->MaxRtrAdvInterval)

#define MIN_AdvDefaultLifetime(iface)	(MAX2(1,(iface)->MaxRtrAdvInterval))
#define MAX_AdvDefaultLifetime		9000

#define	MIN_AdvLinkMTU			1280

#define MAX_AdvReachableTime		3600000 /* 1 hour in milliseconds */

#define MAX_AdvCurHopLimit		255

#define MAX_PrefixLen			128

/*
 * Mobile IPv6 extensions, off by default
 */

#define DFLT_AdvRouterAddr		0
#define DFLT_AdvHomeAgentFlag		0
#define DFLT_AdvIntervalOpt		0
#define DFLT_AdvHomeAgentInfo		0

/* Option types (defined also at least in glibc 2.2's netinet/icmp6.h) */

#ifndef ND_OPT_RTR_ADV_INTERVAL
#define ND_OPT_RTR_ADV_INTERVAL         7
#endif
#ifndef ND_OPT_HOME_AGENT_INFO
#define ND_OPT_HOME_AGENT_INFO          8
#endif

/* draft-ietf-ipv6-router-selection-02.txt */
/* XXX: not formally assigned, this will be changed! */
#ifndef ND_OPT_ROUTE_INFORMATION
#define  ND_OPT_ROUTE_INFORMATION	9	

/* XXX: some libc's like KAME already had nd_opt_route_info! */
struct nd_opt_route_info_local     /* route information */
  {
    uint8_t   nd_opt_ri_type;
    uint8_t   nd_opt_ri_len;
    uint8_t   nd_opt_ri_prefix_len;
    uint8_t   nd_opt_ri_flags_reserved;
    uint32_t  nd_opt_ri_lifetime;
    struct in6_addr  nd_opt_ri_prefix;
  };

/* the reserved field is 8 bits and we're interested of the middle two: 000xx000 */
#define ND_OPT_RI_PRF_SHIFT	3
#define ND_OPT_RI_PRF_MASK	(3 << ND_OPT_RI_PRF_SHIFT)

#endif

/* Flags */

#ifndef ND_RA_FLAG_HOME_AGENT
#define ND_RA_FLAG_HOME_AGENT		0x20
#endif
#ifndef ND_OPT_PI_FLAG_RADDR
#define ND_OPT_PI_FLAG_RADDR		0x20
#endif

/* Configurable values */

#define DFLT_HomeAgentPreference	0
#define DFLT_HomeAgentLifetime(iface)	DFLT_AdvDefaultLifetime(iface)

/* Other */

#define AdvertisementInterval(iface)	((iface)->MaxRtrAdvInterval))

#define MIN_MinRtrAdvInterval_MIPv6	(3.0/100.0)
#define MIN_MaxRtrAdvInterval_MIPv6	(7.0/100.0)
#define RTR_SOLICITATION_INTERVAL_MIPv6	1 /* Recommended value by MIPv6 */

#define Cautious_MaxRtrAdvInterval      (2.0/10.0)
#define Cautious_MaxRtrAdvInterval_Leeway      (2.0/100.0)

#define MIN_HomeAgentLifetime		1 /* 0 must NOT be used */
#define MAX_HomeAgentLifetime		65520 /* 18.2 hours in secs */

/* #define MAX_RTR_SOLICITATIONS This MAY be ignored by MIPv6 */


#endif