X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=include%2Flinux%2Fipv6.h;h=939942384b78815251c9e056ce7826b2d99887bf;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=d7d1673880d5a8d9f1709cf69897ed8c61a365a2;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index d7d167388..939942384 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -247,54 +247,67 @@ struct ipv6_pinfo { } cork; }; -struct raw6_opt { +/* 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; -}; - -/* WARNING: don't change the layout of the members in {raw,udp,tcp}6_sock! */ -struct raw6_sock { - struct sock sk; - struct ipv6_pinfo *pinet6; - struct inet_opt inet; - struct raw6_opt raw6; - struct ipv6_pinfo inet6; + /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */ + struct ipv6_pinfo inet6; }; struct udp6_sock { - struct sock sk; - struct ipv6_pinfo *pinet6; - struct inet_opt inet; - struct udp_opt udp; + 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 sock sk; - struct ipv6_pinfo *pinet6; - struct inet_opt inet; - struct tcp_opt tcp; + struct tcp_sock tcp; + /* ipv6_pinfo has to be the last member of tcp6_sock, see inet6_sk_generic */ struct ipv6_pinfo inet6; }; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) { - return ((struct raw6_sock *)__sk)->pinet6; + return inet_sk(__sk)->pinet6; } -static inline struct raw6_opt * raw6_sk(const struct sock *__sk) +static inline struct raw6_sock *raw6_sk(const struct sock *sk) { - return &((struct raw6_sock *)__sk)->raw6; + 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); } -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) #else #define __ipv6_only_sock(sk) 0 #define ipv6_only_sock(sk) 0 + +static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) +{ + return NULL; +} + +static inline struct raw6_sock *raw6_sk(const struct sock *sk) +{ + return NULL; +} + #endif #endif