aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r--include/net/inet_sock.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 47eb67b08abd..2134e6d815bc 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -210,6 +210,18 @@ struct inet_sock {
210#define IP_CMSG_ORIGDSTADDR BIT(6) 210#define IP_CMSG_ORIGDSTADDR BIT(6)
211#define IP_CMSG_CHECKSUM BIT(7) 211#define IP_CMSG_CHECKSUM BIT(7)
212 212
213/* SYNACK messages might be attached to request sockets.
214 * Some places want to reach the listener in this case.
215 */
216static inline struct sock *skb_to_full_sk(const struct sk_buff *skb)
217{
218 struct sock *sk = skb->sk;
219
220 if (sk && sk->sk_state == TCP_NEW_SYN_RECV)
221 sk = inet_reqsk(sk)->rsk_listener;
222 return sk;
223}
224
213static inline struct inet_sock *inet_sk(const struct sock *sk) 225static inline struct inet_sock *inet_sk(const struct sock *sk)
214{ 226{
215 return (struct inet_sock *)sk; 227 return (struct inet_sock *)sk;
@@ -245,7 +257,8 @@ static inline unsigned int __inet_ehashfn(const __be32 laddr,
245} 257}
246 258
247struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, 259struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
248 struct sock *sk_listener); 260 struct sock *sk_listener,
261 bool attach_listener);
249 262
250static inline __u8 inet_sk_flowi_flags(const struct sock *sk) 263static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
251{ 264{