David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 1 | #ifndef _UAPI_IPV6_H |
| 2 | #define _UAPI_IPV6_H |
| 3 | |
Willem de Bruijn | c66ad9c | 2015-01-12 14:29:34 -0500 | [diff] [blame] | 4 | #include <linux/libc-compat.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 5 | #include <linux/types.h> |
| 6 | #include <linux/in6.h> |
| 7 | #include <asm/byteorder.h> |
| 8 | |
| 9 | /* The latest drafts declared increase in minimal mtu up to 1280. */ |
| 10 | |
| 11 | #define IPV6_MIN_MTU 1280 |
| 12 | |
| 13 | /* |
| 14 | * Advanced API |
| 15 | * source interface/address selection, source routing, etc... |
| 16 | * *under construction* |
| 17 | */ |
| 18 | |
WANG Cong | 3b50d90 | 2015-01-06 15:45:31 -0800 | [diff] [blame] | 19 | #if __UAPI_DEF_IN6_PKTINFO |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 20 | struct in6_pktinfo { |
| 21 | struct in6_addr ipi6_addr; |
| 22 | int ipi6_ifindex; |
| 23 | }; |
WANG Cong | 3b50d90 | 2015-01-06 15:45:31 -0800 | [diff] [blame] | 24 | #endif |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 25 | |
WANG Cong | 3b50d90 | 2015-01-06 15:45:31 -0800 | [diff] [blame] | 26 | #if __UAPI_DEF_IP6_MTUINFO |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 27 | struct ip6_mtuinfo { |
| 28 | struct sockaddr_in6 ip6m_addr; |
| 29 | __u32 ip6m_mtu; |
| 30 | }; |
WANG Cong | 3b50d90 | 2015-01-06 15:45:31 -0800 | [diff] [blame] | 31 | #endif |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 32 | |
| 33 | struct in6_ifreq { |
| 34 | struct in6_addr ifr6_addr; |
| 35 | __u32 ifr6_prefixlen; |
| 36 | int ifr6_ifindex; |
| 37 | }; |
| 38 | |
| 39 | #define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */ |
| 40 | #define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */ |
| 41 | #define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */ |
| 42 | |
| 43 | /* |
| 44 | * routing header |
| 45 | */ |
| 46 | struct ipv6_rt_hdr { |
| 47 | __u8 nexthdr; |
| 48 | __u8 hdrlen; |
| 49 | __u8 type; |
| 50 | __u8 segments_left; |
| 51 | |
| 52 | /* |
| 53 | * type specific data |
| 54 | * variable length field |
| 55 | */ |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | struct ipv6_opt_hdr { |
| 60 | __u8 nexthdr; |
| 61 | __u8 hdrlen; |
| 62 | /* |
| 63 | * TLV encoded option data follows. |
| 64 | */ |
| 65 | } __attribute__((packed)); /* required for some archs */ |
| 66 | |
| 67 | #define ipv6_destopt_hdr ipv6_opt_hdr |
| 68 | #define ipv6_hopopt_hdr ipv6_opt_hdr |
| 69 | |
YOSHIFUJI Hideaki / 吉藤英明 | dd3332b | 2013-01-13 05:02:45 +0000 | [diff] [blame] | 70 | /* Router Alert option values (RFC2711) */ |
| 71 | #define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */ |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 72 | |
| 73 | /* |
| 74 | * routing header type 0 (used in cmsghdr struct) |
| 75 | */ |
| 76 | |
| 77 | struct rt0_hdr { |
| 78 | struct ipv6_rt_hdr rt_hdr; |
| 79 | __u32 reserved; |
| 80 | struct in6_addr addr[0]; |
| 81 | |
| 82 | #define rt0_type rt_hdr.type |
| 83 | }; |
| 84 | |
| 85 | /* |
| 86 | * routing header type 2 |
| 87 | */ |
| 88 | |
| 89 | struct rt2_hdr { |
| 90 | struct ipv6_rt_hdr rt_hdr; |
| 91 | __u32 reserved; |
| 92 | struct in6_addr addr; |
| 93 | |
| 94 | #define rt2_type rt_hdr.type |
| 95 | }; |
| 96 | |
| 97 | /* |
| 98 | * home address option in destination options header |
| 99 | */ |
| 100 | |
| 101 | struct ipv6_destopt_hao { |
| 102 | __u8 type; |
| 103 | __u8 length; |
| 104 | struct in6_addr addr; |
| 105 | } __attribute__((packed)); |
| 106 | |
| 107 | /* |
| 108 | * IPv6 fixed header |
| 109 | * |
| 110 | * BEWARE, it is incorrect. The first 4 bits of flow_lbl |
| 111 | * are glued to priority now, forming "class". |
| 112 | */ |
| 113 | |
| 114 | struct ipv6hdr { |
| 115 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 116 | __u8 priority:4, |
| 117 | version:4; |
| 118 | #elif defined(__BIG_ENDIAN_BITFIELD) |
| 119 | __u8 version:4, |
| 120 | priority:4; |
| 121 | #else |
| 122 | #error "Please fix <asm/byteorder.h>" |
| 123 | #endif |
| 124 | __u8 flow_lbl[3]; |
| 125 | |
| 126 | __be16 payload_len; |
| 127 | __u8 nexthdr; |
| 128 | __u8 hop_limit; |
| 129 | |
| 130 | struct in6_addr saddr; |
| 131 | struct in6_addr daddr; |
| 132 | }; |
| 133 | |
| 134 | |
| 135 | /* index values for the variables in ipv6_devconf */ |
| 136 | enum { |
| 137 | DEVCONF_FORWARDING = 0, |
| 138 | DEVCONF_HOPLIMIT, |
| 139 | DEVCONF_MTU6, |
| 140 | DEVCONF_ACCEPT_RA, |
| 141 | DEVCONF_ACCEPT_REDIRECTS, |
| 142 | DEVCONF_AUTOCONF, |
| 143 | DEVCONF_DAD_TRANSMITS, |
| 144 | DEVCONF_RTR_SOLICITS, |
| 145 | DEVCONF_RTR_SOLICIT_INTERVAL, |
| 146 | DEVCONF_RTR_SOLICIT_DELAY, |
| 147 | DEVCONF_USE_TEMPADDR, |
| 148 | DEVCONF_TEMP_VALID_LFT, |
| 149 | DEVCONF_TEMP_PREFERED_LFT, |
| 150 | DEVCONF_REGEN_MAX_RETRY, |
| 151 | DEVCONF_MAX_DESYNC_FACTOR, |
| 152 | DEVCONF_MAX_ADDRESSES, |
| 153 | DEVCONF_FORCE_MLD_VERSION, |
| 154 | DEVCONF_ACCEPT_RA_DEFRTR, |
| 155 | DEVCONF_ACCEPT_RA_PINFO, |
| 156 | DEVCONF_ACCEPT_RA_RTR_PREF, |
| 157 | DEVCONF_RTR_PROBE_INTERVAL, |
| 158 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, |
| 159 | DEVCONF_PROXY_NDP, |
| 160 | DEVCONF_OPTIMISTIC_DAD, |
| 161 | DEVCONF_ACCEPT_SOURCE_ROUTE, |
| 162 | DEVCONF_MC_FORWARDING, |
| 163 | DEVCONF_DISABLE_IPV6, |
| 164 | DEVCONF_ACCEPT_DAD, |
| 165 | DEVCONF_FORCE_TLLAO, |
Hannes Frederic Sowa | 5cb0443 | 2012-11-06 16:46:20 +0000 | [diff] [blame] | 166 | DEVCONF_NDISC_NOTIFY, |
Hannes Frederic Sowa | fc4eba5 | 2013-08-14 01:03:46 +0200 | [diff] [blame] | 167 | DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL, |
| 168 | DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, |
Hannes Frederic Sowa | b800c3b | 2013-08-27 01:36:51 +0200 | [diff] [blame] | 169 | DEVCONF_SUPPRESS_FRAG_NDISC, |
Ben Greear | d933319 | 2014-06-25 14:44:53 -0700 | [diff] [blame] | 170 | DEVCONF_ACCEPT_RA_FROM_LOCAL, |
Erik Kline | 7fd2561 | 2014-10-28 18:11:14 +0900 | [diff] [blame] | 171 | DEVCONF_USE_OPTIMISTIC, |
Harout Hedeshian | c2943f1 | 2015-01-20 10:06:05 -0700 | [diff] [blame] | 172 | DEVCONF_ACCEPT_RA_MTU, |
Hannes Frederic Sowa | 3d1bec9 | 2015-03-23 23:36:00 +0100 | [diff] [blame] | 173 | DEVCONF_STABLE_SECRET, |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 174 | DEVCONF_MAX |
| 175 | }; |
| 176 | |
| 177 | |
| 178 | #endif /* _UAPI_IPV6_H */ |