From 112e3704576922a6716bf6f47721e69f3c35d335 Mon Sep 17 00:00:00 2001 From: Jakub Schmidtke Date: Mon, 19 Jun 2017 13:30:45 -0400 Subject: [PATCH] Sending TCP timestamp option in SYN packets TCP timestamps were only sent if the remote side requested it first. This enables the use of timestamps for outgoing connections as well. Signed-off-by: goldsimon --- src/core/tcp_out.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 1f42eeda..95065834 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -835,9 +835,9 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags) #endif /* LWIP_WND_SCALE */ } #if LWIP_TCP_TIMESTAMPS - if ((pcb->flags & TF_TIMESTAMP)) { - /* Make sure the timestamp option is only included in data segments if we - agreed about it with the remote host. */ + if ((pcb->flags & TF_TIMESTAMP) || ((flags & TCP_SYN) && (pcb->state != SYN_RCVD))) { + /* The timestamp option is only included in SYN packets, + * and in data segments if we agreed about it with the remote host. */ optflags |= TF_SEG_OPTS_TS; } #endif /* LWIP_TCP_TIMESTAMPS */