]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/net/inet_sock.h
net: add skb_to_full_sk() helper and use it in selinux_netlbl_skbuff_setsid()
[mirror_ubuntu-artful-kernel.git] / include / net / inet_sock.h
index 47eb67b08abdf28b185514cfc1a99685a8c8b8dd..2134e6d815bcb0611a2f65cd7b4da44cb7762b8c 100644 (file)
@@ -210,6 +210,18 @@ struct inet_sock {
 #define IP_CMSG_ORIGDSTADDR    BIT(6)
 #define IP_CMSG_CHECKSUM       BIT(7)
 
+/* SYNACK messages might be attached to request sockets.
+ * Some places want to reach the listener in this case.
+ */
+static inline struct sock *skb_to_full_sk(const struct sk_buff *skb)
+{
+       struct sock *sk = skb->sk;
+
+       if (sk && sk->sk_state == TCP_NEW_SYN_RECV)
+               sk = inet_reqsk(sk)->rsk_listener;
+       return sk;
+}
+
 static inline struct inet_sock *inet_sk(const struct sock *sk)
 {
        return (struct inet_sock *)sk;
@@ -245,7 +257,8 @@ static inline unsigned int __inet_ehashfn(const __be32 laddr,
 }
 
 struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
-                                     struct sock *sk_listener);
+                                     struct sock *sk_listener,
+                                     bool attach_listener);
 
 static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
 {