Home | History | Annotate | Line # | Download | only in rtadvd
rtadvd.h revision 1.3
      1 /*	$NetBSD: rtadvd.h,v 1.3 2000/03/13 06:16:46 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 /*XXX int-to-double comparison for INTERVAL items */
     47 #ifndef MIP6
     48 #define mobileip6 0
     49 #endif
     50 
     51 #define MAXROUTERLIFETIME 9000
     52 #define MIN_MAXINTERVAL (mobileip6 ? 1.5 : 4.0)
     53 #define MAX_MAXINTERVAL 1800
     54 #define MIN_MININTERVAL	(mobileip6 ? 0.5 : 3)
     55 #define MAXREACHABLETIME 3600000
     56 
     57 #ifndef MIP6
     58 #undef miobileip6
     59 #endif
     60 
     61 #define MAX_INITIAL_RTR_ADVERT_INTERVAL  16
     62 #define MAX_INITIAL_RTR_ADVERTISEMENTS    3
     63 #define MAX_FINAL_RTR_ADVERTISEMENTS      3
     64 #define MIN_DELAY_BETWEEN_RAS             3
     65 #define MAX_RA_DELAY_TIME                 500000 /* usec */
     66 
     67 struct prefix {
     68 	struct prefix *next;	/* forward link */
     69 	struct prefix *prev;	/* previous link */
     70 
     71 	u_int32_t validlifetime; /* AdvValidLifetime */
     72 	u_int32_t preflifetime;	/* AdvPreferredLifetime */
     73 	u_int onlinkflg;	/* bool: AdvOnLinkFlag */
     74 	u_int autoconfflg;	/* bool: AdvAutonomousFlag */
     75 #ifdef MIP6
     76 	u_int routeraddr;	/* bool: RouterAddress */
     77 #endif
     78 	int	prefixlen;
     79 	struct in6_addr prefix;
     80 };
     81 
     82 struct	rainfo {
     83 	/* pointer for list */
     84 	struct	rainfo *next;
     85 
     86 	/* timer related parameters */
     87 	struct rtadvd_timer *timer;
     88 	int initcounter; /* counter for the first few advertisements */
     89 	struct timeval lastsent; /* timestamp when the lates RA was sent */
     90 	int waiting;		/* number of RS waiting for RA */
     91 
     92 	/* interface information */
     93 	int	ifindex;
     94 	int	advlinkopt;	/* bool: whether include link-layer addr opt */
     95 	struct sockaddr_dl *sdl;
     96 	char	ifname[16];
     97 	int	phymtu;		/* mtu of the physical interface */
     98 
     99 	/* Router configuration variables */
    100 	u_short lifetime;	/* AdvDefaultLifetime */
    101 	u_int	maxinterval;	/* MaxRtrAdvInterval */
    102 	u_int	mininterval;	/* MinRtrAdvInterval */
    103 	int 	managedflg;	/* AdvManagedFlag */
    104 	int	otherflg;	/* AdvOtherConfigFlag */
    105 #ifdef MIP6
    106 	int	haflg;		/* HAFlag */
    107 #endif
    108 	u_int32_t linkmtu;	/* AdvLinkMTU */
    109 	u_int32_t reachabletime; /* AdvReachableTime */
    110 	u_int32_t retranstimer;	/* AdvRetransTimer */
    111 	u_int	hoplimit;	/* AdvCurHopLimit */
    112 	struct prefix prefix;	/* AdvPrefixList(link head) */
    113 	int	pfxs;		/* number of prefixes */
    114 
    115 #ifdef MIP6
    116 	u_short	hapref;		/* Home Agent Preference */
    117 	u_short	hatime;		/* Home Agent Lifetime */
    118 #endif
    119 
    120 	/* actual RA packet data and its length */
    121 	size_t ra_datalen;
    122 	u_char *ra_data;
    123 };
    124 
    125 void ra_timeout __P((void *));
    126 void ra_timer_update __P((void *, struct timeval *));
    127 
    128 #ifdef MIP6
    129 extern int mobileip6;
    130 #endif
    131