From: Christoph Paasch Subject: [RFC v2 10/14] tcp_md5: Check for TCP_MD5 after TCP Timestamps in tcp_established_options Date: Wed, 31 Jan 2018 16:07:12 -0800 Message-ID: <20180201000716.69301-11-cpaasch@apple.com> References: <20180201000716.69301-1-cpaasch@apple.com> Content-Transfer-Encoding: 7BIT Cc: Eric Dumazet , Mat Martineau , Ivan Delalande To: netdev@vger.kernel.org Return-path: Received: from mail-out5.apple.com ([17.151.62.27]:53104 "EHLO mail-in5.apple.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754313AbeBAAHe (ORCPT ); Wed, 31 Jan 2018 19:07:34 -0500 In-reply-to: <20180201000716.69301-1-cpaasch@apple.com> Sender: netdev-owner@vger.kernel.org List-ID: It really does not matter, because we never use TCP timestamps when TCP_MD5 is enabled (see tcp_syn_options). Moving TCP_MD5 a bit lower allows for easier adoption of the tcp_extra_option framework. Cc: Ivan Delalande Signed-off-by: Christoph Paasch Reviewed-by: Mat Martineau --- net/ipv4/tcp_output.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index facbdf4fe9be..97e6aecc03eb 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -662,6 +662,13 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb opts->options = 0; + if (likely(tp->rx_opt.tstamp_ok)) { + opts->options |= OPTION_TS; + opts->tsval = skb ? tcp_skb_timestamp(skb) + tp->tsoffset : 0; + opts->tsecr = tp->rx_opt.ts_recent; + size += TCPOLEN_TSTAMP_ALIGNED; + } + #ifdef CONFIG_TCP_MD5SIG opts->md5 = tp->af_specific->md5_lookup(sk, sk); if (unlikely(opts->md5)) { @@ -672,13 +679,6 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb opts->md5 = NULL; #endif - if (likely(tp->rx_opt.tstamp_ok)) { - opts->options |= OPTION_TS; - opts->tsval = skb ? tcp_skb_timestamp(skb) + tp->tsoffset : 0; - opts->tsecr = tp->rx_opt.ts_recent; - size += TCPOLEN_TSTAMP_ALIGNED; - } - if (unlikely(!hlist_empty(&tp->tcp_option_list))) size += tcp_extopt_prepare(skb, 0, MAX_TCP_OPTION_SPACE - size, opts, tcp_to_sk(tp)); -- 2.16.1