Merge tag 'iommu-config-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / net / ipv6 / syncookies.c
index 2f25cb6347ca556a8c7418e327bbff2a715c1e6a..7337fc7947e2eba2c5e6eaccbc9cfd660d3a0ccd 100644 (file)
@@ -166,13 +166,15 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        int mss;
        struct dst_entry *dst;
        __u8 rcv_wscale;
-       bool ecn_ok = false;
 
        if (!sysctl_tcp_syncookies || !th->ack || th->rst)
                goto out;
 
-       if (tcp_synq_no_recent_overflow(sk) ||
-               (mss = __cookie_v6_check(ipv6_hdr(skb), th, cookie)) == 0) {
+       if (tcp_synq_no_recent_overflow(sk))
+               goto out;
+
+       mss = __cookie_v6_check(ipv6_hdr(skb), th, cookie);
+       if (mss == 0) {
                NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESFAILED);
                goto out;
        }
@@ -183,7 +185,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        memset(&tcp_opt, 0, sizeof(tcp_opt));
        tcp_parse_options(skb, &tcp_opt, 0, NULL);
 
-       if (!cookie_check_timestamp(&tcp_opt, sock_net(sk), &ecn_ok))
+       if (!cookie_timestamp_decode(&tcp_opt))
                goto out;
 
        ret = NULL;
@@ -220,7 +222,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
 
        req->expires = 0UL;
        req->num_retrans = 0;
-       ireq->ecn_ok            = ecn_ok;
        ireq->snd_wscale        = tcp_opt.snd_wscale;
        ireq->sack_ok           = tcp_opt.sack_ok;
        ireq->wscale_ok         = tcp_opt.wscale_ok;
@@ -261,6 +262,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
                                  dst_metric(dst, RTAX_INITRWND));
 
        ireq->rcv_wscale = rcv_wscale;
+       ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), dst);
 
        ret = get_cookie_sock(sk, skb, req, dst);
 out:
@@ -269,4 +271,3 @@ out_free:
        reqsk_free(req);
        return NULL;
 }
-