1 /* $KAME: rtsold.h,v 1.19 2003/04/16 09:48:15 itojun Exp $ */
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
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
35 TAILQ_ENTRY(script_msg) sm_next;
41 TAILQ_ENTRY(ra_opt) rao_next;
44 struct timeval rao_expire;
49 TAILQ_HEAD(rainfo_head, ra_opt);
52 TAILQ_ENTRY(rainfo) rai_next;
54 struct ifinfo *rai_ifinfo;
55 struct sockaddr_in6 rai_saddr;
56 TAILQ_HEAD(, ra_opt) rai_ra_opt;
60 TAILQ_ENTRY(ifinfo) ifi_next; /* pointer to the next interface */
62 struct sockaddr_dl *sdl; /* link-layer address */
63 char ifname[IF_NAMESIZE]; /* interface name */
64 u_int32_t linkid; /* link ID of this interface */
65 int active; /* interface status */
66 int probeinterval; /* interval of probe timer (if necessary) */
67 int probetimer; /* rest of probe timer */
68 int mediareqok; /* wheter the IF supports SIOCGIFMEDIA */
69 int otherconfig; /* need a separate protocol for the "other"
75 struct timeval expire;
76 int errors; /* # of errors we've got - detect wedge */
77 #define IFI_DNSOPT_STATE_NOINFO 0
78 #define IFI_DNSOPT_STATE_RECEIVED 1
79 int ifi_rdnss; /* RDNSS option state */
80 int ifi_dnssl; /* DNSSL option state */
82 int racnt; /* total # of valid RAs it have got */
83 TAILQ_HEAD(, rainfo) ifi_rainfo;
89 /* per interface status */
94 #define IFS_TENTATIVE 4
97 extern TAILQ_HEAD(ifinfo_head_t, ifinfo) ifinfo_head;
100 * RFC 3542 API deprecates IPV6_PKTINFO in favor of
103 #ifndef IPV6_RECVPKTINFO
105 #define IPV6_RECVPKTINFO IPV6_PKTINFO
109 * RFC 3542 API deprecates IPV6_HOPLIMIT in favor of
112 #ifndef IPV6_RECVHOPLIMIT
114 #define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT
118 #ifndef IN6ADDR_LINKLOCAL_ALLROUTERS_INIT
119 #define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
120 {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
125 extern struct timeval tm_max;
129 extern const char *otherconf_script;
130 extern const char *resolvconf_script;
131 extern int ifconfig(char *);
132 extern void iflist_init(void);
133 struct ifinfo *find_ifinfo(int);
134 struct rainfo *find_rainfo(struct ifinfo *, struct sockaddr_in6 *);
135 void rtsol_timer_update(struct ifinfo *);
136 extern void warnmsg(int, const char *, const char *, ...)
137 __attribute__((__format__(__printf__, 3, 4)));
138 extern char **autoifprobe(void);
139 extern int ra_opt_handler(struct ifinfo *);
142 extern int ifinit(void);
143 extern int interface_up(char *);
144 extern int interface_status(struct ifinfo *);
145 extern int lladdropt_length(struct sockaddr_dl *);
146 extern void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
147 extern struct sockaddr_dl *if_nametosdl(char *);
148 extern int getinet6sysctl(int);
149 extern int setinet6sysctl(int, int);
152 extern int sockopen(void);
153 extern void sendpacket(struct ifinfo *);
154 extern void rtsol_input(int);
157 extern int probe_init(void);
158 extern void defrouter_probe(struct ifinfo *);
161 extern void rtsold_dump_file(const char *);
162 extern const char *sec2str(const struct timeval *);
165 extern int rtsock_open(void);
166 extern int rtsock_input(int);