1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/netinet6_ip6_var.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
//####BSDCOPYRIGHTBEGIN####
|
9 |
|
|
//
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
//
|
12 |
|
|
// Portions of this software may have been derived from OpenBSD or other sources,
|
13 |
|
|
// and are covered by the appropriate copyright disclaimers included herein.
|
14 |
|
|
//
|
15 |
|
|
// -------------------------------------------
|
16 |
|
|
//
|
17 |
|
|
//####BSDCOPYRIGHTEND####
|
18 |
|
|
//==========================================================================
|
19 |
|
|
//#####DESCRIPTIONBEGIN####
|
20 |
|
|
//
|
21 |
|
|
// Author(s): gthomas
|
22 |
|
|
// Contributors: gthomas
|
23 |
|
|
// Date: 2000-01-10
|
24 |
|
|
// Purpose:
|
25 |
|
|
// Description:
|
26 |
|
|
//
|
27 |
|
|
//
|
28 |
|
|
//####DESCRIPTIONEND####
|
29 |
|
|
//
|
30 |
|
|
//==========================================================================
|
31 |
|
|
|
32 |
|
|
/* $OpenBSD: ip6_var.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
|
33 |
|
|
|
34 |
|
|
/*
|
35 |
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
36 |
|
|
* All rights reserved.
|
37 |
|
|
*
|
38 |
|
|
* Redistribution and use in source and binary forms, with or without
|
39 |
|
|
* modification, are permitted provided that the following conditions
|
40 |
|
|
* are met:
|
41 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
42 |
|
|
* notice, this list of conditions and the following disclaimer.
|
43 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
44 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
45 |
|
|
* documentation and/or other materials provided with the distribution.
|
46 |
|
|
* 3. Neither the name of the project nor the names of its contributors
|
47 |
|
|
* may be used to endorse or promote products derived from this software
|
48 |
|
|
* without specific prior written permission.
|
49 |
|
|
*
|
50 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
51 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
52 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
53 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
54 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
55 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
56 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
57 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
58 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
59 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
60 |
|
|
* SUCH DAMAGE.
|
61 |
|
|
*/
|
62 |
|
|
|
63 |
|
|
/*
|
64 |
|
|
* Copyright (c) 1982, 1986, 1993
|
65 |
|
|
* The Regents of the University of California. All rights reserved.
|
66 |
|
|
*
|
67 |
|
|
* Redistribution and use in source and binary forms, with or without
|
68 |
|
|
* modification, are permitted provided that the following conditions
|
69 |
|
|
* are met:
|
70 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
71 |
|
|
* notice, this list of conditions and the following disclaimer.
|
72 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
73 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
74 |
|
|
* documentation and/or other materials provided with the distribution.
|
75 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
76 |
|
|
* must display the following acknowledgement:
|
77 |
|
|
* This product includes software developed by the University of
|
78 |
|
|
* California, Berkeley and its contributors.
|
79 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
80 |
|
|
* may be used to endorse or promote products derived from this software
|
81 |
|
|
* without specific prior written permission.
|
82 |
|
|
*
|
83 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
84 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
85 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
86 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
87 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
88 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
89 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
90 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
91 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
92 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
93 |
|
|
* SUCH DAMAGE.
|
94 |
|
|
*
|
95 |
|
|
* @(#)ip_var.h 8.1 (Berkeley) 6/10/93
|
96 |
|
|
*/
|
97 |
|
|
|
98 |
|
|
#ifndef _NETINET6_IP6_VAR_H_
|
99 |
|
|
#define _NETINET6_IP6_VAR_H_
|
100 |
|
|
|
101 |
|
|
/*
|
102 |
|
|
* IP6 reassembly queue structure. Each fragment
|
103 |
|
|
* being reassembled is attached to one of these structures.
|
104 |
|
|
*/
|
105 |
|
|
struct ip6q {
|
106 |
|
|
u_long ip6q_head;
|
107 |
|
|
u_short ip6q_len;
|
108 |
|
|
u_char ip6q_nxt;
|
109 |
|
|
u_char ip6q_hlim;
|
110 |
|
|
struct ip6asfrag *ip6q_down;
|
111 |
|
|
struct ip6asfrag *ip6q_up;
|
112 |
|
|
u_long ip6q_ident;
|
113 |
|
|
u_char ip6q_arrive;
|
114 |
|
|
u_char ip6q_ttl;
|
115 |
|
|
struct in6_addr ip6q_src, ip6q_dst;
|
116 |
|
|
struct ip6q *ip6q_next;
|
117 |
|
|
struct ip6q *ip6q_prev;
|
118 |
|
|
int ip6q_unfrglen;
|
119 |
|
|
#ifdef notyet
|
120 |
|
|
u_char *ip6q_nxtp;
|
121 |
|
|
#endif
|
122 |
|
|
};
|
123 |
|
|
|
124 |
|
|
struct ip6asfrag {
|
125 |
|
|
u_long ip6af_head;
|
126 |
|
|
u_short ip6af_len;
|
127 |
|
|
u_char ip6af_nxt;
|
128 |
|
|
u_char ip6af_hlim;
|
129 |
|
|
/* must not override the above members during reassembling */
|
130 |
|
|
struct ip6asfrag *ip6af_down;
|
131 |
|
|
struct ip6asfrag *ip6af_up;
|
132 |
|
|
u_short ip6af_mff;
|
133 |
|
|
u_short ip6af_off;
|
134 |
|
|
struct mbuf *ip6af_m;
|
135 |
|
|
u_long ip6af_offset; /* offset where next header starts */
|
136 |
|
|
u_short ip6af_frglen; /* fragmentable part length */
|
137 |
|
|
u_char ip6af_x1[10];
|
138 |
|
|
};
|
139 |
|
|
|
140 |
|
|
#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
|
141 |
|
|
|
142 |
|
|
struct ip6_moptions {
|
143 |
|
|
struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
|
144 |
|
|
u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */
|
145 |
|
|
u_char im6o_multicast_loop; /* 1 >= hear sends if a member */
|
146 |
|
|
LIST_HEAD(, in6_multi_mship) im6o_memberships;
|
147 |
|
|
};
|
148 |
|
|
|
149 |
|
|
/*
|
150 |
|
|
* Control options for outgoing packets
|
151 |
|
|
*/
|
152 |
|
|
|
153 |
|
|
/* Routing header related info */
|
154 |
|
|
struct ip6po_rhinfo {
|
155 |
|
|
struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
|
156 |
|
|
struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */
|
157 |
|
|
};
|
158 |
|
|
#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
|
159 |
|
|
#define ip6po_route ip6po_rhinfo.ip6po_rhi_route
|
160 |
|
|
|
161 |
|
|
struct ip6_pktopts {
|
162 |
|
|
struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */
|
163 |
|
|
int ip6po_hlim; /* Hoplimit for outgoing packets */
|
164 |
|
|
struct in6_pktinfo *ip6po_pktinfo; /* Outgoing IF/address information */
|
165 |
|
|
struct sockaddr *ip6po_nexthop; /* Next-hop address */
|
166 |
|
|
struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
|
167 |
|
|
struct ip6_dest *ip6po_dest1; /* Destination options header(1st part) */
|
168 |
|
|
struct ip6po_rhinfo ip6po_rhinfo; /* Routing header related info. */
|
169 |
|
|
struct ip6_dest *ip6po_dest2; /* Destination options header(2nd part) */
|
170 |
|
|
};
|
171 |
|
|
|
172 |
|
|
struct ip6stat {
|
173 |
|
|
u_quad_t ip6s_total; /* total packets received */
|
174 |
|
|
u_quad_t ip6s_tooshort; /* packet too short */
|
175 |
|
|
u_quad_t ip6s_toosmall; /* not enough data */
|
176 |
|
|
u_quad_t ip6s_fragments; /* fragments received */
|
177 |
|
|
u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
|
178 |
|
|
u_quad_t ip6s_fragtimeout; /* fragments timed out */
|
179 |
|
|
u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */
|
180 |
|
|
u_quad_t ip6s_forward; /* packets forwarded */
|
181 |
|
|
u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */
|
182 |
|
|
u_quad_t ip6s_redirectsent; /* packets forwarded on same net */
|
183 |
|
|
u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/
|
184 |
|
|
u_quad_t ip6s_localout; /* total ip packets generated here */
|
185 |
|
|
u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */
|
186 |
|
|
u_quad_t ip6s_reassembled; /* total packets reassembled ok */
|
187 |
|
|
u_quad_t ip6s_fragmented; /* datagrams sucessfully fragmented */
|
188 |
|
|
u_quad_t ip6s_ofragments; /* output fragments created */
|
189 |
|
|
u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
|
190 |
|
|
u_quad_t ip6s_badoptions; /* error in option processing */
|
191 |
|
|
u_quad_t ip6s_noroute; /* packets discarded due to no route */
|
192 |
|
|
u_quad_t ip6s_badvers; /* ip6 version != 6 */
|
193 |
|
|
u_quad_t ip6s_rawout; /* total raw ip packets generated */
|
194 |
|
|
u_quad_t ip6s_badscope; /* scope error */
|
195 |
|
|
u_quad_t ip6s_notmember; /* don't join this multicast group */
|
196 |
|
|
u_quad_t ip6s_nxthist[256]; /* next header history */
|
197 |
|
|
u_quad_t ip6s_m1; /* one mbuf */
|
198 |
|
|
u_quad_t ip6s_m2m[32]; /* two or more mbuf */
|
199 |
|
|
u_quad_t ip6s_mext1; /* one ext mbuf */
|
200 |
|
|
u_quad_t ip6s_mext2m; /* two or more ext mbuf */
|
201 |
|
|
u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */
|
202 |
|
|
u_quad_t ip6s_nogif; /* no match gif found */
|
203 |
|
|
u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
|
204 |
|
|
/* XXX the following two items are not really AF_INET6 thing */
|
205 |
|
|
u_quad_t ip6s_pulldown; /* # of calls to m_pulldown */
|
206 |
|
|
u_quad_t ip6s_pulldown_copy; /* # of mbuf copies in m_pulldown */
|
207 |
|
|
u_quad_t ip6s_pulldown_alloc; /* # of mbuf allocs in m_pulldown */
|
208 |
|
|
};
|
209 |
|
|
|
210 |
|
|
#ifdef _KERNEL
|
211 |
|
|
/* flags passed to ip6_output as last parameter */
|
212 |
|
|
#define IPV6_DADOUTPUT 0x01 /* DAD */
|
213 |
|
|
#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
|
214 |
|
|
|
215 |
|
|
extern struct ip6stat ip6stat; /* statistics */
|
216 |
|
|
extern u_int32_t ip6_id; /* fragment identifier */
|
217 |
|
|
extern int ip6_defhlim; /* default hop limit */
|
218 |
|
|
extern int ip6_defmcasthlim; /* default multicast hop limit */
|
219 |
|
|
extern int ip6_forwarding; /* act as router? */
|
220 |
|
|
extern int ip6_forward_srcrt; /* forward src-routed? */
|
221 |
|
|
extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
|
222 |
|
|
extern int ip6_use_deprecated; /* allow deprecated addr as source */
|
223 |
|
|
extern int ip6_rr_prune; /* router renumbering prefix
|
224 |
|
|
* walk list every 5 sec. */
|
225 |
|
|
#ifdef MAPPED_ADDR_ENABLED
|
226 |
|
|
extern int ip6_mapped_addr_on;
|
227 |
|
|
#endif /* MAPPED_ADDR_ENABLED */
|
228 |
|
|
|
229 |
|
|
extern struct socket *ip6_mrouter; /* multicast routing daemon */
|
230 |
|
|
extern int ip6_sendredirects; /* send IP redirects when forwarding? */
|
231 |
|
|
extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
|
232 |
|
|
extern int ip6_sourcecheck; /* Verify source interface */
|
233 |
|
|
extern int ip6_sourcecheck_interval; /* Interval between log messages */
|
234 |
|
|
extern int ip6_accept_rtadv; /* Acts as a host not a router */
|
235 |
|
|
extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
|
236 |
|
|
extern int ip6_log_interval;
|
237 |
|
|
extern time_t ip6_log_time;
|
238 |
|
|
extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
|
239 |
|
|
extern int ip6_dad_count; /* DupAddrDetectionTransmits */
|
240 |
|
|
|
241 |
|
|
extern u_int32_t ip6_flow_seq;
|
242 |
|
|
extern int ip6_auto_flowlabel;
|
243 |
|
|
|
244 |
|
|
struct in6pcb;
|
245 |
|
|
struct inpcb;
|
246 |
|
|
|
247 |
|
|
int icmp6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
|
248 |
|
|
|
249 |
|
|
void ip6_init __P((void));
|
250 |
|
|
void ip6intr __P((void));
|
251 |
|
|
void ip6_input __P((struct mbuf *));
|
252 |
|
|
void ip6_freemoptions __P((struct ip6_moptions *));
|
253 |
|
|
int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));
|
254 |
|
|
char * ip6_get_prevhdr __P((struct mbuf *, int));
|
255 |
|
|
int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *));
|
256 |
|
|
int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
|
257 |
|
|
u_int32_t *));
|
258 |
|
|
void ip6_savecontrol __P((struct inpcb *, struct mbuf **, struct ip6_hdr *,
|
259 |
|
|
struct mbuf *));
|
260 |
|
|
int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
|
261 |
|
|
|
262 |
|
|
void ip6_forward __P((struct mbuf *, int));
|
263 |
|
|
|
264 |
|
|
void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
|
265 |
|
|
int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
|
266 |
|
|
struct route_in6 *, int,
|
267 |
|
|
struct ip6_moptions *, struct ifnet **));
|
268 |
|
|
int ip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
|
269 |
|
|
int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int));
|
270 |
|
|
int ip6_optlen __P((struct inpcb *));
|
271 |
|
|
|
272 |
|
|
int route6_input __P((struct mbuf **, int *, int));
|
273 |
|
|
|
274 |
|
|
void frag6_init __P((void));
|
275 |
|
|
int frag6_input __P((struct mbuf **, int *, int));
|
276 |
|
|
void frag6_slowtimo __P((void));
|
277 |
|
|
void frag6_drain __P((void));
|
278 |
|
|
|
279 |
|
|
void rip6_init __P((void));
|
280 |
|
|
int rip6_input __P((struct mbuf **mp, int *offp, int proto));
|
281 |
|
|
int rip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
|
282 |
|
|
int rip6_output __P((struct mbuf *, ...));
|
283 |
|
|
int rip6_usrreq __P((struct socket *,
|
284 |
|
|
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
|
285 |
|
|
|
286 |
|
|
int dest6_input __P((struct mbuf **, int *, int));
|
287 |
|
|
int none_input __P((struct mbuf **, int *, int));
|
288 |
|
|
#endif /* _KERNEL */
|
289 |
|
|
|
290 |
|
|
#endif /* !_NETINET6_IP6_VAR_H_ */
|