2 ipv6.h -- missing IPv6 related definitions
3 Copyright (C) 2005 Ivo Timmermans
4 2006 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 HAVE_STRUCT_IN6_ADDR
36 uint16_t u6_addr16[8];
37 uint32_t u6_addr32[4];
39 } __attribute__ ((__packed__));
40 #define s6_addr in6_u.u6_addr8
41 #define s6_addr16 in6_u.u6_addr16
42 #define s6_addr32 in6_u.u6_addr32
45 #ifndef HAVE_STRUCT_SOCKADDR_IN6
49 uint32_t sin6_flowinfo;
50 struct in6_addr sin6_addr;
51 uint32_t sin6_scope_id;
52 } __attribute__ ((__packed__));
55 #ifndef IN6_IS_ADDR_V4MAPPED
56 #define IN6_IS_ADDR_V4MAPPED(a) \
57 ((((__const uint32_t *) (a))[0] == 0) \
58 && (((__const uint32_t *) (a))[1] == 0) \
59 && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
62 #ifndef HAVE_STRUCT_IP6_HDR
66 uint32_t ip6_un1_flow;
67 uint16_t ip6_un1_plen;
73 struct in6_addr ip6_src;
74 struct in6_addr ip6_dst;
75 } __attribute__ ((__packed__));
76 #define ip6_vfc ip6_ctlun.ip6_un2_vfc
77 #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
78 #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
79 #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
80 #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
81 #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
84 #ifndef HAVE_STRUCT_ICMP6_HDR
90 uint32_t icmp6_un_data32[1];
91 uint16_t icmp6_un_data16[2];
92 uint8_t icmp6_un_data8[4];
94 } __attribute__ ((__packed__));
95 #define ICMP6_DST_UNREACH_NOROUTE 0
96 #define ICMP6_DST_UNREACH 1
97 #define ICMP6_PACKET_TOO_BIG 2
98 #define ICMP6_DST_UNREACH_ADMIN 1
99 #define ICMP6_DST_UNREACH_ADDR 3
100 #define ND_NEIGHBOR_SOLICIT 135
101 #define ND_NEIGHBOR_ADVERT 136
102 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
103 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
104 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
105 #define icmp6_mtu icmp6_data32[0]
108 #ifndef HAVE_STRUCT_ND_NEIGHBOR_SOLICIT
109 struct nd_neighbor_solicit {
110 struct icmp6_hdr nd_ns_hdr;
111 struct in6_addr nd_ns_target;
112 } __attribute__ ((__packed__));
113 #define ND_OPT_SOURCE_LINKADDR 1
114 #define ND_OPT_TARGET_LINKADDR 2
115 #define nd_ns_type nd_ns_hdr.icmp6_type
116 #define nd_ns_code nd_ns_hdr.icmp6_code
117 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
118 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
121 #ifndef HAVE_STRUCT_ND_OPT_HDR
125 } __attribute__ ((__packed__));
128 #endif /* __TINC_IPV6_H__ */