aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ipv6.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ipv6.h')
-rw-r--r--include/linux/ipv6.h83
1 files changed, 63 insertions, 20 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0b922785d98..9c8f4c9ed429 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -171,12 +171,13 @@ enum {
171}; 171};
172 172
173#ifdef __KERNEL__ 173#ifdef __KERNEL__
174#include <linux/in6.h> /* struct sockaddr_in6 */
175#include <linux/icmpv6.h> 174#include <linux/icmpv6.h>
176#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
177#include <linux/tcp.h> 175#include <linux/tcp.h>
178#include <linux/udp.h> 176#include <linux/udp.h>
179 177
178#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
179#include <net/inet_sock.h>
180
180/* 181/*
181 This structure contains results of exthdrs parsing 182 This structure contains results of exthdrs parsing
182 as offsets from skb->nh. 183 as offsets from skb->nh.
@@ -190,6 +191,10 @@ struct inet6_skb_parm {
190 __u16 srcrt; 191 __u16 srcrt;
191 __u16 dst1; 192 __u16 dst1;
192 __u16 lastopt; 193 __u16 lastopt;
194 __u32 nhoff;
195 __u16 flags;
196
197#define IP6SKB_XFRM_TRANSFORMED 1
193}; 198};
194 199
195#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 200#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -199,18 +204,17 @@ static inline int inet6_iif(const struct sk_buff *skb)
199 return IP6CB(skb)->iif; 204 return IP6CB(skb)->iif;
200} 205}
201 206
202struct tcp6_request_sock { 207struct inet6_request_sock {
203 struct tcp_request_sock req;
204 struct in6_addr loc_addr; 208 struct in6_addr loc_addr;
205 struct in6_addr rmt_addr; 209 struct in6_addr rmt_addr;
206 struct sk_buff *pktopts; 210 struct sk_buff *pktopts;
207 int iif; 211 int iif;
208}; 212};
209 213
210static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) 214struct tcp6_request_sock {
211{ 215 struct tcp_request_sock tcp6rsk_tcp;
212 return (struct tcp6_request_sock *)sk; 216 struct inet6_request_sock tcp6rsk_inet6;
213} 217};
214 218
215/** 219/**
216 * struct ipv6_pinfo - ipv6 private area 220 * struct ipv6_pinfo - ipv6 private area
@@ -298,12 +302,36 @@ struct tcp6_sock {
298 struct ipv6_pinfo inet6; 302 struct ipv6_pinfo inet6;
299}; 303};
300 304
305extern int inet6_sk_rebuild_header(struct sock *sk);
306
301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 307#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
302static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 308static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
303{ 309{
304 return inet_sk(__sk)->pinet6; 310 return inet_sk(__sk)->pinet6;
305} 311}
306 312
313static inline struct inet6_request_sock *
314 inet6_rsk(const struct request_sock *rsk)
315{
316 return (struct inet6_request_sock *)(((u8 *)rsk) +
317 inet_rsk(rsk)->inet6_rsk_offset);
318}
319
320static inline u32 inet6_rsk_offset(struct request_sock *rsk)
321{
322 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
323}
324
325static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
326{
327 struct request_sock *req = reqsk_alloc(ops);
328
329 if (req != NULL)
330 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
331
332 return req;
333}
334
307static inline struct raw6_sock *raw6_sk(const struct sock *sk) 335static inline struct raw6_sock *raw6_sk(const struct sock *sk)
308{ 336{
309 return (struct raw6_sock *)sk; 337 return (struct raw6_sock *)sk;
@@ -323,28 +351,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
323#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 351#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
324#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 352#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
325 353
326#include <linux/tcp.h> 354struct inet6_timewait_sock {
355 struct in6_addr tw_v6_daddr;
356 struct in6_addr tw_v6_rcv_saddr;
357};
327 358
328struct tcp6_timewait_sock { 359struct tcp6_timewait_sock {
329 struct tcp_timewait_sock tw_v6_sk; 360 struct tcp_timewait_sock tcp6tw_tcp;
330 struct in6_addr tw_v6_daddr; 361 struct inet6_timewait_sock tcp6tw_inet6;
331 struct in6_addr tw_v6_rcv_saddr;
332}; 362};
333 363
334static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) 364static inline u16 inet6_tw_offset(const struct proto *prot)
335{ 365{
336 return (struct tcp6_timewait_sock *)sk; 366 return prot->twsk_prot->twsk_obj_size -
367 sizeof(struct inet6_timewait_sock);
337} 368}
338 369
339static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) 370static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
371{
372 return (struct inet6_timewait_sock *)(((u8 *)sk) +
373 inet_twsk(sk)->tw_ipv6_offset);
374}
375
376static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
340{ 377{
341 return likely(sk->sk_state != TCP_TIME_WAIT) ? 378 return likely(sk->sk_state != TCP_TIME_WAIT) ?
342 &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; 379 &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr;
343} 380}
344 381
345static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) 382static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
346{ 383{
347 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; 384 return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL;
348} 385}
349 386
350static inline int inet_v6_ipv6only(const struct sock *sk) 387static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -361,13 +398,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
361 return NULL; 398 return NULL;
362} 399}
363 400
401static inline struct inet6_request_sock *
402 inet6_rsk(const struct request_sock *rsk)
403{
404 return NULL;
405}
406
364static inline struct raw6_sock *raw6_sk(const struct sock *sk) 407static inline struct raw6_sock *raw6_sk(const struct sock *sk)
365{ 408{
366 return NULL; 409 return NULL;
367} 410}
368 411
369#define __tcp_v6_rcv_saddr(__sk) NULL 412#define __inet6_rcv_saddr(__sk) NULL
370#define tcp_v6_rcv_saddr(__sk) NULL 413#define inet6_rcv_saddr(__sk) NULL
371#define tcp_twsk_ipv6only(__sk) 0 414#define tcp_twsk_ipv6only(__sk) 0
372#define inet_v6_ipv6only(__sk) 0 415#define inet_v6_ipv6only(__sk) 0
373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 416#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */