mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
9a4365d0e0
Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project
108 lines
3.8 KiB
C
108 lines
3.8 KiB
C
/*
|
|
* Copyright (C) 1998 WIDE Project.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* $FreeBSD$
|
|
*/
|
|
|
|
#define ALLNODES "ff02::1"
|
|
#define ALLROUTERS "ff02::2"
|
|
#define ALLSITEROUTERS "ff05::2"
|
|
#define ANY "::"
|
|
#define RTSOLLEN 8
|
|
|
|
/* protocol constants and default values */
|
|
#define DEF_MAXRTRADVINTERVAL 600
|
|
#define DEF_ADVLINKMTU 0
|
|
#define DEF_ADVREACHABLETIME 0
|
|
#define DEF_ADVRETRANSTIMER 0
|
|
#define DEF_ADVCURHOPLIMIT 64
|
|
#define DEF_ADVVALIDLIFETIME 2592000
|
|
#define DEF_ADVPREFERREDLIFETIME 604800
|
|
|
|
#define MAXROUTERLIFETIME 9000
|
|
#define MIN_MAXINTERVAL 4
|
|
#define MAX_MAXINTERVAL 1800
|
|
#define MIN_MININTERVAL 3
|
|
#define MAXREACHABLETIME 3600000
|
|
|
|
#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 MAX_RA_DELAY_TIME 500000 /* usec */
|
|
|
|
struct prefix {
|
|
struct prefix *next; /* forward link */
|
|
struct prefix *prev; /* previous link */
|
|
|
|
u_int32_t validlifetime; /* AdvValidLifetime */
|
|
u_int32_t preflifetime; /* AdvPreferredLifetime */
|
|
u_int onlinkflg; /* bool: AdvOnLinkFlag */
|
|
u_int autoconfflg; /* bool: AdvAutonomousFlag */
|
|
int prefixlen;
|
|
struct in6_addr prefix;
|
|
};
|
|
|
|
struct rainfo {
|
|
/* pointer for list */
|
|
struct rainfo *next;
|
|
|
|
/* timer related parameters */
|
|
struct rtadvd_timer *timer;
|
|
int initcounter; /* counter for the first few advertisements */
|
|
struct timeval lastsent; /* timestamp when the lates RA was sent */
|
|
int waiting; /* number of RS waiting for RA */
|
|
|
|
/* interface information */
|
|
int ifindex;
|
|
int advlinkopt; /* bool: whether include link-layer addr opt */
|
|
struct sockaddr_dl *sdl;
|
|
char ifname[16];
|
|
int phymtu; /* mtu of the physical interface */
|
|
|
|
/* Router configuration variables */
|
|
u_short lifetime; /* AdvDefaultLifetime */
|
|
u_int maxinterval; /* MaxRtrAdvInterval */
|
|
u_int mininterval; /* MinRtrAdvInterval */
|
|
int managedflg; /* AdvManagedFlag */
|
|
int otherflg; /* AdvOtherConfigFlag */
|
|
u_int32_t linkmtu; /* AdvLinkMTU */
|
|
u_int32_t reachabletime; /* AdvReachableTime */
|
|
u_int32_t retranstimer; /* AdvRetransTimer */
|
|
u_int hoplimit; /* AdvCurHopLimit */
|
|
struct prefix prefix; /* AdvPrefixList(link head) */
|
|
int pfxs; /* number of prefixes */
|
|
|
|
/* actual RA packet data and its length */
|
|
size_t ra_datalen;
|
|
u_char *ra_data;
|
|
};
|
|
|
|
void ra_timeout __P((void *));
|
|
void ra_timer_update __P((void *, struct timeval *));
|