1 #ifndef _UAPI_IPV6_H 2 #define _UAPI_IPV6_H 3 4 #include <linux/libc-compat.h> 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 19 #if __UAPI_DEF_IN6_PKTINFO 20 struct in6_pktinfo { 21 struct in6_addr ipi6_addr; 22 int ipi6_ifindex; 23 }; 24 #endif 25 26 #if __UAPI_DEF_IP6_MTUINFO 27 struct ip6_mtuinfo { 28 struct sockaddr_in6 ip6m_addr; 29 __u32 ip6m_mtu; 30 }; 31 #endif 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 70 /* Router Alert option values (RFC2711) */ 71 #define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */ 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, 166 DEVCONF_NDISC_NOTIFY, 167 DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL, 168 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, 169 DEVCONF_SUPPRESS_FRAG_NDISC, 170 DEVCONF_ACCEPT_RA_FROM_LOCAL, 171 DEVCONF_USE_OPTIMISTIC, 172 DEVCONF_ACCEPT_RA_MTU, 173 DEVCONF_STABLE_SECRET, 174 DEVCONF_USE_OIF_ADDRS_ONLY, 175 DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT, 176 DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, 177 DEVCONF_MAX 178 }; 179 180 181 #endif /* _UAPI_IPV6_H */ 182