2 * Copyright (C) 1998 WIDE Project.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the project nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #define ALLNODES "ff02::1"
33 #define ALLROUTERS "ff02::2"
34 #define ALLSITEROUTERS "ff05::2"
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
47 #define MAXROUTERLIFETIME 9000
48 #define MIN_MAXINTERVAL 4
49 #define MAX_MAXINTERVAL 1800
50 #define MIN_MININTERVAL 3
51 #define MAXREACHABLETIME 3600000
53 #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
54 #define MAX_INITIAL_RTR_ADVERTISEMENTS 3
55 #define MAX_FINAL_RTR_ADVERTISEMENTS 3
56 #define MIN_DELAY_BETWEEN_RAS 3
57 #define MAX_RA_DELAY_TIME 500000 /* usec */
60 struct prefix *next; /* forward link */
61 struct prefix *prev; /* previous link */
63 u_int32_t validlifetime; /* AdvValidLifetime */
64 u_int32_t preflifetime; /* AdvPreferredLifetime */
65 u_int onlinkflg; /* bool: AdvOnLinkFlag */
66 u_int autoconfflg; /* bool: AdvAutonomousFlag */
68 struct in6_addr prefix;
72 /* pointer for list */
75 /* timer related parameters */
76 struct rtadvd_timer *timer;
77 int initcounter; /* counter for the first few advertisements */
78 struct timeval lastsent; /* timestamp when the lates RA was sent */
79 int waiting; /* number of RS waiting for RA */
81 /* interface information */
83 int advlinkopt; /* bool: whether include link-layer addr opt */
84 struct sockaddr_dl *sdl;
86 int phymtu; /* mtu of the physical interface */
88 /* Router configuration variables */
89 u_short lifetime; /* AdvDefaultLifetime */
90 u_int maxinterval; /* MaxRtrAdvInterval */
91 u_int mininterval; /* MinRtrAdvInterval */
92 int managedflg; /* AdvManagedFlag */
93 int otherflg; /* AdvOtherConfigFlag */
94 u_int32_t linkmtu; /* AdvLinkMTU */
95 u_int32_t reachabletime; /* AdvReachableTime */
96 u_int32_t retranstimer; /* AdvRetransTimer */
97 u_int hoplimit; /* AdvCurHopLimit */
98 struct prefix prefix; /* AdvPrefixList(link head) */
99 int pfxs; /* number of prefixes */
101 /* actual RA packet data and its length */
106 void ra_timeout __P((void *));
107 void ra_timer_update __P((void *, struct timeval *));