Commit 951fc9df authored by Ingo Molnar's avatar Ingo Molnar

[NET]: Do type checking in {udp,inet6,raw6,inet}_sk().

parent 12173d80
...@@ -159,7 +159,10 @@ struct inet_sock { ...@@ -159,7 +159,10 @@ struct inet_sock {
struct inet_opt inet; struct inet_opt inet;
}; };
#define inet_sk(__sk) (&((struct inet_sock *)__sk)->inet) static inline struct inet_opt * inet_sk(const struct sock *__sk)
{
return &((struct inet_sock *)__sk)->inet;
}
#endif #endif
......
...@@ -270,8 +270,15 @@ struct tcp6_sock { ...@@ -270,8 +270,15 @@ struct tcp6_sock {
struct ipv6_pinfo inet6; struct ipv6_pinfo inet6;
}; };
#define inet6_sk(__sk) ((struct raw6_sock *)__sk)->pinet6 static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
#define raw6_sk(__sk) (&((struct raw6_sock *)__sk)->raw6) {
return ((struct raw6_sock *)__sk)->pinet6;
}
static inline struct raw6_opt * raw6_sk(const struct sock *__sk)
{
return &((struct raw6_sock *)__sk)->raw6;
}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
......
...@@ -60,7 +60,10 @@ struct udp_sock { ...@@ -60,7 +60,10 @@ struct udp_sock {
struct udp_opt udp; struct udp_opt udp;
}; };
#define udp_sk(__sk) (&((struct udp_sock *)__sk)->udp) static inline struct udp_opt * udp_sk(const struct sock *__sk)
{
return &((struct udp_sock *)__sk)->udp;
}
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment