Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1364 - genpatches-2.6/trunk/2.6.27
Date: Wed, 29 Oct 2008 15:59:13
Message-Id: E1KvDRv-000108-T5@stork.gentoo.org
1 Author: mpagano
2 Date: 2008-10-29 15:59:11 +0000 (Wed, 29 Oct 2008)
3 New Revision: 1364
4
5 Added:
6 genpatches-2.6/trunk/2.6.27/2000_tcp-option-ordering-restore.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.27/0000_README
9 Log:
10 Adding patch to restore ordering of TCP options for the sake of inter-operability
11
12 Modified: genpatches-2.6/trunk/2.6.27/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.27/0000_README 2008-10-28 00:43:27 UTC (rev 1363)
15 +++ genpatches-2.6/trunk/2.6.27/0000_README 2008-10-29 15:59:11 UTC (rev 1364)
16 @@ -55,6 +55,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 2.6.27.4
19
20 +Patch: 2000_tcp-option-ordering-restore.patch
21 +From: http://bugs.gentoo.org/show_bug.cgi?id=242634
22 +Desc: Restore ordering of TCP options for the sake of inter-operability
23 +
24 Patch: 4100_dm-bbr.patch
25 From: EVMS 2.5.2
26 Desc: Bad block relocation support for LiveCD users
27
28 Added: genpatches-2.6/trunk/2.6.27/2000_tcp-option-ordering-restore.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.27/2000_tcp-option-ordering-restore.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.27/2000_tcp-option-ordering-restore.patch 2008-10-29 15:59:11 UTC (rev 1364)
32 @@ -0,0 +1,81 @@
33 +From: Ilpo Järvinen <ilpo.jarvinen@××××××××.fi>
34 +Date: Thu, 23 Oct 2008 21:06:35 +0000 (-0700)
35 +Subject: tcp: Restore ordering of TCP options for the sake of inter-operability
36 +X-Git-Tag: v2.6.28-rc1~3^2
37 +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=fd6149d332973bafa50f03ddb0ea9513e67f4517
38 +
39 +tcp: Restore ordering of TCP options for the sake of inter-operability
40 +
41 +This is not our bug! Sadly some devices cannot cope with the change
42 +of TCP option ordering which was a result of the recent rewrite of
43 +the option code (not that there was some particular reason steming
44 +from the rewrite for the reordering) though any ordering of TCP
45 +options is perfectly legal. Thus we restore the original ordering
46 +to allow interoperability with/through such broken devices and add
47 +some warning about this trap. Since the reordering just happened
48 +without any particular reason, this change shouldn't cost us
49 +anything.
50 +
51 +There are already couple of known failure reports (within close
52 +proximity of the last release), so the problem might be more
53 +wide-spread than a single device. And other reports which may
54 +be due to the same problem though the symptoms were less obvious.
55 +Analysis of one of the case revealed (with very high probability)
56 +that sack capability cannot be negotiated as the first option
57 +(SYN never got a response).
58 +
59 +Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@××××××××.fi>
60 +Reported-by: Aldo Maggi <sentiniate@×××××××.it>
61 +Tested-by: Aldo Maggi <sentiniate@×××××××.it>
62 +Signed-off-by: David S. Miller <davem@×××××××××.net>
63 +---
64 +
65 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
66 +index de54f02..e4c5ac9 100644
67 +--- a/net/ipv4/tcp_output.c
68 ++++ b/net/ipv4/tcp_output.c
69 +@@ -362,6 +362,17 @@ struct tcp_out_options {
70 + __u32 tsval, tsecr; /* need to include OPTION_TS */
71 + };
72 +
73 ++/* Beware: Something in the Internet is very sensitive to the ordering of
74 ++ * TCP options, we learned this through the hard way, so be careful here.
75 ++ * Luckily we can at least blame others for their non-compliance but from
76 ++ * inter-operatibility perspective it seems that we're somewhat stuck with
77 ++ * the ordering which we have been using if we want to keep working with
78 ++ * those broken things (not that it currently hurts anybody as there isn't
79 ++ * particular reason why the ordering would need to be changed).
80 ++ *
81 ++ * At least SACK_PERM as the first option is known to lead to a disaster
82 ++ * (but it may well be that other scenarios fail similarly).
83 ++ */
84 + static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
85 + const struct tcp_out_options *opts,
86 + __u8 **md5_hash) {
87 +@@ -376,6 +387,12 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
88 + *md5_hash = NULL;
89 + }
90 +
91 ++ if (unlikely(opts->mss)) {
92 ++ *ptr++ = htonl((TCPOPT_MSS << 24) |
93 ++ (TCPOLEN_MSS << 16) |
94 ++ opts->mss);
95 ++ }
96 ++
97 + if (likely(OPTION_TS & opts->options)) {
98 + if (unlikely(OPTION_SACK_ADVERTISE & opts->options)) {
99 + *ptr++ = htonl((TCPOPT_SACK_PERM << 24) |
100 +@@ -392,12 +409,6 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
101 + *ptr++ = htonl(opts->tsecr);
102 + }
103 +
104 +- if (unlikely(opts->mss)) {
105 +- *ptr++ = htonl((TCPOPT_MSS << 24) |
106 +- (TCPOLEN_MSS << 16) |
107 +- opts->mss);
108 +- }
109 +-
110 + if (unlikely(OPTION_SACK_ADVERTISE & opts->options &&
111 + !(OPTION_TS & opts->options))) {
112 + *ptr++ = htonl((TCPOPT_NOP << 24) |
113 +