aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c2
-rw-r--r--include/net/tcp.h2
-rw-r--r--net/ipv4/syncookies.c2
-rw-r--r--net/ipv4/tcp_input.c18
-rw-r--r--net/ipv4/tcp_minisocks.c4
-rw-r--r--net/ipv6/syncookies.c2
6 files changed, 17 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index b0ae4f0c8aa7..2f1136bf7b1f 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -3756,7 +3756,7 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos)
3756 */ 3756 */
3757 memset(&tmp_opt, 0, sizeof(tmp_opt)); 3757 memset(&tmp_opt, 0, sizeof(tmp_opt));
3758 tcp_clear_options(&tmp_opt); 3758 tcp_clear_options(&tmp_opt);
3759 tcp_parse_options(skb, &tmp_opt, 0, NULL); 3759 tcp_parse_options(&init_net, skb, &tmp_opt, 0, NULL);
3760 3760
3761 req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req)); 3761 req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req));
3762 memset(req, 0, sizeof(*req)); 3762 memset(req, 0, sizeof(*req));
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 28b577a35786..0b0cfeefa05b 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -427,7 +427,7 @@ void tcp_set_keepalive(struct sock *sk, int val);
427void tcp_syn_ack_timeout(const struct request_sock *req); 427void tcp_syn_ack_timeout(const struct request_sock *req);
428int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, 428int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
429 int flags, int *addr_len); 429 int flags, int *addr_len);
430void tcp_parse_options(const struct sk_buff *skb, 430void tcp_parse_options(const struct net *net, const struct sk_buff *skb,
431 struct tcp_options_received *opt_rx, 431 struct tcp_options_received *opt_rx,
432 int estab, struct tcp_fastopen_cookie *foc); 432 int estab, struct tcp_fastopen_cookie *foc);
433const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); 433const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 6426250a58ea..6a32cb381877 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -312,7 +312,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
312 312
313 /* check for timestamp cookie support */ 313 /* check for timestamp cookie support */
314 memset(&tcp_opt, 0, sizeof(tcp_opt)); 314 memset(&tcp_opt, 0, sizeof(tcp_opt));
315 tcp_parse_options(skb, &tcp_opt, 0, NULL); 315 tcp_parse_options(sock_net(sk), skb, &tcp_opt, 0, NULL);
316 316
317 if (tcp_opt.saw_tstamp && tcp_opt.rcv_tsecr) { 317 if (tcp_opt.saw_tstamp && tcp_opt.rcv_tsecr) {
318 tsoff = secure_tcp_ts_off(ip_hdr(skb)->daddr, ip_hdr(skb)->saddr); 318 tsoff = secure_tcp_ts_off(ip_hdr(skb)->daddr, ip_hdr(skb)->saddr);
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);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index d0642df73044..d30ee31e94eb 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -98,7 +98,7 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
98 98
99 tmp_opt.saw_tstamp = 0; 99 tmp_opt.saw_tstamp = 0;
100 if (th->doff > (sizeof(*th) >> 2) && tcptw->tw_ts_recent_stamp) { 100 if (th->doff > (sizeof(*th) >> 2) && tcptw->tw_ts_recent_stamp) {
101 tcp_parse_options(skb, &tmp_opt, 0, NULL); 101 tcp_parse_options(twsk_net(tw), skb, &tmp_opt, 0, NULL);
102 102
103 if (tmp_opt.saw_tstamp) { 103 if (tmp_opt.saw_tstamp) {
104 if (tmp_opt.rcv_tsecr) 104 if (tmp_opt.rcv_tsecr)
@@ -559,7 +559,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
559 559
560 tmp_opt.saw_tstamp = 0; 560 tmp_opt.saw_tstamp = 0;
561 if (th->doff > (sizeof(struct tcphdr)>>2)) { 561 if (th->doff > (sizeof(struct tcphdr)>>2)) {
562 tcp_parse_options(skb, &tmp_opt, 0, NULL); 562 tcp_parse_options(sock_net(sk), skb, &tmp_opt, 0, NULL);
563 563
564 if (tmp_opt.saw_tstamp) { 564 if (tmp_opt.saw_tstamp) {
565 tmp_opt.ts_recent = req->ts_recent; 565 tmp_opt.ts_recent = req->ts_recent;
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 971823359f5b..4c0a047ec230 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -162,7 +162,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
162 162
163 /* check for timestamp cookie support */ 163 /* check for timestamp cookie support */
164 memset(&tcp_opt, 0, sizeof(tcp_opt)); 164 memset(&tcp_opt, 0, sizeof(tcp_opt));
165 tcp_parse_options(skb, &tcp_opt, 0, NULL); 165 tcp_parse_options(sock_net(sk), skb, &tcp_opt, 0, NULL);
166 166
167 if (tcp_opt.saw_tstamp && tcp_opt.rcv_tsecr) { 167 if (tcp_opt.saw_tstamp && tcp_opt.rcv_tsecr) {
168 tsoff = secure_tcpv6_ts_off(ipv6_hdr(skb)->daddr.s6_addr32, 168 tsoff = secure_tcpv6_ts_off(ipv6_hdr(skb)->daddr.s6_addr32,