16846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* $NetBSD: ip6.h,v 1.23 2007/12/25 18:33:46 perry Exp $ */ 26846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* $KAME: ip6.h,v 1.45 2003/06/05 04:46:38 keiichi Exp $ */ 36846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 46846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 56846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 66846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * All rights reserved. 76846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 86846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Redistribution and use in source and binary forms, with or without 96846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * modification, are permitted provided that the following conditions 106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * are met: 116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 1. Redistributions of source code must retain the above copyright 126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * notice, this list of conditions and the following disclaimer. 136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 2. Redistributions in binary form must reproduce the above copyright 146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * notice, this list of conditions and the following disclaimer in the 156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * documentation and/or other materials provided with the distribution. 166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 3. Neither the name of the project nor the names of its contributors 176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * may be used to endorse or promote products derived from this software 186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * without specific prior written permission. 196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * SUCH DAMAGE. 316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Copyright (c) 1982, 1986, 1993 356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * The Regents of the University of California. All rights reserved. 366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Redistribution and use in source and binary forms, with or without 386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * modification, are permitted provided that the following conditions 396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * are met: 406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 1. Redistributions of source code must retain the above copyright 416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * notice, this list of conditions and the following disclaimer. 426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 2. Redistributions in binary form must reproduce the above copyright 436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * notice, this list of conditions and the following disclaimer in the 446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * documentation and/or other materials provided with the distribution. 456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 3. Neither the name of the University nor the names of its contributors 466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * may be used to endorse or promote products derived from this software 476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * without specific prior written permission. 486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * SUCH DAMAGE. 606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * @(#)ip.h 8.1 (Berkeley) 6/10/93 626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifndef _NETINET_IP6_H_ 656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define _NETINET_IP6_H_ 666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 67203e13d97de840e01eded6a267fef9f245cf3a15Elliott Hughes#include <sys/cdefs.h> 68ef7c95b8ab96897db09faec974c2547305887cbeJosh Gao#include <sys/types.h> 6981b4aadb4857f351915b6fc215a73baacc90d22aJosh Gao#include <endian.h> 70ef7c95b8ab96897db09faec974c2547305887cbeJosh Gao 71ef7c95b8ab96897db09faec974c2547305887cbeJosh Gao#include <linux/in6.h> 72ef7c95b8ab96897db09faec974c2547305887cbeJosh Gao 736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Definition for internet protocol version 6. 756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * RFC 2460 766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_hdr { 796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson union { 806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct ip6_hdrctl { 816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ 826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t ip6_un1_plen; /* payload length */ 836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6_un1_nxt; /* next header */ 846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6_un1_hlim; /* hop limit */ 856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson } ip6_un1; 866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ 876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson } ip6_ctlun; 886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr ip6_src; /* source address */ 896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr ip6_dst; /* destination address */ 906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ip6_vfc ip6_ctlun.ip6_un2_vfc 936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_VERSION 0x60 1006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_VERSION_MASK 0xf0 1016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ 1036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ 104497127711a3446dc2d9cfa0aca152f8c703e3d9cElliott Hughes 1056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if 1 1066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* ECN bits proposed by Sally Floyd */ 1076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6TOS_CE 0x01 /* congestion experienced */ 1086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6TOS_ECT 0x02 /* ECN-capable transport */ 1096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif 1106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 1126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Extension Headers 1136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 1146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_ext { 1166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6e_nxt; 1176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6e_len; 1186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Hop-by-Hop options header */ 1216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* XXX should we pad it to force alignment on an 8-byte boundary? */ 1226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_hbh { 1236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6h_nxt; /* next header */ 1246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6h_len; /* length in units of 8 octets */ 1256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by options */ 1266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Destination options header */ 1296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* XXX should we pad it to force alignment on an 8-byte boundary? */ 1306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_dest { 1316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6d_nxt; /* next header */ 1326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6d_len; /* length in units of 8 octets */ 1336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by options */ 1346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Option types and related macros */ 1376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ 1386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_PADN 0x01 /* 00 0 00001 */ 1396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ 1406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */ 1416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */ 1426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */ 1436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_ROUTER_ALERT 0x05 /* (RFC3542 def, recommended) */ 1446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_RTALERT_LEN 4 1466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ 1476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ 1486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ 1496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_MINLEN 2 1506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_TYPE(o) ((o) & 0xC0) 1526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_TYPE_SKIP 0x00 1536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_TYPE_DISCARD 0x40 1546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_TYPE_FORCEICMP 0x80 1556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_TYPE_ICMP 0xC0 1566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_MUTABLE 0x20 1586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* IPv6 options: common part */ 1606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_opt { 1616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6o_type; 1626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6o_len; 1636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Jumbo Payload Option */ 1666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_opt_jumbo { 1676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6oj_type; 1686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6oj_len; 1696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6oj_jumbo_len[4]; 1706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6OPT_JUMBO_LEN 6 1726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* NSAP Address Option */ 1746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_opt_nsap { 1756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6on_type; 1766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6on_len; 1776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6on_src_nsap_len; 1786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6on_dst_nsap_len; 1796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by source NSAP */ 1806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by destination NSAP */ 1816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Tunnel Limit Option */ 1846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_opt_tunnel { 1856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6ot_type; 1866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6ot_len; 1876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6ot_encap_limit; 1886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Router Alert Option */ 1916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_opt_router { 1926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6or_type; 1936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6or_len; 1946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6or_value[2]; 1956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Router alert values (in network byte order) */ 1976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6_ALERT_MLD 0x0000 1986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6_ALERT_RSVP 0x0100 1996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6_ALERT_AN 0x0200 2006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Routing header */ 2026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_rthdr { 2036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r_nxt; /* next header */ 2046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r_len; /* length in units of 8 octets */ 2056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r_type; /* routing type */ 2066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r_segleft; /* segments left */ 2076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by routing type specific data */ 2086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Type 0 Routing header */ 2116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_rthdr0 { 2126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r0_nxt; /* next header */ 2136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r0_len; /* length in units of 8 octets */ 2146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r0_type; /* always zero */ 2156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6r0_segleft; /* segments left */ 2166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t ip6r0_reserved; /* reserved field */ 2176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Fragment header */ 2206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ip6_frag { 2216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6f_nxt; /* next header */ 2226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ip6f_reserved; /* reserved field */ 2236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t ip6f_offlg; /* offset, reserved, and flag */ 2246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t ip6f_ident; /* identification */ 2256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ 2286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ 2296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ 2306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 2326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Internet implementation parameters. 2336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 2346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_MAXHLIM 255 /* maximum hoplimit */ 2356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_DEFHLIM 64 /* default hlim */ 2366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */ 2376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_HLIMDEC 1 /* subtracted when forwarding */ 2386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */ 2406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/ 2416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif /* !_NETINET_IP6_H_ */ 243