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