aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 4ea8ec5c7bb4..99ee707f0ef4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3724,7 +3724,8 @@ static void tcp_parse_fastopen_option(int len, const unsigned char *cookie,
3724 * But, this can also be called on packets in the established flow when 3724 * But, this can also be called on packets in the established flow when
3725 * the fast version below fails. 3725 * the fast version below fails.
3726 */ 3726 */
3727void tcp_parse_options(const struct sk_buff *skb, 3727void tcp_parse_options(const struct net *net,
3728 const struct sk_buff *skb,
3728 struct tcp_options_received *opt_rx, int estab, 3729 struct tcp_options_received *opt_rx, int estab,
3729 struct tcp_fastopen_cookie *foc) 3730 struct tcp_fastopen_cookie *foc)
3730{ 3731{
@@ -3858,7 +3859,8 @@ static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr
3858/* Fast parse options. This hopes to only see timestamps. 3859/* Fast parse options. This hopes to only see timestamps.
3859 * If it is wrong it falls back on tcp_parse_options(). 3860 * If it is wrong it falls back on tcp_parse_options().
3860 */ 3861 */
3861static bool tcp_fast_parse_options(const struct sk_buff *skb, 3862static bool tcp_fast_parse_options(const struct net *net,
3863 const struct sk_buff *skb,
3862 const struct tcphdr *th, struct tcp_sock *tp) 3864 const struct tcphdr *th, struct tcp_sock *tp)
3863{ 3865{
3864 /* In the spirit of fast parsing, compare doff directly to constant 3866 /* In the spirit of fast parsing, compare doff directly to constant
@@ -3873,7 +3875,7 @@ static bool tcp_fast_parse_options(const struct sk_buff *skb,
3873 return true; 3875 return true;
3874 } 3876 }
3875 3877
3876 tcp_parse_options(skb, &tp->rx_opt, 1, NULL); 3878 tcp_parse_options(net, skb, &tp->rx_opt, 1, NULL);
3877 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) 3879 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
3878 tp->rx_opt.rcv_tsecr -= tp->tsoffset; 3880 tp->rx_opt.rcv_tsecr -= tp->tsoffset;
3879 3881
@@ -5234,7 +5236,8 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
5234 bool rst_seq_match = false; 5236 bool rst_seq_match = false;
5235 5237
5236 /* RFC1323: H1. Apply PAWS check first. */ 5238 /* RFC1323: H1. Apply PAWS check first. */
5237 if (tcp_fast_parse_options(skb, th, tp) && tp->rx_opt.saw_tstamp && 5239 if (tcp_fast_parse_options(sock_net(sk), skb, th, tp) &&
5240 tp->rx_opt.saw_tstamp &&
5238 tcp_paws_discard(sk, skb)) { 5241 tcp_paws_discard(sk, skb)) {
5239 if (!th->rst) { 5242 if (!th->rst) {
5240 NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED); 5243 NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
@@ -5605,7 +5608,7 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
5605 /* Get original SYNACK MSS value if user MSS sets mss_clamp */ 5608 /* Get original SYNACK MSS value if user MSS sets mss_clamp */
5606 tcp_clear_options(&opt); 5609 tcp_clear_options(&opt);
5607 opt.user_mss = opt.mss_clamp = 0; 5610 opt.user_mss = opt.mss_clamp = 0;
5608 tcp_parse_options(synack, &opt, 0, NULL); 5611 tcp_parse_options(sock_net(sk), synack, &opt, 0, NULL);
5609 mss = opt.mss_clamp; 5612 mss = opt.mss_clamp;
5610 } 5613 }
5611 5614
@@ -5659,7 +5662,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
5659 int saved_clamp = tp->rx_opt.mss_clamp; 5662 int saved_clamp = tp->rx_opt.mss_clamp;
5660 bool fastopen_fail; 5663 bool fastopen_fail;
5661 5664
5662 tcp_parse_options(skb, &tp->rx_opt, 0, &foc); 5665 tcp_parse_options(sock_net(sk), skb, &tp->rx_opt, 0, &foc);
5663 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) 5666 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
5664 tp->rx_opt.rcv_tsecr -= tp->tsoffset; 5667 tp->rx_opt.rcv_tsecr -= tp->tsoffset;
5665 5668
@@ -6332,7 +6335,8 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
6332 tcp_clear_options(&tmp_opt); 6335 tcp_clear_options(&tmp_opt);
6333 tmp_opt.mss_clamp = af_ops->mss_clamp; 6336 tmp_opt.mss_clamp = af_ops->mss_clamp;
6334 tmp_opt.user_mss = tp->rx_opt.user_mss; 6337 tmp_opt.user_mss = tp->rx_opt.user_mss;
6335 tcp_parse_options(skb, &tmp_opt, 0, want_cookie ? NULL : &foc); 6338 tcp_parse_options(sock_net(sk), skb, &tmp_opt, 0,
6339 want_cookie ? NULL : &foc);
6336 6340
6337 if (want_cookie && !tmp_opt.saw_tstamp) 6341 if (want_cookie && !tmp_opt.saw_tstamp)
6338 tcp_clear_options(&tmp_opt); 6342 tcp_clear_options(&tmp_opt);