diff options
-rw-r--r-- | include/net/tcp.h | 23 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 |
3 files changed, 18 insertions, 9 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index c826ed7b007b..92faa6a7ea97 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -367,13 +367,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk, | |||
367 | #define TCP_ECN_DEMAND_CWR 4 | 367 | #define TCP_ECN_DEMAND_CWR 4 |
368 | #define TCP_ECN_SEEN 8 | 368 | #define TCP_ECN_SEEN 8 |
369 | 369 | ||
370 | static __inline__ void | ||
371 | TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th) | ||
372 | { | ||
373 | if (sysctl_tcp_ecn && th->ece && th->cwr) | ||
374 | inet_rsk(req)->ecn_ok = 1; | ||
375 | } | ||
376 | |||
377 | enum tcp_tw_status { | 370 | enum tcp_tw_status { |
378 | TCP_TW_SUCCESS = 0, | 371 | TCP_TW_SUCCESS = 0, |
379 | TCP_TW_RST = 1, | 372 | TCP_TW_RST = 1, |
@@ -671,6 +664,22 @@ struct tcp_skb_cb { | |||
671 | 664 | ||
672 | #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) | 665 | #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) |
673 | 666 | ||
667 | /* RFC3168 : 6.1.1 SYN packets must not have ECT/ECN bits set | ||
668 | * | ||
669 | * If we receive a SYN packet with these bits set, it means a network is | ||
670 | * playing bad games with TOS bits. In order to avoid possible false congestion | ||
671 | * notifications, we disable TCP ECN negociation. | ||
672 | */ | ||
673 | static inline void | ||
674 | TCP_ECN_create_request(struct request_sock *req, const struct sk_buff *skb) | ||
675 | { | ||
676 | const struct tcphdr *th = tcp_hdr(skb); | ||
677 | |||
678 | if (sysctl_tcp_ecn && th->ece && th->cwr && | ||
679 | INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield)) | ||
680 | inet_rsk(req)->ecn_ok = 1; | ||
681 | } | ||
682 | |||
674 | /* Due to TSO, an SKB can be composed of multiple actual | 683 | /* Due to TSO, an SKB can be composed of multiple actual |
675 | * packets. To keep these tracked properly, we use this. | 684 | * packets. To keep these tracked properly, we use this. |
676 | */ | 685 | */ |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index cf97e9821d76..4ff5e1f70d16 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1368,7 +1368,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1368 | goto drop_and_free; | 1368 | goto drop_and_free; |
1369 | 1369 | ||
1370 | if (!want_cookie || tmp_opt.tstamp_ok) | 1370 | if (!want_cookie || tmp_opt.tstamp_ok) |
1371 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1371 | TCP_ECN_create_request(req, skb); |
1372 | 1372 | ||
1373 | if (want_cookie) { | 1373 | if (want_cookie) { |
1374 | isn = cookie_v4_init_sequence(sk, skb, &req->mss); | 1374 | isn = cookie_v4_init_sequence(sk, skb, &req->mss); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 57b210969834..078d039e8fd2 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1140,7 +1140,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1140 | treq->rmt_addr = ipv6_hdr(skb)->saddr; | 1140 | treq->rmt_addr = ipv6_hdr(skb)->saddr; |
1141 | treq->loc_addr = ipv6_hdr(skb)->daddr; | 1141 | treq->loc_addr = ipv6_hdr(skb)->daddr; |
1142 | if (!want_cookie || tmp_opt.tstamp_ok) | 1142 | if (!want_cookie || tmp_opt.tstamp_ok) |
1143 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1143 | TCP_ECN_create_request(req, skb); |
1144 | 1144 | ||
1145 | treq->iif = sk->sk_bound_dev_if; | 1145 | treq->iif = sk->sk_bound_dev_if; |
1146 | 1146 | ||