| 1 | #ifndef _IPV6_H |
|---|
| 2 | #define _IPV6_H |
|---|
| 3 | |
|---|
| 4 | #include <asm/types.h> |
|---|
| 5 | #include <linux/in6.h> |
|---|
| 6 | #include <endian.h> |
|---|
| 7 | #include <byteswap.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 | #ifndef _NETINET_IN_H |
|---|
| 20 | |
|---|
| 21 | struct in6_pktinfo { |
|---|
| 22 | struct in6_addr ipi6_addr; |
|---|
| 23 | int ipi6_ifindex; |
|---|
| 24 | }; |
|---|
| 25 | |
|---|
| 26 | #endif |
|---|
| 27 | |
|---|
| 28 | struct in6_ifreq { |
|---|
| 29 | struct in6_addr ifr6_addr; |
|---|
| 30 | __u32 ifr6_prefixlen; |
|---|
| 31 | int ifr6_ifindex; |
|---|
| 32 | }; |
|---|
| 33 | |
|---|
| 34 | #define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ |
|---|
| 35 | #define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ |
|---|
| 36 | |
|---|
| 37 | /* |
|---|
| 38 | * routing header |
|---|
| 39 | */ |
|---|
| 40 | struct ipv6_rt_hdr { |
|---|
| 41 | __u8 nexthdr; |
|---|
| 42 | __u8 hdrlen; |
|---|
| 43 | __u8 type; |
|---|
| 44 | __u8 segments_left; |
|---|
| 45 | |
|---|
| 46 | /* |
|---|
| 47 | * type specific data |
|---|
| 48 | * variable length field |
|---|
| 49 | */ |
|---|
| 50 | }; |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | struct ipv6_opt_hdr { |
|---|
| 54 | __u8 nexthdr; |
|---|
| 55 | __u8 hdrlen; |
|---|
| 56 | /* |
|---|
| 57 | * TLV encoded option data follows. |
|---|
| 58 | */ |
|---|
| 59 | }; |
|---|
| 60 | |
|---|
| 61 | #define ipv6_destopt_hdr ipv6_opt_hdr |
|---|
| 62 | #define ipv6_hopopt_hdr ipv6_opt_hdr |
|---|
| 63 | |
|---|
| 64 | /* |
|---|
| 65 | * routing header type 0 (used in cmsghdr struct) |
|---|
| 66 | */ |
|---|
| 67 | |
|---|
| 68 | struct rt0_hdr { |
|---|
| 69 | struct ipv6_rt_hdr rt_hdr; |
|---|
| 70 | __u32 bitmap; /* strict/loose bit map */ |
|---|
| 71 | struct in6_addr addr[0]; |
|---|
| 72 | |
|---|
| 73 | #define rt0_type rt_hdr.type |
|---|
| 74 | }; |
|---|
| 75 | |
|---|
| 76 | struct ipv6_auth_hdr { |
|---|
| 77 | __u8 nexthdr; |
|---|
| 78 | __u8 hdrlen; /* This one is measured in 32 bit units! */ |
|---|
| 79 | __u16 reserved; |
|---|
| 80 | __u32 spi; |
|---|
| 81 | __u32 seq_no; /* Sequence number */ |
|---|
| 82 | __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */ |
|---|
| 83 | }; |
|---|
| 84 | |
|---|
| 85 | struct ipv6_esp_hdr { |
|---|
| 86 | __u32 spi; |
|---|
| 87 | __u32 seq_no; /* Sequence number */ |
|---|
| 88 | __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | struct ipv6_comp_hdr { |
|---|
| 92 | __u8 nexthdr; |
|---|
| 93 | __u8 flags; |
|---|
| 94 | __u16 cpi; |
|---|
| 95 | }; |
|---|
| 96 | |
|---|
| 97 | /* |
|---|
| 98 | * IPv6 fixed header |
|---|
| 99 | * |
|---|
| 100 | * BEWARE, it is incorrect. The first 4 bits of flow_lbl |
|---|
| 101 | * are glued to priority now, forming "class". |
|---|
| 102 | */ |
|---|
| 103 | |
|---|
| 104 | struct ipv6hdr { |
|---|
| 105 | #if defined(__LITTLE_ENDIAN) |
|---|
| 106 | __u8 priority:4, |
|---|
| 107 | version:4; |
|---|
| 108 | #elif defined(__BIG_ENDIAN) |
|---|
| 109 | __u8 version:4, |
|---|
| 110 | priority:4; |
|---|
| 111 | #else |
|---|
| 112 | #error "Endian problem - this didn't happen" |
|---|
| 113 | #endif |
|---|
| 114 | __u8 flow_lbl[3]; |
|---|
| 115 | |
|---|
| 116 | __u16 payload_len; |
|---|
| 117 | __u8 nexthdr; |
|---|
| 118 | __u8 hop_limit; |
|---|
| 119 | |
|---|
| 120 | struct in6_addr saddr; |
|---|
| 121 | struct in6_addr daddr; |
|---|
| 122 | }; |
|---|
| 123 | |
|---|
| 124 | /* |
|---|
| 125 | * This structure contains configuration options per IPv6 link. |
|---|
| 126 | */ |
|---|
| 127 | struct ipv6_devconf { |
|---|
| 128 | __s32 forwarding; |
|---|
| 129 | __s32 hop_limit; |
|---|
| 130 | __s32 mtu6; |
|---|
| 131 | __s32 accept_ra; |
|---|
| 132 | __s32 accept_redirects; |
|---|
| 133 | __s32 autoconf; |
|---|
| 134 | __s32 dad_transmits; |
|---|
| 135 | __s32 rtr_solicits; |
|---|
| 136 | __s32 rtr_solicit_interval; |
|---|
| 137 | __s32 rtr_solicit_delay; |
|---|
| 138 | __s32 force_mld_version; |
|---|
| 139 | #ifdef CONFIG_IPV6_PRIVACY |
|---|
| 140 | __s32 use_tempaddr; |
|---|
| 141 | __s32 temp_valid_lft; |
|---|
| 142 | __s32 temp_prefered_lft; |
|---|
| 143 | __s32 regen_max_retry; |
|---|
| 144 | __s32 max_desync_factor; |
|---|
| 145 | #endif |
|---|
| 146 | __s32 max_addresses; |
|---|
| 147 | void *sysctl; |
|---|
| 148 | }; |
|---|
| 149 | |
|---|
| 150 | /* index values for the variables in ipv6_devconf */ |
|---|
| 151 | enum { |
|---|
| 152 | DEVCONF_FORWARDING = 0, |
|---|
| 153 | DEVCONF_HOPLIMIT, |
|---|
| 154 | DEVCONF_MTU6, |
|---|
| 155 | DEVCONF_ACCEPT_RA, |
|---|
| 156 | DEVCONF_ACCEPT_REDIRECTS, |
|---|
| 157 | DEVCONF_AUTOCONF, |
|---|
| 158 | DEVCONF_DAD_TRANSMITS, |
|---|
| 159 | DEVCONF_RTR_SOLICITS, |
|---|
| 160 | DEVCONF_RTR_SOLICIT_INTERVAL, |
|---|
| 161 | DEVCONF_RTR_SOLICIT_DELAY, |
|---|
| 162 | DEVCONF_USE_TEMPADDR, |
|---|
| 163 | DEVCONF_TEMP_VALID_LFT, |
|---|
| 164 | DEVCONF_TEMP_PREFERED_LFT, |
|---|
| 165 | DEVCONF_REGEN_MAX_RETRY, |
|---|
| 166 | DEVCONF_MAX_DESYNC_FACTOR, |
|---|
| 167 | DEVCONF_MAX_ADDRESSES, |
|---|
| 168 | DEVCONF_FORCE_MLD_VERSION, |
|---|
| 169 | DEVCONF_MAX |
|---|
| 170 | }; |
|---|
| 171 | |
|---|
| 172 | #endif |
|---|