2000-07-04 16:35:15 +00:00
|
|
|
/* $FreeBSD$ */
|
2001-06-11 12:39:29 +00:00
|
|
|
/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */
|
2000-07-04 16:35:15 +00:00
|
|
|
|
2005-01-07 01:45:51 +00:00
|
|
|
/*-
|
2000-07-04 16:35:15 +00:00
|
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
1999-11-22 02:45:11 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
2000-07-04 16:35:15 +00:00
|
|
|
*/
|
|
|
|
|
2005-01-07 01:45:51 +00:00
|
|
|
/*-
|
2000-07-04 16:35:15 +00:00
|
|
|
* Copyright (c) 1982, 1986, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)ip.h 8.1 (Berkeley) 6/10/93
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETINET_IP6_H_
|
|
|
|
#define _NETINET_IP6_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definition for internet protocol version 6.
|
|
|
|
* RFC 2460
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ip6_hdr {
|
|
|
|
union {
|
|
|
|
struct ip6_hdrctl {
|
|
|
|
u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */
|
|
|
|
u_int16_t ip6_un1_plen; /* payload length */
|
|
|
|
u_int8_t ip6_un1_nxt; /* next header */
|
|
|
|
u_int8_t ip6_un1_hlim; /* hop limit */
|
|
|
|
} ip6_un1;
|
|
|
|
u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */
|
|
|
|
} ip6_ctlun;
|
|
|
|
struct in6_addr ip6_src; /* source address */
|
|
|
|
struct in6_addr ip6_dst; /* destination address */
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
|
|
|
|
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
|
|
|
|
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
|
|
|
|
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
|
|
|
|
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
|
|
|
|
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
|
|
|
|
|
|
|
|
#define IPV6_VERSION 0x60
|
|
|
|
#define IPV6_VERSION_MASK 0xf0
|
|
|
|
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */
|
|
|
|
#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */
|
|
|
|
#else
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
|
|
|
#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */
|
|
|
|
#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */
|
|
|
|
#endif /* LITTLE_ENDIAN */
|
|
|
|
#endif
|
2001-06-11 12:39:29 +00:00
|
|
|
#if 1
|
2000-07-04 16:35:15 +00:00
|
|
|
/* ECN bits proposed by Sally Floyd */
|
|
|
|
#define IP6TOS_CE 0x01 /* congestion experienced */
|
|
|
|
#define IP6TOS_ECT 0x02 /* ECN-capable transport */
|
2001-06-11 12:39:29 +00:00
|
|
|
#endif
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Extension Headers
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ip6_ext {
|
2001-06-11 12:39:29 +00:00
|
|
|
u_int8_t ip6e_nxt;
|
|
|
|
u_int8_t ip6e_len;
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/* Hop-by-Hop options header */
|
|
|
|
/* XXX should we pad it to force alignment on an 8-byte boundary? */
|
|
|
|
struct ip6_hbh {
|
|
|
|
u_int8_t ip6h_nxt; /* next header */
|
|
|
|
u_int8_t ip6h_len; /* length in units of 8 octets */
|
|
|
|
/* followed by options */
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/* Destination options header */
|
|
|
|
/* XXX should we pad it to force alignment on an 8-byte boundary? */
|
|
|
|
struct ip6_dest {
|
|
|
|
u_int8_t ip6d_nxt; /* next header */
|
|
|
|
u_int8_t ip6d_len; /* length in units of 8 octets */
|
|
|
|
/* followed by options */
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/* Option types and related macros */
|
|
|
|
#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
|
|
|
|
#define IP6OPT_PADN 0x01 /* 00 0 00001 */
|
|
|
|
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */
|
|
|
|
#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */
|
2003-10-24 18:26:30 +00:00
|
|
|
#ifndef _KERNEL
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */
|
2003-10-24 18:26:30 +00:00
|
|
|
#endif
|
2005-07-20 08:59:45 +00:00
|
|
|
#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 (RFC3542, recommended) */
|
2001-06-11 12:39:29 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IP6OPT_RTALERT_LEN 4
|
|
|
|
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
|
|
|
|
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
|
|
|
|
#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
|
|
|
|
#define IP6OPT_MINLEN 2
|
|
|
|
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IP6OPT_EID 0x8a /* 10 0 01010 */
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IP6OPT_TYPE(o) ((o) & 0xC0)
|
|
|
|
#define IP6OPT_TYPE_SKIP 0x00
|
|
|
|
#define IP6OPT_TYPE_DISCARD 0x40
|
|
|
|
#define IP6OPT_TYPE_FORCEICMP 0x80
|
|
|
|
#define IP6OPT_TYPE_ICMP 0xC0
|
|
|
|
|
|
|
|
#define IP6OPT_MUTABLE 0x20
|
|
|
|
|
2005-07-20 10:30:52 +00:00
|
|
|
/* IPv6 options: common part */
|
|
|
|
struct ip6_opt {
|
|
|
|
u_int8_t ip6o_type;
|
|
|
|
u_int8_t ip6o_len;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Jumbo Payload Option */
|
|
|
|
struct ip6_opt_jumbo {
|
|
|
|
u_int8_t ip6oj_type;
|
|
|
|
u_int8_t ip6oj_len;
|
|
|
|
u_int8_t ip6oj_jumbo_len[4];
|
|
|
|
} __packed;
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IP6OPT_JUMBO_LEN 6
|
|
|
|
|
2005-07-20 10:30:52 +00:00
|
|
|
/* NSAP Address Option */
|
|
|
|
struct ip6_opt_nsap {
|
|
|
|
u_int8_t ip6on_type;
|
|
|
|
u_int8_t ip6on_len;
|
|
|
|
u_int8_t ip6on_src_nsap_len;
|
|
|
|
u_int8_t ip6on_dst_nsap_len;
|
|
|
|
/* followed by source NSAP */
|
|
|
|
/* followed by destination NSAP */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Tunnel Limit Option */
|
|
|
|
struct ip6_opt_tunnel {
|
|
|
|
u_int8_t ip6ot_type;
|
|
|
|
u_int8_t ip6ot_len;
|
|
|
|
u_int8_t ip6ot_encap_limit;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Router Alert Option */
|
|
|
|
struct ip6_opt_router {
|
|
|
|
u_int8_t ip6or_type;
|
|
|
|
u_int8_t ip6or_len;
|
|
|
|
u_int8_t ip6or_value[2];
|
|
|
|
} __packed;
|
|
|
|
/* Router alert values (in network byte order) */
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
#define IP6_ALERT_MLD 0x0000
|
|
|
|
#define IP6_ALERT_RSVP 0x0001
|
|
|
|
#define IP6_ALERT_AN 0x0002
|
|
|
|
#else
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
|
|
|
#define IP6_ALERT_MLD 0x0000
|
|
|
|
#define IP6_ALERT_RSVP 0x0100
|
|
|
|
#define IP6_ALERT_AN 0x0200
|
|
|
|
#endif /* LITTLE_ENDIAN */
|
|
|
|
#endif
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
/* Routing header */
|
|
|
|
struct ip6_rthdr {
|
|
|
|
u_int8_t ip6r_nxt; /* next header */
|
|
|
|
u_int8_t ip6r_len; /* length in units of 8 octets */
|
|
|
|
u_int8_t ip6r_type; /* routing type */
|
|
|
|
u_int8_t ip6r_segleft; /* segments left */
|
|
|
|
/* followed by routing type specific data */
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/* Type 0 Routing header */
|
|
|
|
struct ip6_rthdr0 {
|
|
|
|
u_int8_t ip6r0_nxt; /* next header */
|
|
|
|
u_int8_t ip6r0_len; /* length in units of 8 octets */
|
|
|
|
u_int8_t ip6r0_type; /* always zero */
|
|
|
|
u_int8_t ip6r0_segleft; /* segments left */
|
2003-10-24 20:37:05 +00:00
|
|
|
u_int32_t ip6r0_reserved; /* reserved field */
|
|
|
|
/* followed by up to 127 struct in6_addr */
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/* Fragment header */
|
|
|
|
struct ip6_frag {
|
|
|
|
u_int8_t ip6f_nxt; /* next header */
|
|
|
|
u_int8_t ip6f_reserved; /* reserved field */
|
|
|
|
u_int16_t ip6f_offlg; /* offset, reserved, and flag */
|
|
|
|
u_int32_t ip6f_ident; /* identification */
|
2003-10-25 10:57:08 +00:00
|
|
|
} __packed;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
|
|
|
|
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
|
|
|
|
#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
|
|
|
|
#else /* BYTE_ORDER == LITTLE_ENDIAN */
|
|
|
|
#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
|
|
|
|
#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
|
|
|
|
#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
|
|
|
|
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Internet implementation parameters.
|
|
|
|
*/
|
2005-07-20 08:59:45 +00:00
|
|
|
#define IPV6_MAXHLIM 255 /* maximum hoplimit */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_DEFHLIM 64 /* default hlim */
|
|
|
|
#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */
|
2005-07-20 08:59:45 +00:00
|
|
|
#define IPV6_HLIMDEC 1 /* subtracted when forwarding */
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */
|
|
|
|
#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/
|
2004-03-26 19:52:18 +00:00
|
|
|
#define IPV6_MAXOPTHDR 2048 /* max option header size, 256 64-bit words */
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
#ifdef _KERNEL
|
|
|
|
/*
|
|
|
|
* IP6_EXTHDR_CHECK ensures that region between the IP6 header and the
|
|
|
|
* target header (including IPv6 itself, extension headers and
|
|
|
|
* TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers
|
|
|
|
* to store incoming data into one internal mbuf or one or more external
|
|
|
|
* mbufs(never into two or more internal mbufs). Thus, the third case is
|
|
|
|
* supposed to never be matched but is prepared just in case.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \
|
|
|
|
do { \
|
|
|
|
if ((m)->m_next != NULL) { \
|
|
|
|
if (((m)->m_flags & M_LOOP) && \
|
|
|
|
((m)->m_len < (off) + (hlen)) && \
|
|
|
|
(((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
|
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).
This is the first in a series of commits over the course
of the next few weeks.
Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.
We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.
Obtained from: //depot/projects/vimage-commit2/...
Reviewed by: brooks, des, ed, mav, julian,
jamie, kris, rwatson, zec, ...
(various people I forgot, different versions)
md5 (with a bit of help)
Sponsored by: NLnet Foundation, The FreeBSD Foundation
X-MFC after: never
V_Commit_Message_Reviewed_By: more people than the patch
2008-08-17 23:27:27 +00:00
|
|
|
V_ip6stat.ip6s_exthdrtoolong++; \
|
2000-07-04 16:35:15 +00:00
|
|
|
return ret; \
|
|
|
|
} else if ((m)->m_flags & M_EXT) { \
|
|
|
|
if ((m)->m_len < (off) + (hlen)) { \
|
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).
This is the first in a series of commits over the course
of the next few weeks.
Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.
We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.
Obtained from: //depot/projects/vimage-commit2/...
Reviewed by: brooks, des, ed, mav, julian,
jamie, kris, rwatson, zec, ...
(various people I forgot, different versions)
md5 (with a bit of help)
Sponsored by: NLnet Foundation, The FreeBSD Foundation
X-MFC after: never
V_Commit_Message_Reviewed_By: more people than the patch
2008-08-17 23:27:27 +00:00
|
|
|
V_ip6stat.ip6s_exthdrtoolong++; \
|
2000-07-04 16:35:15 +00:00
|
|
|
m_freem(m); \
|
|
|
|
return ret; \
|
|
|
|
} \
|
|
|
|
} else { \
|
|
|
|
if ((m)->m_len < (off) + (hlen)) { \
|
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).
This is the first in a series of commits over the course
of the next few weeks.
Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.
We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.
Obtained from: //depot/projects/vimage-commit2/...
Reviewed by: brooks, des, ed, mav, julian,
jamie, kris, rwatson, zec, ...
(various people I forgot, different versions)
md5 (with a bit of help)
Sponsored by: NLnet Foundation, The FreeBSD Foundation
X-MFC after: never
V_Commit_Message_Reviewed_By: more people than the patch
2008-08-17 23:27:27 +00:00
|
|
|
V_ip6stat.ip6s_exthdrtoolong++; \
|
2000-07-04 16:35:15 +00:00
|
|
|
m_freem(m); \
|
|
|
|
return ret; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} else { \
|
|
|
|
if ((m)->m_len < (off) + (hlen)) { \
|
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).
This is the first in a series of commits over the course
of the next few weeks.
Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.
We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.
Obtained from: //depot/projects/vimage-commit2/...
Reviewed by: brooks, des, ed, mav, julian,
jamie, kris, rwatson, zec, ...
(various people I forgot, different versions)
md5 (with a bit of help)
Sponsored by: NLnet Foundation, The FreeBSD Foundation
X-MFC after: never
V_Commit_Message_Reviewed_By: more people than the patch
2008-08-17 23:27:27 +00:00
|
|
|
V_ip6stat.ip6s_tooshort++; \
|
2000-07-04 16:35:15 +00:00
|
|
|
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
|
|
|
|
m_freem(m); \
|
|
|
|
return ret; \
|
|
|
|
} \
|
|
|
|
} \
|
2003-09-25 13:40:06 +00:00
|
|
|
} while (/*CONSTCOND*/ 0)
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
|
|
|
|
* "len") is located in single mbuf, on contiguous memory region.
|
|
|
|
* The pointer to the region will be returned to pointer variable "val",
|
|
|
|
* with type "typ".
|
|
|
|
* IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
|
|
|
|
* very top of mbuf. GET0 is likely to make memory copy than GET.
|
1999-11-22 02:45:11 +00:00
|
|
|
*
|
2000-07-04 16:35:15 +00:00
|
|
|
* XXX we're now testing this, needs m_pulldown()
|
1999-11-22 02:45:11 +00:00
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IP6_EXTHDR_GET(val, typ, m, off, len) \
|
|
|
|
do { \
|
|
|
|
struct mbuf *t; \
|
|
|
|
int tmp; \
|
|
|
|
if ((m)->m_len >= (off) + (len)) \
|
|
|
|
(val) = (typ)(mtod((m), caddr_t) + (off)); \
|
|
|
|
else { \
|
|
|
|
t = m_pulldown((m), (off), (len), &tmp); \
|
|
|
|
if (t) { \
|
|
|
|
if (t->m_len < tmp + (len)) \
|
|
|
|
panic("m_pulldown malfunction"); \
|
|
|
|
(val) = (typ)(mtod(t, caddr_t) + tmp); \
|
|
|
|
} else { \
|
|
|
|
(val) = (typ)NULL; \
|
|
|
|
(m) = NULL; \
|
|
|
|
} \
|
|
|
|
} \
|
2003-09-25 13:40:06 +00:00
|
|
|
} while (/*CONSTCOND*/ 0)
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
|
|
|
|
do { \
|
|
|
|
struct mbuf *t; \
|
|
|
|
if ((off) == 0) \
|
|
|
|
(val) = (typ)mtod(m, caddr_t); \
|
|
|
|
else { \
|
|
|
|
t = m_pulldown((m), (off), (len), NULL); \
|
|
|
|
if (t) { \
|
|
|
|
if (t->m_len < (len)) \
|
|
|
|
panic("m_pulldown malfunction"); \
|
|
|
|
(val) = (typ)mtod(t, caddr_t); \
|
|
|
|
} else { \
|
|
|
|
(val) = (typ)NULL; \
|
|
|
|
(m) = NULL; \
|
|
|
|
} \
|
|
|
|
} \
|
2003-09-25 13:40:06 +00:00
|
|
|
} while (/*CONSTCOND*/ 0)
|
Step 1.5 of importing the network stack virtualization infrastructure
from the vimage project, as per plan established at devsummit 08/08:
http://wiki.freebsd.org/Image/Notes200808DevSummit
Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator
macros, and CURVNET_SET() context setting macros, all currently
resolving to NOPs.
Prepare for virtualization of selected SYSCTL objects by introducing a
family of SYSCTL_V_*() macros, currently resolving to their global
counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT().
Move selected #defines from sys/sys/vimage.h to newly introduced header
files specific to virtualized subsystems (sys/net/vnet.h,
sys/netinet/vinet.h etc.).
All the changes are verified to have zero functional impact at this
point in time by doing MD5 comparision between pre- and post-change
object files(*).
(*) netipsec/keysock.c did not validate depending on compile time options.
Implemented by: julian, bz, brooks, zec
Reviewed by: julian, bz, brooks, kris, rwatson, ...
Approved by: julian (mentor)
Obtained from: //depot/projects/vimage-commit2/...
X-MFC after: never
Sponsored by: NLnet Foundation, The FreeBSD Foundation
2008-10-02 15:37:58 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#endif /*_KERNEL*/
|
1999-11-22 02:45:11 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#endif /* not _NETINET_IP6_H_ */
|