Home | History | Annotate | Line # | Download | only in rtadvd
rtadvd.h revision 1.2
      1 /*	$NetBSD: rtadvd.h,v 1.2 1999/07/06 13:02:09 itojun Exp $	*/
      2 
      3 /*
      4  * Copyright (C) 1998 WIDE Project.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. Neither the name of the project nor the names of its contributors
     16  *    may be used to endorse or promote products derived from this software
     17  *    without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  */
     31 
     32 #define ALLNODES "ff02::1"
     33 #define ALLROUTERS "ff02::2"
     34 #define ANY "::"
     35 #define RTSOLLEN 8
     36 
     37 /* protocol constants and default values */
     38 #define DEF_MAXRTRADVINTERVAL 600
     39 #define DEF_ADVLINKMTU 0
     40 #define DEF_ADVREACHABLETIME 0
     41 #define DEF_ADVRETRANSTIMER 0
     42 #define DEF_ADVCURHOPLIMIT 64
     43 #define DEF_ADVVALIDLIFETIME 2592000
     44 #define DEF_ADVPREFERREDLIFETIME 604800
     45 
     46 #define MAXROUTERLIFETIME 9000
     47 #define MIN_MAXINTERVAL 4
     48 #define MAX_MAXINTERVAL 1800
     49 #define MIN_MININTERVAL 3
     50 #define MAXREACHABLETIME 3600000
     51 
     52 #define MAX_INITIAL_RTR_ADVERT_INTERVAL  16
     53 #define MAX_INITIAL_RTR_ADVERTISEMENTS    3
     54 #define MAX_FINAL_RTR_ADVERTISEMENTS      3
     55 #define MIN_DELAY_BETWEEN_RAS             3
     56 #define MAX_RA_DELAY_TIME                 500000 /* usec */
     57 
     58 struct prefix {
     59 	struct prefix *next;	/* forward link */
     60 	struct prefix *prev;	/* previous link */
     61 
     62 	u_int32_t validlifetime; /* AdvValidLifetime */
     63 	u_int32_t preflifetime;	/* AdvPreferredLifetime */
     64 	u_int onlinkflg;	/* bool: AdvOnLinkFlag */
     65 	u_int autoconfflg;	/* bool: AdvAutonomousFlag */
     66 	int	prefixlen;
     67 	struct in6_addr prefix;
     68 };
     69 
     70 struct	rainfo {
     71 	/* pointer for list */
     72 	struct	rainfo *next;
     73 
     74 	/* timer related parameters */
     75 	struct rtadvd_timer *timer;
     76 	int initcounter; /* counter for the first few advertisements */
     77 	struct timeval lastsent; /* timestamp when the lates RA was sent */
     78 	int waiting;		/* number of RS waiting for RA */
     79 
     80 	/* interface information */
     81 	int	ifindex;
     82 	int	advlinkopt;	/* bool: whether include link-layer addr opt */
     83 	struct sockaddr_dl *sdl;
     84 	char	ifname[16];
     85 	int	phymtu;		/* mtu of the physical interface */
     86 
     87 	/* Router configuration variables */
     88 	u_short lifetime;	/* AdvDefaultLifetime */
     89 	u_int	maxinterval;	/* MaxRtrAdvInterval */
     90 	u_int	mininterval;	/* MinRtrAdvInterval */
     91 	int 	managedflg;	/* AdvManagedFlag */
     92 	int	otherflg;	/* AdvOtherConfigFlag */
     93 	u_int32_t linkmtu;	/* AdvLinkMTU */
     94 	u_int32_t reachabletime; /* AdvReachableTime */
     95 	u_int32_t retranstimer;	/* AdvRetransTimer */
     96 	u_int	hoplimit;	/* AdvCurHopLimit */
     97 	struct prefix prefix;	/* AdvPrefixList(link head) */
     98 	int	pfxs;		/* number of prefixes */
     99 
    100 	/* actual RA packet data and its length */
    101 	size_t ra_datalen;
    102 	u_char *ra_data;
    103 };
    104 
    105 void ra_timeout __P((void *));
    106 void ra_timer_update __P((void *, struct timeval *));
    107