From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Paasch Subject: [RFC 04/14] tcp_smc: Make smc_parse_options return 1 on success Date: Mon, 18 Dec 2017 13:50:59 -0800 Message-ID: <20171218215109.38700-5-cpaasch@apple.com> References: <20171218215109.38700-1-cpaasch@apple.com> Content-Transfer-Encoding: 7BIT Cc: Eric Dumazet , Mat Martineau , Alexei Starovoitov , Ursula Braun To: netdev@vger.kernel.org Return-path: Received: from mail-out6.apple.com ([17.151.62.28]:65236 "EHLO mail-in6.apple.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S937505AbdLRVvh (ORCPT ); Mon, 18 Dec 2017 16:51:37 -0500 In-reply-to: <20171218215109.38700-1-cpaasch@apple.com> Sender: netdev-owner@vger.kernel.org List-ID: As we allow a generic TCP-option parser that also parses experimental TCP options, we need to add a return-value to smc_parse_options() that indicates whether the option actually matched or not. Cc: Ursula Braun Signed-off-by: Christoph Paasch Reviewed-by: Mat Martineau --- net/ipv4/tcp_input.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index eb97ee24c601..5c35fd568b13 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3671,19 +3671,22 @@ static void tcp_parse_fastopen_option(int len, const unsigned char *cookie, foc->exp = exp_opt; } -static void smc_parse_options(const struct tcphdr *th, - struct tcp_options_received *opt_rx, - const unsigned char *ptr, - int opsize) +static int smc_parse_options(const struct tcphdr *th, + struct tcp_options_received *opt_rx, + const unsigned char *ptr, + int opsize) { #if IS_ENABLED(CONFIG_SMC) if (static_branch_unlikely(&tcp_have_smc)) { if (th->syn && !(opsize & 1) && opsize >= TCPOLEN_EXP_SMC_BASE && - get_unaligned_be32(ptr) == TCPOPT_SMC_MAGIC) + get_unaligned_be32(ptr) == TCPOPT_SMC_MAGIC) { opt_rx->smc_ok = 1; + return 1; + } } #endif + return 0; } /* Look for tcp options. Normally only called on SYN and SYNACK packets. -- 2.15.0