/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _INET_IP6_H
#define _INET_IP6_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/isa_defs.h>
#ifdef _KERNEL
/* icmp6_t is used in the prototype of icmp_inbound_error_fanout_v6() */
#endif /* _KERNEL */
/* version number for IPv6 - hard to get this one wrong! */
/*
* IPv6 address scopes. The values of these enums also match the scope
* field of multicast addresses.
*/
typedef enum {
/* From RFC 3542 - setting for IPV6_USE_MIN_MTU socket option */
#define IPV6_USE_MIN_MTU_NEVER 0
#ifdef _KERNEL
/* Extract the scope from a multicast address */
#ifdef _BIG_ENDIAN
#else
#endif
/* Default IPv4 TTL for IPv6-in-IPv4 encapsulated packets */
/* Max IPv6 TTL */
/* Minimum IPv6 MTU from rfc2460 */
/* EUI-64 based token length */
/* Length of an advertised IPv6 prefix */
/* Default and maximum tunnel encapsulation limits. See RFC 2473. */
/*
* Minimum and maximum extension header lengths for IPv6. The 8-bit
* length field of each extension header (see rfc2460) specifies the
* number of 8 octet units of data in the header not including the
* first 8 octets. A value of 0 would indicate 8 bytes (0 * 8 + 8),
* and 255 would indicate 2048 bytes (255 * 8 + 8).
*/
#ifdef _BIG_ENDIAN
((c) << 20))
#else
(((x) & 0xf) << 4))
((((c) & 0xf) << 12) |\
(((c) & 0xf0) >> 4)))
#endif
/*
* UTILITY MACROS FOR ADDRESSES.
*/
/*
* Convert an IPv4 address mask to an IPv6 mask. Pad with 1-bits.
*/
/*
* Convert aligned IPv4-mapped IPv6 address into an IPv4 address.
* Note: We use "v6" here in definition of macro instead of "(v6)"
* Not possible to use "(v6)" here since macro is used with struct
* field names as arguments.
*/
#ifdef _BIG_ENDIAN
(a).s6_addr32[2] == 0) && \
(a).s6_addr32[1] == 0 && \
(a).s6_addr32[0] == 0)
#else
(a).s6_addr32[2] == 0) && \
(a).s6_addr32[1] == 0 && \
(a).s6_addr32[0] == 0)
#endif /* _BIG_ENDIAN */
/* IPv4-mapped CLASSD addresses */
#ifdef _BIG_ENDIAN
#else /* _BIG_ENDIAN */
#endif /* _BIG_ENDIAN */
/* Clear an IPv6 addr */
(a).s6_addr32[1] = 0, \
(a).s6_addr32[2] = 0, \
(a).s6_addr32[3] = 0)
/* Mask comparison: is IPv6 addr a, and'ed with mask m, equal to addr b? */
#define V6_MASK_EQ(a, m, b) \
#define V6_MASK_EQ_2(a, m, b) \
/* Copy IPv6 address (s), logically and'ed with mask (m), into (d) */
#define V6_MASK_COPY(s, m, d) \
/*
* GLOBAL EXTERNALS
*/
extern const in6_addr_t ipv6_all_ones;
extern const in6_addr_t ipv6_all_zeros;
extern const in6_addr_t ipv6_loopback;
extern const in6_addr_t ipv6_all_hosts_mcast;
extern const in6_addr_t ipv6_all_rtrs_mcast;
extern const in6_addr_t ipv6_all_v2rtrs_mcast;
extern const in6_addr_t ipv6_solicited_node_mcast;
extern const in6_addr_t ipv6_unspecified_group;
/*
* FUNCTION PROTOTYPES
*/
ip_recv_attr_t *);
ip_recv_attr_t *);
ip_recv_attr_t *);
ip_recv_attr_t *);
ip_recv_attr_t *);
uint32_t);
ip_recv_attr_t *);
ip_recv_attr_t *);
uint8_t *);
ip_recv_attr_t *);
extern int ip_total_hdrs_len_v6(const ip_pkt_t *);
ip_recv_attr_t *);
extern void mld_joingroup(ilm_t *);
extern void mld_leavegroup(ilm_t *);
extern void mld_timeout_handler(void *);
extern void pr_addr_dbg(char *, int, const void *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _INET_IP6_H */