ipv4: implement support for NOPREFIXROUTE ifa flag for ipv4 address
[deliverable/linux.git] / net / ipv4 / syncookies.c
index d70b1f603692554664c478ebb597ba73958ebd9a..4c0892badb8b1eb47881b8c24976a872f3c61c6c 100644 (file)
@@ -192,15 +192,11 @@ u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
 }
 EXPORT_SYMBOL_GPL(__cookie_v4_init_sequence);
 
-__u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb,
-                             __u16 *mssp)
+__u32 cookie_v4_init_sequence(const struct sk_buff *skb, __u16 *mssp)
 {
        const struct iphdr *iph = ip_hdr(skb);
        const struct tcphdr *th = tcp_hdr(skb);
 
-       tcp_synq_overflow(sk);
-       NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT);
-
        return __cookie_v4_init_sequence(iph, th, mssp);
 }
 
@@ -229,6 +225,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
        child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst);
        if (child) {
                atomic_set(&req->rsk_refcnt, 1);
+               sock_rps_save_rxhash(child, skb);
                inet_csk_reqsk_queue_add(sk, req, child);
        } else {
                reqsk_free(req);
@@ -288,6 +285,10 @@ bool cookie_ecn_ok(const struct tcp_options_received *tcp_opt,
 }
 EXPORT_SYMBOL(cookie_ecn_ok);
 
+/* On input, sk is a listener.
+ * Output is listener if incoming packet would not create a child
+ *           NULL if memory could not be allocated.
+ */
 struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
 {
        struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
@@ -326,7 +327,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
                goto out;
 
        ret = NULL;
-       req = inet_reqsk_alloc(&tcp_request_sock_ops, sk); /* for safety */
+       req = inet_reqsk_alloc(&tcp_request_sock_ops, sk, false); /* for safety */
        if (!req)
                goto out;
 
@@ -345,7 +346,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
        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->snt_synack        = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsecr : 0;
+       treq->snt_synack.v64    = 0;
        treq->tfo_listener      = false;
 
        ireq->ir_iif = sk->sk_bound_dev_if;
@@ -381,10 +382,10 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
        }
 
        /* Try to redo what tcp_v4_send_synack did. */
-       req->window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW);
+       req->rsk_window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW);
 
        tcp_select_initial_window(tcp_full_space(sk), req->mss,
-                                 &req->rcv_wnd, &req->window_clamp,
+                                 &req->rsk_rcv_wnd, &req->rsk_window_clamp,
                                  ireq->wscale_ok, &rcv_wscale,
                                  dst_metric(&rt->dst, RTAX_INITRWND));
 
This page took 0.034595 seconds and 5 git commands to generate.