From: Octavian Purdila <opurdila@ixiacom.com>
To: netdev@vger.kernel.org
Subject: [PATCH] [net-next] tcp: avoid sending zero TSval
Date: Mon, 31 Aug 2009 20:44:56 +0300 [thread overview]
Message-ID: <200908312044.56235.opurdila@ixiacom.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
Per RFC1323, zero TSecr is considered invalid. Thus we must avoid when
possible sending a zero TSval.
Currently, we use the least significant 32 bits of jiffies to fill in
TSval. But that can wrap around to zero (in 5 minutes after reboot,
and every 49 days after that in the worst case).
This patch approximate a wrap-around zero TSval to 1. This is better
then emitting a value which will be ignored.
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
net/ipv4/tcp_output.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
[-- Attachment #2: 71e6d2ae2ae12cfaf0d7cb8e010fd0c7f520874b.diff --]
[-- Type: text/x-patch, Size: 598 bytes --]
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 4e00442..607d675 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -415,7 +415,10 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
(TCPOPT_TIMESTAMP << 8) |
TCPOLEN_TIMESTAMP);
}
- *ptr++ = htonl(opts->tsval);
+ /* Currently, opts->tsval always comes from tcp_time_stamp.
+ * Thus, if zero, its caused by jiffie wrap-around, and we can
+ * approximate it to one to avoid a later TSecr drop */
+ *ptr++ = htonl(opts->tsval?:1);
*ptr++ = htonl(opts->tsecr);
}
next reply other threads:[~2009-08-31 17:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-31 17:44 Octavian Purdila [this message]
2009-09-02 1:16 ` [PATCH] [net-next] tcp: avoid sending zero TSval David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200908312044.56235.opurdila@ixiacom.com \
--to=opurdila@ixiacom.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox