From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: eric.dumazet@gmail.com, Florian Westphal <fw@strlen.de>
Subject: [PATCH -next 1/3] net: add inet_sk_transparent() helper
Date: Mon, 21 Dec 2015 21:29:24 +0100 [thread overview]
Message-ID: <1450729766-14926-2-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1450729766-14926-1-git-send-email-fw@strlen.de>
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>
---
include/net/request_sock.h | 2 +-
include/net/tcp.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index a0dde04..f49759d 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 3077735b..f33fecf 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.
*/
--
2.4.10
next prev parent reply other threads:[~2015-12-21 20:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 20:29 [PATCH v2 -next 0/3] tcp: honour SO_BINDTODEVICE for TW_RST case too Florian Westphal
2015-12-21 20:29 ` Florian Westphal [this message]
2015-12-22 19:04 ` [PATCH -next 1/3] net: add inet_sk_transparent() helper Eric Dumazet
2015-12-22 21:46 ` Hannes Frederic Sowa
2015-12-21 20:29 ` [PATCH -next 2/3] tcp: send_reset: test for non-NULL sk first Florian Westphal
2015-12-22 19:05 ` Eric Dumazet
2015-12-22 21:46 ` Hannes Frederic Sowa
2015-12-21 20:29 ` [PATCH v2 -next 3/3] tcp: honour SO_BINDTODEVICE for TW_RST case too Florian Westphal
2015-12-22 19:06 ` Eric Dumazet
2015-12-22 21:47 ` Hannes Frederic Sowa
2015-12-22 22:03 ` [PATCH v2 -next 0/3] " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450729766-14926-2-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).