xref: /freebsd/sys/netinet6/ip6_var.h (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (C) 1995, 1996, 1997, and 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  *	$KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $
32  */
33 
34 /*-
35  * Copyright (c) 1982, 1986, 1993
36  *	The Regents of the University of California.  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 University 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 REGENTS 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 REGENTS 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 #ifndef _NETINET6_IP6_VAR_H_
64 #define _NETINET6_IP6_VAR_H_
65 
66 #include <sys/epoch.h>
67 
68 #ifdef _KERNEL
69 struct ip6asfrag;		/* frag6.c */
70 TAILQ_HEAD(ip6fraghead, ip6asfrag);
71 
72 /*
73  * IP6 reassembly queue structure.  Each fragment
74  * being reassembled is attached to one of these structures.
75  */
76 struct	ip6q {
77 	struct ip6fraghead ip6q_frags;
78 	u_int32_t	ip6q_ident;
79 	u_int8_t	ip6q_nxt;
80 	u_int8_t	ip6q_ecn;
81 	u_int16_t	ip6q_ttl;
82 	struct in6_addr ip6q_src, ip6q_dst;
83 	TAILQ_ENTRY(ip6q) ip6q_tq;
84 	int		ip6q_unfrglen;	/* len of unfragmentable part */
85 	int		ip6q_nfrag;	/* # of fragments */
86 	struct label	*ip6q_label;
87 };
88 #endif /* _KERNEL */
89 
90 /*
91  * IP6 reinjecting structure.
92  */
93 struct ip6_direct_ctx {
94 	uint32_t	ip6dc_nxt;	/* next header to process */
95 	uint32_t	ip6dc_off;	/* offset to next header */
96 };
97 
98 #if defined(_NETINET6_IN6_VAR_H_) && defined(_KERNEL)
99 /*
100  * Structure attached to inpcb.in6p_moptions and
101  * passed to ip6_output when IPv6 multicast options are in use.
102  * This structure is lazy-allocated.
103  */
104 struct ip6_moptions {
105 	struct	ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
106 	u_char	im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
107 	u_char	im6o_multicast_loop;	/* 1 >= hear sends if a member */
108 	struct ip6_mfilter_head im6o_head; /* group membership list */
109 };
110 #else
111 struct ip6_moptions;
112 #endif
113 /*
114  * Control options for outgoing packets
115  */
116 
117 /* Routing header related info */
118 struct	ip6po_rhinfo {
119 	struct	ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
120 	struct	route_in6 ip6po_rhi_route; /* Route to the 1st hop */
121 };
122 #define ip6po_rthdr	ip6po_rhinfo.ip6po_rhi_rthdr
123 #define ip6po_route	ip6po_rhinfo.ip6po_rhi_route
124 
125 /* Nexthop related info */
126 struct	ip6po_nhinfo {
127 	struct	sockaddr *ip6po_nhi_nexthop;
128 	struct	route_in6 ip6po_nhi_route; /* Route to the nexthop */
129 };
130 #define ip6po_nexthop	ip6po_nhinfo.ip6po_nhi_nexthop
131 #define ip6po_nextroute	ip6po_nhinfo.ip6po_nhi_route
132 
133 struct	ip6_pktopts {
134 	struct	mbuf *ip6po_m;	/* Pointer to mbuf storing the data */
135 	int	ip6po_hlim;	/* Hoplimit for outgoing packets */
136 
137 	/* Outgoing IF/address information */
138 	struct	in6_pktinfo *ip6po_pktinfo;
139 
140 	/* Next-hop address information */
141 	struct	ip6po_nhinfo ip6po_nhinfo;
142 
143 	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
144 
145 	/* Destination options header (before a routing header) */
146 	struct	ip6_dest *ip6po_dest1;
147 
148 	/* Routing header related info. */
149 	struct	ip6po_rhinfo ip6po_rhinfo;
150 
151 	/* Destination options header (after a routing header) */
152 	struct	ip6_dest *ip6po_dest2;
153 
154 	int	ip6po_tclass;	/* traffic class */
155 
156 	int	ip6po_minmtu;  /* fragment vs PMTU discovery policy */
157 #define IP6PO_MINMTU_MCASTONLY	-1 /* default; send at min MTU for multicast*/
158 #define IP6PO_MINMTU_DISABLE	 0 /* always perform pmtu disc */
159 #define IP6PO_MINMTU_ALL	 1 /* always send at min MTU */
160 
161 	int	ip6po_prefer_tempaddr;  /* whether temporary addresses are
162 					   preferred as source address */
163 #define IP6PO_TEMPADDR_SYSTEM	-1 /* follow the system default */
164 #define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
165 #define IP6PO_TEMPADDR_PREFER	 1 /* prefer temporary address */
166 
167 	int ip6po_flags;
168 #if 0	/* parameters in this block is obsolete. do not reuse the values. */
169 #define IP6PO_REACHCONF	0x01	/* upper-layer reachability confirmation. */
170 #define IP6PO_MINMTU	0x02	/* use minimum MTU (IPV6_USE_MIN_MTU) */
171 #endif
172 #define IP6PO_DONTFRAG	0x04	/* disable fragmentation (IPV6_DONTFRAG) */
173 #define IP6PO_USECOA	0x08	/* use care of address */
174 };
175 
176 /*
177  * Control options for incoming packets
178  */
179 
180 struct	ip6stat {
181 	uint64_t ip6s_total;		/* total packets received */
182 	uint64_t ip6s_tooshort;		/* packet too short */
183 	uint64_t ip6s_toosmall;		/* not enough data */
184 	uint64_t ip6s_fragments;	/* fragments received */
185 	uint64_t ip6s_fragdropped;	/* frags dropped(dups, out of space) */
186 	uint64_t ip6s_fragtimeout;	/* fragments timed out */
187 	uint64_t ip6s_fragoverflow;	/* fragments that exceeded limit */
188 	uint64_t ip6s_forward;		/* packets forwarded */
189 	uint64_t ip6s_cantforward;	/* packets rcvd for unreachable dest */
190 	uint64_t ip6s_redirectsent;	/* packets forwarded on same net */
191 	uint64_t ip6s_delivered;	/* datagrams delivered to upper level*/
192 	uint64_t ip6s_localout;		/* total ip packets generated here */
193 	uint64_t ip6s_odropped;		/* lost packets due to nobufs, etc. */
194 	uint64_t ip6s_reassembled;	/* total packets reassembled ok */
195 	uint64_t ip6s_atomicfrags;	/* atomic fragments */
196 	uint64_t ip6s_fragmented;	/* datagrams successfully fragmented */
197 	uint64_t ip6s_ofragments;	/* output fragments created */
198 	uint64_t ip6s_cantfrag;		/* don't fragment flag was set, etc. */
199 	uint64_t ip6s_badoptions;	/* error in option processing */
200 	uint64_t ip6s_noroute;		/* packets discarded due to no route */
201 	uint64_t ip6s_badvers;		/* ip6 version != 6 */
202 	uint64_t ip6s_rawout;		/* total raw ip packets generated */
203 	uint64_t ip6s_badscope;		/* scope error */
204 	uint64_t ip6s_notmember;	/* don't join this multicast group */
205 #define	IP6S_HDRCNT		256	/* headers count */
206 	uint64_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
207 	uint64_t ip6s_m1;		/* one mbuf */
208 #define	IP6S_M2MMAX		32
209 	uint64_t ip6s_m2m[IP6S_M2MMAX];	/* two or more mbuf */
210 	uint64_t ip6s_mext1;		/* one ext mbuf */
211 	uint64_t ip6s_mext2m;		/* two or more ext mbuf */
212 	uint64_t ip6s_exthdrtoolong;	/* ext hdr are not contiguous */
213 	uint64_t ip6s_nogif;		/* no match gif found */
214 	uint64_t ip6s_toomanyhdr;	/* discarded due to too many headers */
215 
216 	/*
217 	 * statistics for improvement of the source address selection
218 	 * algorithm:
219 	 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
220 	 */
221 #define	IP6S_RULESMAX		16
222 #define	IP6S_SCOPECNT		16
223 	/* number of times that address selection fails */
224 	uint64_t ip6s_sources_none;
225 	/* number of times that an address on the outgoing I/F is chosen */
226 	uint64_t ip6s_sources_sameif[IP6S_SCOPECNT];
227 	/* number of times that an address on a non-outgoing I/F is chosen */
228 	uint64_t ip6s_sources_otherif[IP6S_SCOPECNT];
229 	/*
230 	 * number of times that an address that has the same scope
231 	 * from the destination is chosen.
232 	 */
233 	uint64_t ip6s_sources_samescope[IP6S_SCOPECNT];
234 	/*
235 	 * number of times that an address that has a different scope
236 	 * from the destination is chosen.
237 	 */
238 	uint64_t ip6s_sources_otherscope[IP6S_SCOPECNT];
239 	/* number of times that a deprecated address is chosen */
240 	uint64_t ip6s_sources_deprecated[IP6S_SCOPECNT];
241 
242 	/* number of times that each rule of source selection is applied. */
243 	uint64_t ip6s_sources_rule[IP6S_RULESMAX];
244 };
245 
246 #ifdef _KERNEL
247 #include <sys/counter.h>
248 
249 VNET_PCPUSTAT_DECLARE(struct ip6stat, ip6stat);
250 #define	IP6STAT_ADD(name, val)	\
251     VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val))
252 #define	IP6STAT_SUB(name, val)	IP6STAT_ADD(name, -(val))
253 #define	IP6STAT_INC(name)	IP6STAT_ADD(name, 1)
254 #define	IP6STAT_DEC(name)	IP6STAT_SUB(name, 1)
255 #endif
256 
257 #ifdef _KERNEL
258 /* flags passed to ip6_output as last parameter */
259 #define	IPV6_UNSPECSRC		0x01	/* allow :: as the source address */
260 #define	IPV6_FORWARDING		0x02	/* most of IPv6 header exists */
261 #define	IPV6_MINMTU		0x04	/* use minimum MTU (IPV6_USE_MIN_MTU) */
262 
263 #ifdef __NO_STRICT_ALIGNMENT
264 #define IP6_HDR_ALIGNED_P(ip)	1
265 #else
266 #define IP6_HDR_ALIGNED_P(ip)	((((intptr_t) (ip)) & 3) == 0)
267 #endif
268 
269 VNET_DECLARE(int, ip6_defhlim);		/* default hop limit */
270 VNET_DECLARE(int, ip6_defmcasthlim);	/* default multicast hop limit */
271 VNET_DECLARE(int, ip6_forwarding);	/* act as router? */
272 VNET_DECLARE(int, ip6_use_deprecated);	/* allow deprecated addr as source */
273 VNET_DECLARE(int, ip6_rr_prune);	/* router renumbering prefix
274 					 * walk list every 5 sec.    */
275 VNET_DECLARE(int, ip6_mcast_pmtu);	/* enable pMTU discovery for multicast? */
276 VNET_DECLARE(int, ip6_v6only);
277 #define	V_ip6_defhlim			VNET(ip6_defhlim)
278 #define	V_ip6_defmcasthlim		VNET(ip6_defmcasthlim)
279 #define	V_ip6_forwarding		VNET(ip6_forwarding)
280 #define	V_ip6_use_deprecated		VNET(ip6_use_deprecated)
281 #define	V_ip6_rr_prune			VNET(ip6_rr_prune)
282 #define	V_ip6_mcast_pmtu		VNET(ip6_mcast_pmtu)
283 #define	V_ip6_v6only			VNET(ip6_v6only)
284 
285 VNET_DECLARE(struct socket *, ip6_mrouter);	/* multicast routing daemon */
286 VNET_DECLARE(int, ip6_sendredirects);	/* send IP redirects when forwarding? */
287 VNET_DECLARE(int, ip6_accept_rtadv);	/* Acts as a host not a router */
288 VNET_DECLARE(int, ip6_no_radr);		/* No defroute from RA */
289 VNET_DECLARE(int, ip6_norbit_raif);	/* Disable R-bit in NA on RA
290 					 * receiving IF. */
291 VNET_DECLARE(int, ip6_rfc6204w3);	/* Accept defroute from RA even when
292 					   forwarding enabled */
293 VNET_DECLARE(int, ip6_hdrnestlimit);	/* upper limit of # of extension
294 					 * headers */
295 VNET_DECLARE(int, ip6_dad_count);	/* DupAddrDetectionTransmits */
296 #define	V_ip6_mrouter			VNET(ip6_mrouter)
297 #define	V_ip6_sendredirects		VNET(ip6_sendredirects)
298 #define	V_ip6_accept_rtadv		VNET(ip6_accept_rtadv)
299 #define	V_ip6_no_radr			VNET(ip6_no_radr)
300 #define	V_ip6_norbit_raif		VNET(ip6_norbit_raif)
301 #define	V_ip6_rfc6204w3			VNET(ip6_rfc6204w3)
302 #define	V_ip6_hdrnestlimit		VNET(ip6_hdrnestlimit)
303 #define	V_ip6_dad_count			VNET(ip6_dad_count)
304 
305 VNET_DECLARE(int, ip6_auto_flowlabel);
306 VNET_DECLARE(int, ip6_auto_linklocal);
307 #define	V_ip6_auto_flowlabel		VNET(ip6_auto_flowlabel)
308 #define	V_ip6_auto_linklocal		VNET(ip6_auto_linklocal)
309 
310 VNET_DECLARE(int, ip6_use_tempaddr);	/* Whether to use temporary addresses */
311 VNET_DECLARE(int, ip6_prefer_tempaddr);	/* Whether to prefer temporary
312 					 * addresses in the source address
313 					 * selection */
314 #define	V_ip6_use_tempaddr		VNET(ip6_use_tempaddr)
315 #define	V_ip6_prefer_tempaddr		VNET(ip6_prefer_tempaddr)
316 
317 VNET_DECLARE(int, ip6_use_defzone);	/* Whether to use the default scope
318 					 * zone when unspecified */
319 #define	V_ip6_use_defzone		VNET(ip6_use_defzone)
320 
321 VNET_DECLARE(struct pfil_head *, inet6_pfil_head);
322 #define	V_inet6_pfil_head	VNET(inet6_pfil_head)
323 #define	PFIL_INET6_NAME		"inet6"
324 
325 VNET_DECLARE(struct pfil_head *, inet6_local_pfil_head);
326 #define	V_inet6_local_pfil_head	VNET(inet6_local_pfil_head)
327 #define	PFIL_INET6_LOCAL_NAME	"inet6-local"
328 
329 #ifdef IPSTEALTH
330 VNET_DECLARE(int, ip6stealth);
331 #define	V_ip6stealth			VNET(ip6stealth)
332 #endif
333 
334 #ifdef EXPERIMENTAL
335 VNET_DECLARE(int, nd6_ignore_ipv6_only_ra);
336 #define	V_nd6_ignore_ipv6_only_ra	VNET(nd6_ignore_ipv6_only_ra)
337 #endif
338 
339 VNET_DECLARE(bool, ip6_log_cannot_forward);
340 #define	V_ip6_log_cannot_forward	VNET(ip6_log_cannot_forward)
341 
342 extern struct	pr_usrreqs rip6_usrreqs;
343 struct sockopt;
344 
345 struct inpcb;
346 struct ucred;
347 
348 int	icmp6_ctloutput(struct socket *, struct sockopt *sopt);
349 
350 void	ip6_input(struct mbuf *);
351 void	ip6_direct_input(struct mbuf *);
352 void	ip6_freepcbopts(struct ip6_pktopts *);
353 
354 int	ip6_unknown_opt(u_int8_t *, struct mbuf *, int);
355 int	ip6_get_prevhdr(const struct mbuf *, int);
356 int	ip6_nexthdr(const struct mbuf *, int, int, int *);
357 int	ip6_lasthdr(const struct mbuf *, int, int, int *);
358 
359 extern int	(*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
360     struct mbuf *);
361 
362 int	ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *,
363 				 u_int32_t *);
364 struct mbuf	**ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
365 	    struct mbuf **, int *);
366 void	ip6_savecontrol(struct inpcb *, struct mbuf *, struct mbuf **);
367 void	ip6_notify_pmtu(struct inpcb *, struct sockaddr_in6 *, u_int32_t);
368 int	ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
369 
370 void	ip6_forward(struct mbuf *, int);
371 
372 void	ip6_mloopback(struct ifnet *, struct mbuf *);
373 int	ip6_output(struct mbuf *, struct ip6_pktopts *,
374 			struct route_in6 *,
375 			int,
376 			struct ip6_moptions *, struct ifnet **,
377 			struct inpcb *);
378 int	ip6_ctloutput(struct socket *, struct sockopt *);
379 int	ip6_raw_ctloutput(struct socket *, struct sockopt *);
380 void	ip6_initpktopts(struct ip6_pktopts *);
381 int	ip6_setpktopts(struct mbuf *, struct ip6_pktopts *,
382 	struct ip6_pktopts *, struct ucred *, int);
383 void	ip6_clearpktopts(struct ip6_pktopts *, int);
384 struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
385 int	ip6_optlen(struct inpcb *);
386 int	ip6_deletefraghdr(struct mbuf *, int, int);
387 int	ip6_fragment(struct ifnet *, struct mbuf *, int, u_char, int,
388 			uint32_t);
389 
390 int	route6_input(struct mbuf **, int *, int);
391 
392 void	frag6_init(void);
393 void	frag6_destroy(void);
394 int	frag6_input(struct mbuf **, int *, int);
395 void	frag6_drain(void);
396 
397 void	rip6_init(void);
398 int	rip6_ctloutput(struct socket *, struct sockopt *);
399 int	rip6_usrreq(struct socket *,
400 	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *);
401 
402 int	dest6_input(struct mbuf **, int *, int);
403 int	none_input(struct mbuf **, int *, int);
404 
405 int	in6_selectsrc_socket(struct sockaddr_in6 *, struct ip6_pktopts *,
406     struct inpcb *, struct ucred *, int, struct in6_addr *, int *);
407 int	in6_selectsrc_addr(uint32_t, const struct in6_addr *,
408     uint32_t, struct ifnet *, struct in6_addr *, int *);
409 int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
410 	struct ip6_moptions *, struct route_in6 *, struct ifnet **,
411 	struct nhop_object **, u_int, uint32_t);
412 u_int32_t ip6_randomid(void);
413 u_int32_t ip6_randomflowlabel(void);
414 void in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset);
415 
416 int	ip6_log_ratelimit(void);
417 
418 /*
419  * Argument type for the last arg of ip6proto_ctlinput_t().
420  *
421  * IPv6 ICMP IPv6 [exthdrs] finalhdr payload
422  * ^    ^    ^              ^
423  * |    |    ip6c_ip6       ip6c_off
424  * |    ip6c_icmp6
425  * ip6c_m
426  *
427  * ip6c_finaldst's sin6_addr usually points to ip6c_ip6->ip6_dst.  If the
428  * original * (internal) packet carries a routing header, it may point the
429  * final * destination address in the routing header.
430  *
431  * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
432  *	(beware of flowlabel, if you try to compare it against others)
433  * ip6c_dst: ip6c_finaldst + scope info
434  */
435 struct ip6ctlparam {
436 	struct mbuf *ip6c_m;		/* start of mbuf chain */
437 	struct icmp6_hdr *ip6c_icmp6;	/* icmp6 header of target packet */
438 	struct ip6_hdr *ip6c_ip6;	/* ip6 header of target packet */
439 	int ip6c_off;			/* offset of the target proto header */
440 	struct sockaddr_in6 *ip6c_src;	/* srcaddr w/ additional info */
441 	struct sockaddr_in6 *ip6c_dst;	/* (final) dstaddr w/ additional info */
442 	struct sockaddr_in6 *ip6c_finaldst;	/* final destination address */
443 	void *ip6c_cmdarg;		/* control command dependent data */
444 	u_int8_t ip6c_nxt;		/* final next header field */
445 };
446 
447 typedef int	ip6proto_input_t(struct mbuf **, int *, int);
448 typedef void	ip6proto_ctlinput_t(struct ip6ctlparam *);
449 int	ip6proto_register(uint8_t, ip6proto_input_t, ip6proto_ctlinput_t);
450 int	ip6proto_unregister(uint8_t);
451 #define	IP6PROTO_REGISTER(prot, input, ctl)	do {			\
452 	int error __diagused;						\
453 	error = ip6proto_register(prot, input, ctl);			\
454 	MPASS(error == 0);						\
455 } while (0)
456 
457 ip6proto_input_t	rip6_input;
458 ip6proto_ctlinput_t	rip6_ctlinput;
459 
460 #endif /* _KERNEL */
461 
462 #endif /* !_NETINET6_IP6_VAR_H_ */
463