Blame view
include/linux/ipv6.h
7.23 KB
1da177e4c
|
1 2 |
#ifndef _IPV6_H #define _IPV6_H |
607ca46e9
|
3 |
#include <uapi/linux/ipv6.h> |
1da177e4c
|
4 |
|
1da177e4c
|
5 |
#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) |
1431fb31e
|
6 |
#define ipv6_authlen(p) (((p)->hdrlen+2) << 2) |
1da177e4c
|
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/* * This structure contains configuration options per IPv6 link. */ struct ipv6_devconf { __s32 forwarding; __s32 hop_limit; __s32 mtu6; __s32 accept_ra; __s32 accept_redirects; __s32 autoconf; __s32 dad_transmits; __s32 rtr_solicits; __s32 rtr_solicit_interval; __s32 rtr_solicit_delay; __s32 force_mld_version; |
fc4eba58b
|
22 23 |
__s32 mldv1_unsolicited_report_interval; __s32 mldv2_unsolicited_report_interval; |
1da177e4c
|
24 25 26 27 28 |
__s32 use_tempaddr; __s32 temp_valid_lft; __s32 temp_prefered_lft; __s32 regen_max_retry; __s32 max_desync_factor; |
1da177e4c
|
29 |
__s32 max_addresses; |
65f5c7c11
|
30 |
__s32 accept_ra_defrtr; |
c4fd30eb1
|
31 |
__s32 accept_ra_pinfo; |
930d6ff2e
|
32 33 |
#ifdef CONFIG_IPV6_ROUTER_PREF __s32 accept_ra_rtr_pref; |
52e163563
|
34 |
__s32 rtr_probe_interval; |
09c884d4c
|
35 36 37 |
#ifdef CONFIG_IPV6_ROUTE_INFO __s32 accept_ra_rt_info_max_plen; #endif |
930d6ff2e
|
38 |
#endif |
fbea49e1e
|
39 |
__s32 proxy_ndp; |
0bcbc9262
|
40 |
__s32 accept_source_route; |
d93331965
|
41 |
__s32 accept_ra_from_local; |
95c385b4d
|
42 43 |
#ifdef CONFIG_IPV6_OPTIMISTIC_DAD __s32 optimistic_dad; |
7fd2561e4
|
44 |
__s32 use_optimistic; |
95c385b4d
|
45 |
#endif |
7bc570c8b
|
46 47 48 |
#ifdef CONFIG_IPV6_MROUTE __s32 mc_forwarding; #endif |
778d80be5
|
49 |
__s32 disable_ipv6; |
1b34be74c
|
50 |
__s32 accept_dad; |
f7734fdf6
|
51 |
__s32 force_tllao; |
5cb04436e
|
52 |
__s32 ndisc_notify; |
b800c3b96
|
53 |
__s32 suppress_frag_ndisc; |
c2943f145
|
54 |
__s32 accept_ra_mtu; |
3d1bec993
|
55 56 57 58 |
struct ipv6_stable_secret { bool initialized; struct in6_addr secret; } stable_secret; |
1da177e4c
|
59 60 |
void *sysctl; }; |
56d417b12
|
61 62 63 64 65 66 |
struct ipv6_params { __s32 disable_ipv6; __s32 autoconf; }; extern struct ipv6_params ipv6_defaults; |
1da177e4c
|
67 |
#include <linux/icmpv6.h> |
1da177e4c
|
68 69 |
#include <linux/tcp.h> #include <linux/udp.h> |
14c850212
|
70 |
#include <net/inet_sock.h> |
0660e03f6
|
71 72 73 74 |
static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) { return (struct ipv6hdr *)skb_network_header(skb); } |
6a674e9c7
|
75 76 77 78 |
static inline struct ipv6hdr *inner_ipv6_hdr(const struct sk_buff *skb) { return (struct ipv6hdr *)skb_inner_network_header(skb); } |
39b89160d
|
79 80 |
static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) { |
9c70220b7
|
81 |
return (struct ipv6hdr *)skb_transport_header(skb); |
39b89160d
|
82 |
} |
1da177e4c
|
83 84 85 86 87 88 89 |
/* This structure contains results of exthdrs parsing as offsets from skb->nh. */ struct inet6_skb_parm { int iif; |
dd3332bfc
|
90 |
__be16 ra; |
1da177e4c
|
91 92 93 94 |
__u16 hop; __u16 dst0; __u16 srcrt; __u16 dst1; |
333fad536
|
95 |
__u16 lastopt; |
e7c38157c
|
96 |
__u16 nhoff; |
3e3850e98
|
97 |
__u16 flags; |
59fbb3a61
|
98 |
#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
8dd7368dd
|
99 100 |
__u16 dsthao; #endif |
4cdd34084
|
101 |
__u16 frag_max_size; |
3e3850e98
|
102 103 |
#define IP6SKB_XFRM_TRANSFORMED 1 |
7bc570c8b
|
104 |
#define IP6SKB_FORWARDED 2 |
9c6eb28ac
|
105 |
#define IP6SKB_REROUTED 4 |
dd3332bfc
|
106 |
#define IP6SKB_ROUTERALERT 8 |
f46078cfc
|
107 |
#define IP6SKB_FRAGMENTED 16 |
1da177e4c
|
108 109 110 |
}; #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) |
4b340ae20
|
111 |
#define IP6CBMTU(skb) ((struct ip6_mtuinfo *)((skb)->cb)) |
1da177e4c
|
112 |
|
505cbfc57
|
113 114 115 116 |
static inline int inet6_iif(const struct sk_buff *skb) { return IP6CB(skb)->iif; } |
ca304b610
|
117 118 |
struct tcp6_request_sock { struct tcp_request_sock tcp6rsk_tcp; |
ca304b610
|
119 |
}; |
2e6599cb8
|
120 |
|
20283d84c
|
121 122 123 |
struct ipv6_mc_socklist; struct ipv6_ac_socklist; struct ipv6_fl_socklist; |
366e41d97
|
124 125 126 127 128 |
struct inet6_cork { struct ipv6_txoptions *opt; u8 hop_limit; u8 tclass; }; |
1da177e4c
|
129 130 131 132 133 134 135 136 137 138 |
/** * struct ipv6_pinfo - ipv6 private area * * In the struct sock hierarchy (tcp6_sock, upd6_sock, etc) * this _must_ be the last member, so that inet6_sk_generic * is able to calculate its offset from the base struct sock * by using the struct proto->slab_obj_size member. -acme */ struct ipv6_pinfo { struct in6_addr saddr; |
b24a2516d
|
139 |
struct in6_pktinfo sticky_pktinfo; |
d3818c92a
|
140 |
const struct in6_addr *daddr_cache; |
8e1ef0a95
|
141 |
#ifdef CONFIG_IPV6_SUBTREES |
d3818c92a
|
142 |
const struct in6_addr *saddr_cache; |
8e1ef0a95
|
143 |
#endif |
1da177e4c
|
144 |
|
90bcaf7b4
|
145 |
__be32 flow_label; |
1da177e4c
|
146 |
__u32 frag_size; |
1d5d236d3
|
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
/* * Packed in 16bits. * Omit one shift by by putting the signed field at MSB. */ #if defined(__BIG_ENDIAN_BITFIELD) __s16 hop_limit:9; __u16 __unused_1:7; #else __u16 __unused_1:7; __s16 hop_limit:9; #endif #if defined(__BIG_ENDIAN_BITFIELD) /* Packed in 16bits. */ __s16 mcast_hops:9; __u16 __unused_2:6, mc_loop:1; #else __u16 mc_loop:1, __unused_2:6; __s16 mcast_hops:9; #endif |
c4062dfc4
|
170 |
int ucast_oif; |
1da177e4c
|
171 172 173 174 175 |
int mcast_oif; /* pktoption flags */ union { struct { |
4c752098f
|
176 177 |
__u16 srcrt:1, osrcrt:1, |
1da177e4c
|
178 |
rxinfo:1, |
333fad536
|
179 |
rxoinfo:1, |
1da177e4c
|
180 |
rxhlim:1, |
333fad536
|
181 |
rxohlim:1, |
1da177e4c
|
182 |
hopopts:1, |
333fad536
|
183 |
ohopopts:1, |
1da177e4c
|
184 |
dstopts:1, |
333fad536
|
185 |
odstopts:1, |
41a1f8ea4
|
186 |
rxflow:1, |
793b14731
|
187 |
rxtclass:1, |
6c4686228
|
188 189 190 |
rxpmtu:1, rxorigdstaddr:1; /* 2 bits hole */ |
1da177e4c
|
191 |
} bits; |
333fad536
|
192 |
__u16 all; |
1da177e4c
|
193 194 195 |
} rxopt; /* sockopt flags */ |
793b14731
|
196 |
__u16 recverr:1, |
1da177e4c
|
197 |
sndflow:1, |
df3687ffc
|
198 |
repflow:1, |
93b36cf34
|
199 |
pmtudisc:3, |
9fe516ba3
|
200 |
padding:1, /* 1 bit hole */ |
793b14731
|
201 |
srcprefs:3, /* 001: prefer temporary address |
7cbca67c0
|
202 203 204 |
* 010: prefer public address * 100: prefer care-of address */ |
cb1ce2ef3
|
205 206 |
dontfrag:1, autoflowlabel:1; |
e802af9ca
|
207 |
__u8 min_hopcount; |
41a1f8ea4
|
208 |
__u8 tclass; |
1397ed35f
|
209 |
__be32 rcv_flowinfo; |
1da177e4c
|
210 211 |
__u32 dst_cookie; |
5d299f3d3
|
212 |
__u32 rx_dst_cookie; |
1da177e4c
|
213 |
|
456b61bca
|
214 |
struct ipv6_mc_socklist __rcu *ipv6_mc_list; |
1da177e4c
|
215 |
struct ipv6_ac_socklist *ipv6_ac_list; |
18367681a
|
216 |
struct ipv6_fl_socklist __rcu *ipv6_fl_list; |
1da177e4c
|
217 218 219 |
struct ipv6_txoptions *opt; struct sk_buff *pktoptions; |
4b340ae20
|
220 |
struct sk_buff *rxpmtu; |
366e41d97
|
221 |
struct inet6_cork cork; |
1da177e4c
|
222 223 224 225 226 227 228 229 230 |
}; /* WARNING: don't change the layout of the members in {raw,udp,tcp}6_sock! */ struct raw6_sock { /* inet_sock has to be the first member of raw6_sock */ struct inet_sock inet; __u32 checksum; /* perform checksum */ __u32 offset; /* checksum offset */ struct icmp6_filter filter; |
d1db275dd
|
231 |
__u32 ip6mr_table; |
1da177e4c
|
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
/* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */ struct ipv6_pinfo inet6; }; struct udp6_sock { struct udp_sock udp; /* ipv6_pinfo has to be the last member of udp6_sock, see inet6_sk_generic */ struct ipv6_pinfo inet6; }; struct tcp6_sock { struct tcp_sock tcp; /* ipv6_pinfo has to be the last member of tcp6_sock, see inet6_sk_generic */ struct ipv6_pinfo inet6; }; |
b9750ce13
|
247 |
extern int inet6_sk_rebuild_header(struct sock *sk); |
48ee3569f
|
248 249 |
struct tcp6_timewait_sock { struct tcp_timewait_sock tcp6tw_tcp; |
48ee3569f
|
250 |
}; |
dfd56b8b3
|
251 |
#if IS_ENABLED(CONFIG_IPV6) |
1da177e4c
|
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) { return inet_sk(__sk)->pinet6; } static inline struct raw6_sock *raw6_sk(const struct sock *sk) { return (struct raw6_sock *)sk; } static inline void inet_sk_copy_descendant(struct sock *sk_to, const struct sock *sk_from) { int ancestor_size = sizeof(struct inet_sock); if (sk_from->sk_family == PF_INET6) ancestor_size += sizeof(struct ipv6_pinfo); __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); } |
9fe516ba3
|
272 273 |
#define __ipv6_only_sock(sk) (sk->sk_ipv6only) #define ipv6_only_sock(sk) (__ipv6_only_sock(sk)) |
4b261c75a
|
274 275 |
#define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \ inet6_sk(sk)->rxopt.bits.rxinfo) |
8feaf0c0a
|
276 |
|
efe4208f4
|
277 |
static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk) |
8feaf0c0a
|
278 |
{ |
efe4208f4
|
279 280 281 |
if (sk->sk_family == AF_INET6) return &sk->sk_v6_rcv_saddr; return NULL; |
8feaf0c0a
|
282 |
} |
463c84b97
|
283 |
static inline int inet_v6_ipv6only(const struct sock *sk) |
8feaf0c0a
|
284 |
{ |
9fe516ba3
|
285 286 |
/* ipv6only field is at same position for timewait and other sockets */ return ipv6_only_sock(sk); |
8feaf0c0a
|
287 |
} |
1da177e4c
|
288 289 290 |
#else #define __ipv6_only_sock(sk) 0 #define ipv6_only_sock(sk) 0 |
4b261c75a
|
291 |
#define ipv6_sk_rxinfo(sk) 0 |
1da177e4c
|
292 293 294 295 296 |
static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) { return NULL; } |
ca304b610
|
297 298 299 300 301 |
static inline struct inet6_request_sock * inet6_rsk(const struct request_sock *rsk) { return NULL; } |
1da177e4c
|
302 303 304 305 |
static inline struct raw6_sock *raw6_sk(const struct sock *sk) { return NULL; } |
0fa1a53e1
|
306 |
#define inet6_rcv_saddr(__sk) NULL |
8feaf0c0a
|
307 |
#define tcp_twsk_ipv6only(__sk) 0 |
463c84b97
|
308 |
#define inet_v6_ipv6only(__sk) 0 |
dfd56b8b3
|
309 |
#endif /* IS_ENABLED(CONFIG_IPV6) */ |
8feaf0c0a
|
310 |
#endif /* _IPV6_H */ |