rtadvd.h revision 1.5 1 /* $NetBSD: rtadvd.h,v 1.5 2000/07/06 12:37:56 itojun Exp $ */
2 /* $KAME: rtadvd.h,v 1.9 2000/06/22 20:16:13 itojun Exp $ */
3
4 /*
5 * Copyright (C) 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33 #define ALLNODES "ff02::1"
34 #define ALLROUTERS "ff02::2"
35 #define ANY "::"
36 #define RTSOLLEN 8
37
38 /* protocol constants and default values */
39 #define DEF_MAXRTRADVINTERVAL 600
40 #define DEF_ADVLINKMTU 0
41 #define DEF_ADVREACHABLETIME 0
42 #define DEF_ADVRETRANSTIMER 0
43 #define DEF_ADVCURHOPLIMIT 64
44 #define DEF_ADVVALIDLIFETIME 2592000
45 #define DEF_ADVPREFERREDLIFETIME 604800
46
47 /*XXX int-to-double comparison for INTERVAL items */
48 #ifndef MIP6
49 #define mobileip6 0
50 #endif
51
52 #define MAXROUTERLIFETIME 9000
53 #define MIN_MAXINTERVAL (mobileip6 ? 1.5 : 4.0)
54 #define MAX_MAXINTERVAL 1800
55 #define MIN_MININTERVAL (mobileip6 ? 0.5 : 3)
56 #define MAXREACHABLETIME 3600000
57
58 #ifndef MIP6
59 #undef miobileip6
60 #endif
61
62 #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
63 #define MAX_INITIAL_RTR_ADVERTISEMENTS 3
64 #define MAX_FINAL_RTR_ADVERTISEMENTS 3
65 #define MIN_DELAY_BETWEEN_RAS 3
66 #define MAX_RA_DELAY_TIME 500000 /* usec */
67
68 #define PREFIX_FROM_KERNEL 1
69 #define PREFIX_FROM_CONFIG 2
70 #define PREFIX_FROM_DYNAMIC 3
71
72 struct prefix {
73 struct prefix *next; /* forward link */
74 struct prefix *prev; /* previous link */
75
76 u_int32_t validlifetime; /* AdvValidLifetime */
77 u_int32_t preflifetime; /* AdvPreferredLifetime */
78 u_int onlinkflg; /* bool: AdvOnLinkFlag */
79 u_int autoconfflg; /* bool: AdvAutonomousFlag */
80 #ifdef MIP6
81 u_int routeraddr; /* bool: RouterAddress */
82 #endif
83 int prefixlen;
84 int origin; /* from kernel or cofig */
85 struct in6_addr prefix;
86 };
87
88 struct soliciter {
89 struct soliciter *next;
90 struct sockaddr_in6 addr;
91 };
92
93 struct rainfo {
94 /* pointer for list */
95 struct rainfo *next;
96
97 /* timer related parameters */
98 struct rtadvd_timer *timer;
99 int initcounter; /* counter for the first few advertisements */
100 struct timeval lastsent; /* timestamp when the latest RA was sent */
101 int waiting; /* number of RS waiting for RA */
102
103 /* interface information */
104 int ifindex;
105 int advlinkopt; /* bool: whether include link-layer addr opt */
106 struct sockaddr_dl *sdl;
107 char ifname[16];
108 int phymtu; /* mtu of the physical interface */
109
110 /* Router configuration variables */
111 u_short lifetime; /* AdvDefaultLifetime */
112 u_int maxinterval; /* MaxRtrAdvInterval */
113 u_int mininterval; /* MinRtrAdvInterval */
114 int managedflg; /* AdvManagedFlag */
115 int otherflg; /* AdvOtherConfigFlag */
116 #ifdef MIP6
117 int haflg; /* HAFlag */
118 #endif
119 u_int32_t linkmtu; /* AdvLinkMTU */
120 u_int32_t reachabletime; /* AdvReachableTime */
121 u_int32_t retranstimer; /* AdvRetransTimer */
122 u_int hoplimit; /* AdvCurHopLimit */
123 struct prefix prefix; /* AdvPrefixList(link head) */
124 int pfxs; /* number of prefixes */
125
126 #ifdef MIP6
127 u_short hapref; /* Home Agent Preference */
128 u_short hatime; /* Home Agent Lifetime */
129 #endif
130
131 /* actual RA packet data and its length */
132 size_t ra_datalen;
133 u_char *ra_data;
134
135 /* statistics */
136 u_quad_t raoutput; /* number of RAs sent */
137 u_quad_t rainput; /* number of RAs received */
138 u_quad_t rainconsistent; /* number of RAs inconsistent with ours */
139 u_quad_t rsinput; /* number of RSs received */
140
141 /* info about soliciter */
142 struct soliciter *soliciter; /* recent solication source */
143 };
144
145 void ra_timeout __P((void *));
146 void ra_timer_update __P((void *, struct timeval *));
147
148 #ifdef MIP6
149 extern int mobileip6;
150 #endif
151