summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-12-23 01:03:06 +0300
committerDavid S. Miller <davem@davemloft.net>2015-12-23 01:03:06 +0300
commit83a76006e06213160c4bb1e1a157e7707c504af6 (patch)
treeddc7c941b0bbfa742645f609d7d3a46e55509f54 /include
parentf4cee3af0dedf3270e6d615d772e3fbfa3200769 (diff)
parent271c3b9b7bdae09c7da467ac1ae96e3298754977 (diff)
downloadlinux-83a76006e06213160c4bb1e1a157e7707c504af6.tar.xz
Merge branch 'bindtodevice_tw_rst'
Florian Westphal says: ==================== tcp: honour SO_BINDTODEVICE for TW_RST case too This is V2, this time as a small series since I followed Erics advice to split this into smaller chunks, I hope this makes it easier to review. First patch adds inet_sk_transparent helper. Second patch contains an if/else swap that I split from the original TW_RST v1 one. Third patch is the actual change without the superfluous sock_net change. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/tcp.h12
2 files changed, 13 insertions, 1 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index a0dde04eb178..f49759decb28 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -68,7 +68,7 @@ struct request_sock {
u32 peer_secid;
};
-static inline struct request_sock *inet_reqsk(struct sock *sk)
+static inline struct request_sock *inet_reqsk(const struct sock *sk)
{
return (struct request_sock *)sk;
}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 3077735b348d..f33fecf4e282 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1620,6 +1620,18 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
tcp_sk(sk)->highest_sack = new;
}
+/* This helper checks if socket has IP_TRANSPARENT set */
+static inline bool inet_sk_transparent(const struct sock *sk)
+{
+ switch (sk->sk_state) {
+ case TCP_TIME_WAIT:
+ return inet_twsk(sk)->tw_transparent;
+ case TCP_NEW_SYN_RECV:
+ return inet_rsk(inet_reqsk(sk))->no_srccheck;
+ }
+ return inet_sk(sk)->transparent;
+}
+
/* Determines whether this is a thin stream (which may suffer from
* increased latency). Used to trigger latency-reducing mechanisms.
*/