5 ipv6.h -- missing IPv6 related definitions
6 Copyright (C) 2005 Ivo Timmermans
7 2006-2016 Guus Sliepen <guus@tinc-vpn.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #ifndef IPPROTO_ICMPV6
31 #define IPPROTO_ICMPV6 58
34 #ifndef IN6_IS_ADDR_V4MAPPED
35 #define IN6_IS_ADDR_V4MAPPED(a) \
36 ((((__const uint32_t *) (a))[0] == 0) \
37 && (((__const uint32_t *) (a))[1] == 0) \
38 && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
41 #ifndef HAVE_STRUCT_IP6_HDR
42 PACKED(struct ip6_hdr {
45 uint32_t ip6_un1_flow;
46 uint16_t ip6_un1_plen;
52 struct in6_addr ip6_src;
53 struct in6_addr ip6_dst;
55 #define ip6_vfc ip6_ctlun.ip6_un2_vfc
56 #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
57 #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
58 #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
59 #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
60 #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
63 STATIC_ASSERT(sizeof(struct ip6_hdr) == 40, "ip6_hdr has incorrect size");
65 #ifndef HAVE_STRUCT_ICMP6_HDR
66 PACKED(struct icmp6_hdr {
71 uint32_t icmp6_un_data32[1];
72 uint16_t icmp6_un_data16[2];
73 uint8_t icmp6_un_data8[4];
76 #define ICMP6_DST_UNREACH_NOROUTE 0
77 #define ICMP6_DST_UNREACH 1
78 #define ICMP6_PACKET_TOO_BIG 2
79 #define ICMP6_TIME_EXCEEDED 3
80 #define ICMP6_DST_UNREACH_ADMIN 1
81 #define ICMP6_DST_UNREACH_ADDR 3
82 #define ICMP6_TIME_EXCEED_TRANSIT 0
83 #define ND_NEIGHBOR_SOLICIT 135
84 #define ND_NEIGHBOR_ADVERT 136
85 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
86 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
87 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
88 #define icmp6_mtu icmp6_data32[0]
91 STATIC_ASSERT(sizeof(struct icmp6_hdr) == 8, "icmp6_hdr has incorrect size");
93 #ifndef HAVE_STRUCT_ND_NEIGHBOR_SOLICIT
94 PACKED(struct nd_neighbor_solicit {
95 struct icmp6_hdr nd_ns_hdr;
96 struct in6_addr nd_ns_target;
98 #define ND_OPT_SOURCE_LINKADDR 1
99 #define ND_OPT_TARGET_LINKADDR 2
100 #define nd_ns_type nd_ns_hdr.icmp6_type
101 #define nd_ns_code nd_ns_hdr.icmp6_code
102 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
103 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
106 STATIC_ASSERT(sizeof(struct nd_neighbor_solicit) == 24, "nd_neighbor_solicit has incorrect size");
108 #ifndef HAVE_STRUCT_ND_OPT_HDR
109 PACKED(struct nd_opt_hdr {
115 STATIC_ASSERT(sizeof(struct nd_opt_hdr) == 2, "nd_opt_hdr has incorrect size");