summaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorFlorian Westphal2015-12-21 21:29:24 +0100
committerDavid S. Miller2015-12-22 23:03:05 +0100
commitb1f0a0e99c58fbd7ea053ca36ba623718272b618 (patch)
tree17c6d02cc97346088f6c5675234b69a485335a36 /include/net/tcp.h
parentmlxsw: core: Use devm_kzalloc to allocate mlxsw_hwmon structure (diff)
downloadkernel-qcow2-linux-b1f0a0e99c58fbd7ea053ca36ba623718272b618.tar.gz
kernel-qcow2-linux-b1f0a0e99c58fbd7ea053ca36ba623718272b618.tar.xz
kernel-qcow2-linux-b1f0a0e99c58fbd7ea053ca36ba623718272b618.zip
net: add inet_sk_transparent() helper
Avoids cluttering tcp_v4_send_reset when followup patch extends it to deal with timewait sockets. Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Eric Dumazet <edumazet@google.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h12
1 files changed, 12 insertions, 0 deletions
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.
*/