Allow tcp_parse_options to consult dst entry
We need tcp_parse_options to be aware of dst_entry to take into account per dst_entry TCP options settings Signed-off-by: Gilad Ben-Yossef <gilad@codefidence.com> Sigend-off-by: Ori Finkelman <ori@comsleep.com> Sigend-off-by: Yony Amit <yony@comsleep.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Esse commit está contido em:

commit de
David S. Miller

pai
f55017a93f
commit
022c3f7d82
@@ -184,13 +184,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESRECV);
|
||||
|
||||
/* check for timestamp cookie support */
|
||||
memset(&tcp_opt, 0, sizeof(tcp_opt));
|
||||
tcp_parse_options(skb, &tcp_opt, 0);
|
||||
|
||||
if (tcp_opt.saw_tstamp)
|
||||
cookie_check_timestamp(&tcp_opt);
|
||||
|
||||
ret = NULL;
|
||||
req = inet6_reqsk_alloc(&tcp6_request_sock_ops);
|
||||
if (!req)
|
||||
@@ -224,12 +217,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
|
||||
req->expires = 0UL;
|
||||
req->retrans = 0;
|
||||
ireq->ecn_ok = 0;
|
||||
ireq->snd_wscale = tcp_opt.snd_wscale;
|
||||
ireq->rcv_wscale = tcp_opt.rcv_wscale;
|
||||
ireq->sack_ok = tcp_opt.sack_ok;
|
||||
ireq->wscale_ok = tcp_opt.wscale_ok;
|
||||
ireq->tstamp_ok = tcp_opt.saw_tstamp;
|
||||
req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;
|
||||
treq->rcv_isn = ntohl(th->seq) - 1;
|
||||
treq->snt_isn = cookie;
|
||||
|
||||
@@ -265,6 +252,21 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* check for timestamp cookie support */
|
||||
memset(&tcp_opt, 0, sizeof(tcp_opt));
|
||||
tcp_parse_options(skb, &tcp_opt, 0, dst);
|
||||
|
||||
if (tcp_opt.saw_tstamp)
|
||||
cookie_check_timestamp(&tcp_opt);
|
||||
|
||||
req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;
|
||||
|
||||
ireq->snd_wscale = tcp_opt.snd_wscale;
|
||||
ireq->rcv_wscale = tcp_opt.rcv_wscale;
|
||||
ireq->sack_ok = tcp_opt.sack_ok;
|
||||
ireq->wscale_ok = tcp_opt.wscale_ok;
|
||||
ireq->tstamp_ok = tcp_opt.saw_tstamp;
|
||||
|
||||
req->window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);
|
||||
tcp_select_initial_window(tcp_full_space(sk), req->mss,
|
||||
&req->rcv_wnd, &req->window_clamp,
|
||||
|
@@ -1167,6 +1167,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
||||
struct tcp_sock *tp = tcp_sk(sk);
|
||||
struct request_sock *req = NULL;
|
||||
__u32 isn = TCP_SKB_CB(skb)->when;
|
||||
struct dst_entry *dst = __sk_dst_get(sk);
|
||||
#ifdef CONFIG_SYN_COOKIES
|
||||
int want_cookie = 0;
|
||||
#else
|
||||
@@ -1205,7 +1206,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
||||
tmp_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
|
||||
tmp_opt.user_mss = tp->rx_opt.user_mss;
|
||||
|
||||
tcp_parse_options(skb, &tmp_opt, 0);
|
||||
tcp_parse_options(skb, &tmp_opt, 0, dst);
|
||||
|
||||
if (want_cookie && !tmp_opt.saw_tstamp)
|
||||
tcp_clear_options(&tmp_opt);
|
||||
|
Referência em uma nova issue
Block a user