2 ipv6.h -- missing IPv6 related definitions
3 Copyright (C) 2005 Ivo Timmermans
4 2006-2016 Guus Sliepen <guus@tinc-vpn.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef __TINC_IPV6_H__
22 #define __TINC_IPV6_H__
28 #ifndef IPPROTO_ICMPV6
29 #define IPPROTO_ICMPV6 58
32 #ifndef IN6_IS_ADDR_V4MAPPED
33 #define IN6_IS_ADDR_V4MAPPED(a) \
34 ((((__const uint32_t *) (a))[0] == 0) \
35 && (((__const uint32_t *) (a))[1] == 0) \
36 && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
39 #ifndef HAVE_STRUCT_IP6_HDR
43 uint32_t ip6_un1_flow;
44 uint16_t ip6_un1_plen;
50 struct in6_addr ip6_src;
51 struct in6_addr ip6_dst;
52 } __attribute__ ((__gcc_struct__, __packed__));
53 #define ip6_vfc ip6_ctlun.ip6_un2_vfc
54 #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
55 #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
56 #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
57 #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
58 #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
61 #ifndef HAVE_STRUCT_ICMP6_HDR
67 uint32_t icmp6_un_data32[1];
68 uint16_t icmp6_un_data16[2];
69 uint8_t icmp6_un_data8[4];
71 } __attribute__ ((__gcc_struct__, __packed__));
72 #define ICMP6_DST_UNREACH_NOROUTE 0
73 #define ICMP6_DST_UNREACH 1
74 #define ICMP6_PACKET_TOO_BIG 2
75 #define ICMP6_TIME_EXCEEDED 3
76 #define ICMP6_DST_UNREACH_ADMIN 1
77 #define ICMP6_DST_UNREACH_ADDR 3
78 #define ICMP6_TIME_EXCEED_TRANSIT 0
79 #define ND_NEIGHBOR_SOLICIT 135
80 #define ND_NEIGHBOR_ADVERT 136
81 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
82 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
83 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
84 #define icmp6_mtu icmp6_data32[0]
87 #ifndef HAVE_STRUCT_ND_NEIGHBOR_SOLICIT
88 struct nd_neighbor_solicit {
89 struct icmp6_hdr nd_ns_hdr;
90 struct in6_addr nd_ns_target;
91 } __attribute__ ((__gcc_struct__, __packed__));
92 #define ND_OPT_SOURCE_LINKADDR 1
93 #define ND_OPT_TARGET_LINKADDR 2
94 #define nd_ns_type nd_ns_hdr.icmp6_type
95 #define nd_ns_code nd_ns_hdr.icmp6_code
96 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
97 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
100 #ifndef HAVE_STRUCT_ND_OPT_HDR
104 } __attribute__ ((__gcc_struct__, __packed__));
107 #endif /* __TINC_IPV6_H__ */