aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-05-04 01:14:02 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-04 12:05:27 -0400
commitbd14b1b2e29bd6812597f896dde06eaf7c6d2f24 (patch)
treebd641279d50993e32da8f8d72672bce4e54820bd /include
parentf45ebf3a6be9da051f078b30e7309b6788932189 (diff)
tcp: be more strict before accepting ECN negociation
It appears some networks play bad games with the two bits reserved for ECN. This can trigger false congestion notifications and very slow transferts. Since RFC 3168 (6.1.1) forbids SYN packets to carry CT bits, we can disable TCP ECN negociation if it happens we receive mangled CT bits in the SYN packet. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Perry Lorier <perryl@google.com> Cc: Matt Mathis <mattmathis@google.com> Cc: Yuchung Cheng <ycheng@google.com> Cc: Neal Cardwell <ncardwell@google.com> Cc: Wilmer van der Gaast <wilmer@google.com> Cc: Ankur Jain <jankur@google.com> Cc: Tom Herbert <therbert@google.com> Cc: Dave Täht <dave.taht@bufferbloat.net> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/tcp.h23
1 files changed, 16 insertions, 7 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
370static __inline__ void
371TCP_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
377enum tcp_tw_status { 370enum 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 */
673static inline void
674TCP_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 */