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
45 uint32_t ip6_un1_flow;
46 uint16_t ip6_un1_plen;
52 struct in6_addr ip6_src;
53 struct in6_addr ip6_dst;
54 } __attribute__((__gcc_struct__)) __attribute((__packed__));
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 #ifndef HAVE_STRUCT_ICMP6_HDR
69 uint32_t icmp6_un_data32[1];
70 uint16_t icmp6_un_data16[2];
71 uint8_t icmp6_un_data8[4];
73 } __attribute__((__gcc_struct__)) __attribute((__packed__));
74 #define ICMP6_DST_UNREACH_NOROUTE 0
75 #define ICMP6_DST_UNREACH 1
76 #define ICMP6_PACKET_TOO_BIG 2
77 #define ICMP6_TIME_EXCEEDED 3
78 #define ICMP6_DST_UNREACH_ADMIN 1
79 #define ICMP6_DST_UNREACH_ADDR 3
80 #define ICMP6_TIME_EXCEED_TRANSIT 0
81 #define ND_NEIGHBOR_SOLICIT 135
82 #define ND_NEIGHBOR_ADVERT 136
83 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
84 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
85 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
86 #define icmp6_mtu icmp6_data32[0]
89 #ifndef HAVE_STRUCT_ND_NEIGHBOR_SOLICIT
90 struct nd_neighbor_solicit {
91 struct icmp6_hdr nd_ns_hdr;
92 struct in6_addr nd_ns_target;
93 } __attribute__((__gcc_struct__)) __attribute((__packed__));
94 #define ND_OPT_SOURCE_LINKADDR 1
95 #define ND_OPT_TARGET_LINKADDR 2
96 #define nd_ns_type nd_ns_hdr.icmp6_type
97 #define nd_ns_code nd_ns_hdr.icmp6_code
98 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
99 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
102 #ifndef HAVE_STRUCT_ND_OPT_HDR
106 } __attribute__((__gcc_struct__)) __attribute((__packed__));