From patchwork Sat Oct 5 20:09:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 280798 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9165C2C00BD for ; Sun, 6 Oct 2013 07:16:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752494Ab3JEUQL (ORCPT ); Sat, 5 Oct 2013 16:16:11 -0400 Received: from mail-ye0-f171.google.com ([209.85.213.171]:34940 "EHLO mail-ye0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478Ab3JEUQH (ORCPT ); Sat, 5 Oct 2013 16:16:07 -0400 Received: by mail-ye0-f171.google.com with SMTP id q3so1249148yen.30 for ; Sat, 05 Oct 2013 13:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Wq2gstO8KV9XskKq9FhWBEFDzCWNbuBF7s/XlCW4HAk=; b=VtFO7UdCZ3IWXNDOrVcQcff4k2eSw3fMbbsbP4gLhuiyLnawTt+eyy0VRc2KuHLKtJ qJgY9L0t40YVwwVmSPcVlX8+w8KwacV9dLm8Oa1Qcf5kxdFJK5eZnxFhlNeBuvBiDiOA ZrTdfy0eApICWm8JfvkntSFEuenRiZCEtr3/RqejNxo4RFKN5uBChZErqSNDWRNbNUcu /wZY7RJy52297BFATG1GTXXUCMYeXvhSQSoh4R3mOPQsMPWjhk1BvYtFuyk2egR+I7Rk ufrXThMSxxjBZ4S3CqH2rk/+TETPwRjk4TxCRaI/rjYmEkEA7LzFSbz2j2DV3IlUZIrn cOHw== X-Received: by 10.236.174.37 with SMTP id w25mr16770733yhl.36.1381003812457; Sat, 05 Oct 2013 13:10:12 -0700 (PDT) Received: from localhost.localdomain ([186.207.93.139]) by mx.google.com with ESMTPSA id j67sm29933802yhe.26.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 05 Oct 2013 13:10:11 -0700 (PDT) From: Fabio Estevam To: davem@davemloft.net Cc: edumazet@google.com, hannes@strressinduktion.org, netdev@vger.kernel.org, olof@lixom.net, Fabio Estevam Subject: [PATCH] net: secure_seq: Move net_secret_init() definition into CONFIG_IPV6 if block Date: Sat, 5 Oct 2013 17:09:50 -0300 Message-Id: <1381003790-12731-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.1.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fabio Estevam Commit 9a3bab6b05 (net: net_secret should not depend on TCP) introduced the following build warning when CONFIG_IPV6 is not selected: net/core/secure_seq.c:17:13: warning: 'net_secret_init' defined but not used [-Wunused-function] Fix it by moving net_secret_init(void) inside the '#if IS_ENABLED(CONFIG_IPV6)' block. Reported-by: Olof Johansson Signed-off-by: Fabio Estevam --- net/core/secure_seq.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c index 3f1ec15..ee70541 100644 --- a/net/core/secure_seq.c +++ b/net/core/secure_seq.c @@ -10,6 +10,24 @@ #include +#ifdef CONFIG_INET +static u32 seq_scale(u32 seq) +{ + /* + * As close as possible to RFC 793, which + * suggests using a 250 kHz clock. + * Further reading shows this assumes 2 Mb/s networks. + * For 10 Mb/s Ethernet, a 1 MHz clock is appropriate. + * For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but + * we also need to limit the resolution so that the u32 seq + * overlaps less than one time per MSL (2 minutes). + * Choosing a clock of 64 ns period is OK. (period of 274 s) + */ + return seq + (ktime_to_ns(ktime_get_real()) >> 6); +} +#endif + +#if IS_ENABLED(CONFIG_IPV6) #define NET_SECRET_SIZE (MD5_MESSAGE_BYTES / 4) static u32 net_secret[NET_SECRET_SIZE] ____cacheline_aligned; @@ -30,24 +48,6 @@ static void net_secret_init(void) } } -#ifdef CONFIG_INET -static u32 seq_scale(u32 seq) -{ - /* - * As close as possible to RFC 793, which - * suggests using a 250 kHz clock. - * Further reading shows this assumes 2 Mb/s networks. - * For 10 Mb/s Ethernet, a 1 MHz clock is appropriate. - * For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but - * we also need to limit the resolution so that the u32 seq - * overlaps less than one time per MSL (2 minutes). - * Choosing a clock of 64 ns period is OK. (period of 274 s) - */ - return seq + (ktime_to_ns(ktime_get_real()) >> 6); -} -#endif - -#if IS_ENABLED(CONFIG_IPV6) __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, __be16 sport, __be16 dport) {