original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,527 @@
/* in6.c - in6 header file */
/*
* Copyright (c) 2001-2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/* $KAME: in6.h,v 1.159 2005/03/19 07:28:59 suz Exp $ */
/* $KAME: in6.h,v 1.155 2004/06/02 05:53:14 itojun Exp $ */
/* $FreeBSD: src/sys/netinet6/in6.h,v 1.7.2.7 2002/08/01 19:38:50 ume Exp $ */
/* $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* 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.
*/
/*
* Copyright (c) 1982, 1986, 1990, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
*/
/*
modification history
--------------------
02d,01dec11,rjq Add IPV6_X_VRID
02c,11sep08,kjn Add IPV6_PREFER_SRC_xxx flags
02b,02jul08,kjn Add back in6addr_any and in6addr_loopback
02a,30nov06,kch Changed ipi6_ifindex in in6_pktinfo structure from unsigned
int to u_int32_t.
01z,20nov06,kch Corrected comments for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
Also updated in6_addr structure declarations and macros.
01y,27oct06,kch Restore some non-standard macros that are removed previously.
01x,25oct06,kch Removed Kame specific non-standard macros. Added new
IPV6_RECVSAINFO, IPV6_ADDR_PREFERENCES, IPV6_FW and
IPV6_RECVIF socket options.
01w,04oct06,kch Updated the values assigned to the IPV6 options. Also removed
the unsupported IPV6CTL defines.
01v,10sep06,kch Cleanup for IPNet integration
01u,06aug05,dlk Added in6_pseudo() declaration.
01t,04jun05,dlk Make inet6_opt* functions from RFCs 2292 and 3542 visible in
user space.
01s,31may05,tlu Added IN6_IS_ADDR_GLOBAL
01r,09may05,kch Merged from Kame v 1.159.
01q,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev
01p,23feb05,dlk Make functions from rthdr.c visible in user space.
01o,07feb05,vvv _KERNEL cleanup
01n,24jan05,vvv osdep.h cleanup
01m,20jan05,sar Removal of divert, dummynet and fw code.
01l,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
01k,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
/main/vdt/base6_itn5_networking-int/1)
01j,20nov03,niq Remove copyright_wrs.h file inclusion
01i,04nov03,rlm Ran batch header path update for header re-org.
01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
01g,27oct03,rlm update include statements post header re-org.
01f,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in
accordion codeline to Base6
01e,09may03,vvv fixed check for in.h
01d,30apr03,syy Added #ifdef for __cplusplus
01c,01feb03,pas merge from FreeBSD 4.7 - added faithprefix_p
01b,30sep02,sar IFDEF out the KAME IPsec mflags
01a,03feb02,ham changes for tornado.
*/
#ifndef _NETINET_IN_H_
#error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553"
#endif
#ifndef _NETINET6_IN6_H_
#define _NETINET6_IN6_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Identification of the network protocol stack
* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
* has the table of implementation/integration differences.
*/
#define __KAME__
#define __KAME_VERSION "SNAP 20050404"
/*
* Local port number conventions:
*
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
* unless a kernel is compiled with IPNOPRIVPORTS defined.
*
* When a user does a bind(2) or connect(2) with a port number of zero,
* a non-conflicting local port address is chosen.
*
* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
* that is settable by sysctl(3); net.inet.ip.anonportmin and
* net.inet.ip.anonportmax respectively.
*
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
* default assignment range.
*
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
*
* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
* and exists only for FreeBSD compatibility purposes.
*
* The value IP_PORTRANGE_LOW changes the range to the "low" are
* that is (by convention) restricted to privileged processes.
* This convention is based on "vouchsafe" principles only.
* It is only secure if you trust the remote host to restrict these ports.
* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
*/
#define IPV6PORT_RESERVED 1024
#define IPV6PORT_ANONMIN 49152
#define IPV6PORT_ANONMAX 65535
#define IPV6PORT_RESERVEDMIN 600
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
/*
* IPv6 address
*/
struct in6_addr {
union {
u_int8_t addr8[16];
u_int16_t addr16[8];
u_int32_t addr32[4];
} in6; /* 128-bit IP6 address */
};
#ifndef s6_addr
#define s6_addr in6.addr8
#endif
#ifdef _WRS_KERNEL /* XXX nonstandard */
#ifndef s6_addr8
#define s6_addr8 in6.addr8
#endif
#ifndef s6_addr16
#define s6_addr16 in6.addr16
#endif
#ifndef s6_addr32
#define s6_addr32 in6.addr32
#endif
#endif /* _WRS_KERNEL */
#define INET6_ADDRSTRLEN 46
/*
* Socket address for IPv6
*/
#ifndef _XOPEN_SOURCE
#define SIN6_LEN
#endif
struct sockaddr_in6 {
u_int8_t sin6_len; /* length of this struct(sa_family_t)*/
u_int8_t sin6_family; /* AF_INET6 (sa_family_t) */
u_int16_t sin6_port; /* Transport layer port # (in_port_t)*/
u_int32_t sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
u_int32_t sin6_scope_id; /* scope zone index */
};
/*
* Local definition for masks
*/
#ifdef _WRS_KERNEL /* XXX nonstandard */
#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
/*
* Macros started with IPV6_ADDR is KAME local
*/
#if _BYTE_ORDER == _BIG_ENDIAN
#define IPV6_ADDR_INT32_ONE 1
#define IPV6_ADDR_INT32_TWO 2
#define IPV6_ADDR_INT32_MNL 0xff010000
#define IPV6_ADDR_INT32_MLL 0xff020000
#define IPV6_ADDR_INT32_SMP 0x0000ffff
#define IPV6_ADDR_INT16_ULL 0xfe80
#define IPV6_ADDR_INT16_USL 0xfec0
#define IPV6_ADDR_INT16_MLL 0xff02
#elif _BYTE_ORDER == _LITTLE_ENDIAN
#define IPV6_ADDR_INT32_ONE 0x01000000
#define IPV6_ADDR_INT32_TWO 0x02000000
#define IPV6_ADDR_INT32_MNL 0x000001ff
#define IPV6_ADDR_INT32_MLL 0x000002ff
#define IPV6_ADDR_INT32_SMP 0xffff0000
#define IPV6_ADDR_INT16_ULL 0x80fe
#define IPV6_ADDR_INT16_USL 0xc0fe
#define IPV6_ADDR_INT16_MLL 0x02ff
#endif
#endif /* _WRS_KERNEL */
/*
* Definition of some useful macros to handle IP6 addresses
*/
#define IN6ADDR_ANY_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_LOOPBACK_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
#ifdef MLDV2
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
#endif
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
/* Equality */
#define IN6_ARE_ADDR_EQUAL(a, b) \
(bcmp ((char *) &(a)->s6_addr[0], (char *) &(b)->s6_addr[0], \
sizeof(struct in6_addr)) == 0)
#ifdef _WRS_KERNEL /* non standard */
#if 0
/* see if two addresses are equal in a scope-conscious manner. */
#define SA6_ARE_ADDR_EQUAL(a, b) \
(((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || \
((a)->sin6_scope_id == (b)->sin6_scope_id)) && \
(bcmp ((char *) &(a)->sin6_addr, (char *) &(b)->sin6_addr, \
sizeof (struct in6_addr)) == 0))
#endif
#endif
/*
* Unspecified
*/
#define IN6_IS_ADDR_UNSPECIFIED(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
/*
* Loopback
*/
#define IN6_IS_ADDR_LOOPBACK(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
/*
* IPv4 compatible
*/
#define IN6_IS_ADDR_V4COMPAT(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
/*
* Mapped
*/
#define IN6_IS_ADDR_V4MAPPED(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
/*
* KAME Scope Values
*/
#ifdef _WRS_KERNEL /* XXX nonstandard */
#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
#else
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
#endif
/*
* Unicast Scope
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
*/
#define IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
/*
* Multicast
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
/*
* Global Scope
*/
#define IN6_IS_ADDR_GLOBAL(adr) \
((!IN6_IS_ADDR_MULTICAST(adr)) && \
(!IN6_IS_ADDR_LINKLOCAL(adr)) && \
(!IN6_IS_ADDR_SITELOCAL(adr)))
#ifdef _WRS_KERNEL /* XXX nonstandard */
#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
#else
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
#endif
/*
* Multicast Scope
*/
#ifdef _WRS_KERNEL /* refers nonstandard items */
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
#else
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
#endif
#ifdef _WRS_KERNEL /* nonstandard */
/*
* KAME Scope
*/
#define IN6_IS_SCOPE_LINKLOCAL(a) \
((IN6_IS_ADDR_LINKLOCAL(a)) || \
(IN6_IS_ADDR_MC_LINKLOCAL(a)))
#define IFA6_IS_DEPRECATED(a) \
((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
(u_int32_t)((time_second - (a)->ia6_updatetime)) > \
(a)->ia6_lifetime.ia6t_pltime)
#define IFA6_IS_INVALID(a) \
((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
(u_int32_t)((time_second - (a)->ia6_updatetime)) > \
(a)->ia6_lifetime.ia6t_vltime)
#endif /* _WRS_KERNEL */
/* IP6 route structure
*/
#ifndef _XOPEN_SOURCE
#include <net/route.h>
#endif
/*
* Options for use with [gs]etsockopt at the IPV6 level.
* First word of comment is data type; bool is stored in int.
*/
#define IPV6_V6ONLY 1 /* bool; make AF_INET6 sockets v6 only */
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define IPV6_CHECKSUM 7 /* int; checksum offset for raw socket */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
#define IPV6_JOIN_GROUP 12 /* ipv6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ipv6_mreq; leave a group membership */
#define IPV6_PKTINFO 20 /* in6_pktinfo; send if, src addr */
#define IPV6_TCLASS 22 /* int; send traffic class value */
#define IPV6_NEXTHOP 23 /* sockaddr; next hop addr */
#define IPV6_RTHDR 24 /* ip6_rthdr; send routing header */
#define IPV6_HOPOPTS 25 /* ip6_hbh; send hop-by-hop option */
#define IPV6_DSTOPTS 26 /* ip6_dest; send dst option befor rthdr */
/* new socket options introduced in RFC2292bis */
#define IPV6_RTHDRDSTOPTS 27 /* ip6_dest; send dst option before rthdr */
#define IPV6_RECVPKTINFO 30 /* bool; recv if, dst addr */
#define IPV6_RECVHOPLIMIT 31 /* bool; recv hop limit */
#define IPV6_RECVTCLASS 32 /* bool; recv traffic class values */
#define IPV6_RECVRTHDR 34 /* bool; recv routing header */
#define IPV6_RECVHOPOPTS 35 /* bool; recv hop-by-hop option */
#define IPV6_RECVDSTOPTS 36 /* bool; recv dst option after rthdr */
#define IPV6_RECVSAINFO 37 /* int; get the SA information */
#define IPV6_ADDR_PREFERENCES 38 /* int; set/get sticky address preference flags (IPV6_PREFER_SRC_xxx) */
#define IPV6_FW 51 /* Ipfirewall_ctrl; Firewall control */
#define IPV6_RECVIF 100 /* int; turn "get link layer address (as a struct sockaddr_dl) */
#define IPV6_X_SENDERLINKADDR 101 /* int; ipcom_recvmsg() returns a struct
sockaddr_dl that will contain the link
address of the sender */
#define IPV6_X_VRID 103 /* Ip_u8; specify the virtual router ID as ancillary data */
#define IPV6_HOPLIMIT 21 /* int; send hop limit */
/* IPPROTO_ICMPV6 level socket options. */
#define ICMP6_FILTER 1 /* icmp6_filter; icmp6 filter */
/* Flags for IPV6_ADDR_PREFERENCES option */
#define IPV6_PREFER_SRC_HOME (1u << 0) /* Prefer Home Address as source (not implemented) */
#define IPV6_PREFER_SRC_COA (1u << 1) /* Prefer Care-Of_address as source (not implemented) */
#define IPV6_PREFER_SRC_TMP (1u << 2) /* Prefer Temporary address as source */
#define IPV6_PREFER_SRC_PUBLIC (1u << 3) /* Prefer Public address as source */
#define IPV6_PREFER_SRC_CGA (1u << 4) /* Prefer CGA address as source */
#define IPV6_PREFER_SRC_NONCGA (1u << 5) /* Prefer a non-CGA address as source (not implemented) */
#define IPV6_PREFER_SRC_LARGESCOPE (1u << 6) /* Prefer larger scope source */
#define IPV6_PREFER_SRC_SMALLSCOPE (1u << 7) /* Prefer smaller scope source */
/*
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
*/
struct ipv6_mreq {
struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast addr */
unsigned int ipv6mr_interface; /* interface index, or 0 */
};
/*
* IPV6_PKTINFO: Packet information(RFC2292 sec 5)
*/
struct in6_pktinfo {
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
u_int32_t ipi6_ifindex; /* send/recv interface index */
};
#ifdef __cplusplus
}
#endif
#endif /* !_NETINET6_IN6_H_ */
@@ -0,0 +1,168 @@
/* in6_var.h - IPv6 interface definitions */
/*
* Copyright (c) 2001-2005 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/* $KAME: in6_var.h,v 1.107 2005/03/14 08:53:36 suz Exp $ */
/* $KAME: in6_var.h,v 1.103 2004/08/17 10:18:58 jinmei Exp $ */
/* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.3.2.3 2002/04/28 05:40:27 suz Exp $ */
/* $KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* 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.
*/
/*
* Copyright (c) 1985, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)in_var.h 8.1 (Berkeley) 6/10/93
*/
/*
modification history
--------------------
01r,09jan12,h_x Move extern "C" after last header file include.
01q,30nov06,kch Cleanup for IPNet integration.
01p,25jun05,dlk Add ip6intrqJob declaration.
01o,20jun05,kch Do not guard IN6_IFF_HOME and IN6_IFF_DEREGISTERING defines
with MIP6 build flag.
01n,24may05,vvv updated for Kame merge
01m,13may05,nee Add a IPv6 address flag IN6_IFF_SUBNETANYCAST.
01o,10may05,kch Merged from Kame v 1.107.
01n,28apr05,kch Moved addrsel_policyent structure definition here from
in6_src.c.
01m,20apr05,kch Merged from comp_wn_ipv6_mld_interim-dev branch.
01l,16mar05,nee Add SIOCSIFINFO_IN6
01k,07feb05,vvv _KERNEL cleanup
01j,25jan05,vvv fixed bitfield definitions (SPR #92171)
01i,21nov03,vvv protected in6_prflags and in6_rrenumreq structures with INET6
01h,20nov03,niq Remove copyright_wrs.h file inclusion
01g,05nov03,cdw Removal of unnecessary _KERNEL guards.
01f,04nov03,rlm Ran batch header path update for header re-org.
01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
01d,12aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in
accordion codeline to Base6
01c,10jun03,vvv include netVersion.h
01b,30apr03,syy Added #ifdef for __cplusplus
01a,24jun02,ism created new structure to hold the IPv6 MIB information
*/
#ifndef _NETINET6_IN6_VAR_H_
#define _NETINET6_IN6_VAR_H_
#ifdef _WRS_KERNEL
#include <net/if_var.h> /* needed for struct ifaddr */
#else
#include <net/if.h> /* needed for IFNAMSIZ */
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* pltime/vltime are just for future reference (required to implements 2
* hour rule for hosts). they should never be modified by nd6_timeout or
* anywhere else.
* userland -> kernel: accept pltime/vltime
* kernel -> userland: throw up everything
* in kernel: modify preferred/expire only
*/
struct in6_addrlifetime {
time_t ia6t_expire; /* valid lifetime expiration time */
time_t ia6t_preferred; /* preferred lifetime expiration time */
u_int32_t ia6t_vltime; /* valid lifetime */
u_int32_t ia6t_pltime; /* prefix lifetime */
};
struct in6_ifreq {
char ifr_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
union {
struct sockaddr_in6 ifru_addr; /* address */
struct sockaddr_in6 ifru_dstaddr; /* other end of p-to-p link */
unsigned ifru_prefixlen; /* address prefix length */
} ifr_ifru;
};
struct in6_aliasreq {
char ifra_name[IFNAMSIZ];
struct sockaddr_in6 ifra_addr; /* The address to set */
struct sockaddr_in6 ifra_dstaddr; /* Peer address for PPP interfaces */
struct sockaddr_in6 ifra_prefixmask; /* Mask to get the nework ID */
int ifra_flags; /* IN6_IFF_xxx flags */
struct in6_addrlifetime ifra_lifetime;
};
#define IN6_IFF_TEMPORARY 0x01 /* temporary (anonymous) address. */
#define IN6_IFF_TENTATIVE 0x02 /* tentative address */
#define IN6_IFF_HOMEADDRESS 0x04 /* MIP6 home address */
#define IN6_IFF_DEPRECATED 0x08 /* deprecated address */
#define IN6_IFF_AUTOMATIC 0x10 /* create automatically by IPNET */
#define IN6_IFF_AUTONOMOUS 0x20 /* create based on prefix adv */
#define IN6_IFF_ANYCAST 0x40 /* anycast address */
#ifdef __cplusplus
}
#endif
#endif /* _NETINET6_IN6_VAR_H_ */
@@ -0,0 +1,339 @@
/* ip6.h - IPv6 protocol definitions */
/*
* Copyright (c) 2001-2005 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/* $FreeBSD: src/sys/netinet/ip6.h,v 1.2.2.2 2001/07/03 11:01:46 ume Exp $ */
/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* 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.
*/
/*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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
*/
/*
modification history
--------------------
01m,09jan12,h_x Move extern "C" after last header file include.
01l,25oct06,kch Removed unused coreip specific IP6_EXTHDR macros.
01k,21jun05,dlk Improve IP6_EXTHDR_CHECK() macro.
01j,03may05,rp removed __attribute__((__packed__))
01i,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev
01h,07feb05,vvv _KERNEL cleanup
01g,14jan05,vvv osdep.h cleanup
01f,20nov03,niq Remove copyright_wrs.h file inclusion
01e,05nov03,cdw Removal of unnecessary _KERNEL guards.
01d,04nov03,rlm Ran batch header path update for header re-org.
01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
01b,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in
accordion codeline to Base6
01b,17feb02,pas EAR code cleanup
01a,01sep01,qli created
*/
#ifndef _NETINET_IP6_H_
#define _NETINET_IP6_H_
#include <netVersion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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 */
};
#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
#if 1
/* ECN bits proposed by Sally Floyd */
#define IP6TOS_CE 0x01 /* congestion experienced */
#define IP6TOS_ECT 0x02 /* ECN-capable transport */
#endif
#ifdef _WRS_KERNEL
/*
* for IPv6 pseudo header checksum
* XXX nonstandard
*/
struct ip6_hdr_pseudo {
struct in6_addr ip6ph_src;
struct in6_addr ip6ph_dst;
u_int32_t ip6ph_len;
u_int8_t ip6ph_zero[3];
u_int8_t ip6ph_nxt;
};
#endif
/*
* Extension Headers
*/
struct ip6_ext {
u_int8_t ip6e_nxt;
u_int8_t ip6e_len;
};
/* 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 */
};
/* 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 */
};
/* 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 */
#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */
#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */
#ifndef _WRS_KERNEL
#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */
#endif
#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 (RFC3542, recommended) */
#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
#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
#define IP6OPT_EID 0x8a /* 10 0 01010 */
#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
/* IPv6 options: common part */
struct ip6_opt {
u_int8_t ip6o_type;
u_int8_t ip6o_len;
};
/* Jumbo Payload Option */
struct ip6_opt_jumbo {
u_int8_t ip6oj_type;
u_int8_t ip6oj_len;
u_int8_t ip6oj_jumbo_len[4];
};
#define IP6OPT_JUMBO_LEN 6
/* 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 */
};
/* Tunnel Limit Option */
struct ip6_opt_tunnel {
u_int8_t ip6ot_type;
u_int8_t ip6ot_len;
u_int8_t ip6ot_encap_limit;
};
/* Router Alert Option */
struct ip6_opt_router {
u_int8_t ip6or_type;
u_int8_t ip6or_len;
u_int8_t ip6or_value[2];
};
/* 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
/* Home Address Option */
struct ip6_opt_home_address {
u_int8_t ip6oh_type;
u_int8_t ip6oh_len;
u_int8_t ip6oh_addr[16];/* Home Address */
/* followed by sub-options */
};
/* 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 */
};
/* 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 */
u_int32_t ip6r0_reserved; /* reserved field */
/* followed by up to 127 struct in6_addr */
};
/* Type 2 Routing header for Mobile IPv6 */
struct ip6_rthdr2 {
u_int8_t ip6r2_nxt; /* next header */
u_int8_t ip6r2_len; /* always 2 */
u_int8_t ip6r2_type; /* always 2 */
u_int8_t ip6r2_segleft; /* 0 or 1 */
u_int32_t ip6r2_reserved; /* reserved field */
struct in6_addr ip6r2_home; /* home address */
};
/* 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 */
};
#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.
*/
#define IPV6_MAXHLIM 255 /* maximum hoplimit */
#define IPV6_DEFHLIM 64 /* default hlim */
#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */
#define IPV6_HLIMDEC 1 /* subtracted when forwarding */
#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */
#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/
#define IPV6_MAXOPTHDR 2048 /* max option header size, 256 64-bit words */
#ifdef __cplusplus
}
#endif
#endif /* not _NETINET_IP6_H_ */
@@ -0,0 +1,174 @@
/* ip6_mroute.h - IPv6 mroute header file */
/* $KAME: ip6_mroute.h,v 1.29 2004/05/21 08:17:58 itojun Exp $ */
/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.2.2.3 2002/04/28 05:40:27 suz Exp $ */
/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */
/*
* Copyright (c) 2001-2007 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
* Copyright (C) 1998 WIDE Project.
* 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.
*/
/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */
/*
* Definitions for IP multicast forwarding.
*
* Written by David Waitzman, BBN Labs, August 1988.
* Modified by Steve Deering, Stanford, February 1989.
* Modified by Ajit Thyagarajan, PARC, August 1993.
* Modified by Ajit Thyagarajan, PARC, August 1994.
* Modified by Ahmed Helmy, USC, September 1996.
*
* MROUTING Revision: 1.2
*/
/*
modification history
--------------------
01i,09jan12,h_x Move extern "C" after last header file include.
01h,12jul07,kch Re-integrated to support multicast forwarding for IPNET
(WIND00102340).
01g,20may05,kch Redefined cfg_privInitSysctl as function pointer. Moved
ip6MrouteSysctlInit() prototype to sysctlLib.h.
01f,26apr05,kch Allow ip6 mrouter to be scaled out.
01e,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev
01d,28jan05,kc Redefined IF_COPY and IF_ZERO macros.
01c,28dec04,kc Added ipm6_config_params structure. Also added
ip6MrouteSysctlInit() prototype.
01b,23dec04,kc Added pim6_input() and ip6MrouterInstInit() prototypes.
01a,08dec04,kc Integrated Kame changes.
*/
#ifndef _NETINET6_IP6_MROUTE_H_
#define _NETINET6_IP6_MROUTE_H_
#include <netinet6/in6.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Multicast Routing set/getsockopt commands.
*/
#define MRT6_BASE 0x60000000
#define MRT6_INIT (MRT6_BASE + 0) /* initialize mrouted */
#define MRT6_DONE (MRT6_BASE + 1) /* shut down mrouted */
#define MRT6_ADD_MIF (MRT6_BASE + 2) /* add multicast interface */
#define MRT6_DEL_MIF (MRT6_BASE + 3) /* delete multicast interface */
#define MRT6_ADD_MFC (MRT6_BASE + 4) /* add forwarding cache entry */
#define MRT6_DEL_MFC (MRT6_BASE + 5) /* delete forwarding cache entry */
#define MRT6_PIM (MRT6_BASE + 6) /* enable pim code */
/*
* Types and macros for handling bitmaps with one bit per multicast interface.
*/
typedef u_short mifi_t; /* type of a mif index */
#define MAXMIFS 64 /* Maximum number of multicast interfaces */
#ifndef IF_SETSIZE
#define IF_SETSIZE 256
#endif
typedef u_int32_t if_mask;
#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
typedef struct if_set {
if_mask ifs_bits[(((IF_SETSIZE)+((NIFBITS)-1))/(NIFBITS))];
} if_set;
/* Macros to operate on the mf6cc_ifset bit array */
#define IF_SET(n, p) \
((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
#define IF_CLR(n, p) \
((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
#define IF_ISSET(n, p) \
((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
#define IF_COPY(f, t) bcopy(f, t, sizeof(struct if_set))
#define IF_ZERO(p) bzero(p, sizeof(struct if_set))
/*
* Argument structure for MRT6_ADD_MIF and MRT6_DEL_MIF.
*/
struct mif6ctl {
mifi_t mif6c_mifi; /* the index of the mif to be added */
u_char mif6c_flags; /* MIFF_ flags defined below */
u_short mif6c_pifi; /* the index of the physical IF */
};
#define MIFF_REGISTER 0x1 /* mif represents a register end-point */
/*
* Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
*/
struct mf6cctl {
struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */
struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
mifi_t mf6cc_parent; /* incoming ifindex */
struct if_set mf6cc_ifset; /* set of forwarding ifs */
};
/*
* Argument structure for SIOCGETSGCNT_IN6
* Used by a multicast routing daemon to get src-grp packet counts
*/
struct sioc_sg_req6 {
struct sockaddr_in6 src; /* Source address */
struct sockaddr_in6 grp; /* Multicast group address */
u_int64_t pktcnt; /* No of packets routed */
u_int64_t bytecnt; /* No of bytes routed */
u_int64_t wrong_if; /* No of packets arrived on wrong interface */
};
/*
* Argument structure for SIOCGETMIFCNT_IN6
* Used by a multicast routing daemon to get multicast interface packet
* counts.
*/
struct sioc_mif_req6 {
mifi_t mifi; /* mif number */
u_int64_t icount; /* Input packet count */
u_int64_t ocount; /* Output packet count */
u_int64_t ibytes; /* Input byte count */
u_int64_t obytes; /* Output byte count */
};
#ifdef __cplusplus
}
#endif
#endif /* !_NETINET6_IP6_MROUTE_H_ */