From patchwork Thu Feb 4 17:43:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Fedorenko X-Patchwork-Id: 12068085 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4316C433DB for ; Thu, 4 Feb 2021 17:45:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 920F464F60 for ; Thu, 4 Feb 2021 17:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238653AbhBDRos (ORCPT ); Thu, 4 Feb 2021 12:44:48 -0500 Received: from novek.ru ([213.148.174.62]:34216 "EHLO novek.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238599AbhBDRog (ORCPT ); Thu, 4 Feb 2021 12:44:36 -0500 Received: from nat1.ooonet.ru (gw.zelenaya.net [91.207.137.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by novek.ru (Postfix) with ESMTPSA id 84E95503356; Thu, 4 Feb 2021 20:43:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 novek.ru 84E95503356 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=novek.ru; s=mail; t=1612460632; bh=B+A360lxCikUuglRjqMa2pvztYPB1WgFIX9yI1XANvI=; h=From:To:Cc:Subject:Date:From; b=CUib10pNSIupeqLHWBKzyoOT6YtuKacLVOhiDW8v/atKsfwvn9e2NP0Dn9ICmh65G /yoNZQAGTN6ugKxZ5QUZ3KXyixKam0AmLaOo2EvS0KNBmlM4fpH01rMcDSAeZCjut3 XDf0ub/D2q5gwFFvJrn+l6HGzEiC3l+phcEP0haE= From: Vadim Fedorenko To: Jakub Kicinski , Jian Yang , Willem de Bruijn Cc: Vadim Fedorenko , netdev@vger.kernel.org Subject: [net v3] selftests: txtimestamp: fix compilation issue Date: Thu, 4 Feb 2021 20:43:36 +0300 Message-Id: <1612460616-22552-1-git-send-email-vfedorenko@novek.ru> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in test. Include it instead of otherwise the error of redefinition arrives. Also fix the compiler warning about ambiguous control flow by adding explicit braces. Fixes: 8fe2f761cae9 ("net-timestamp: expand documentation") Suggested-by: Willem de Bruijn Signed-off-by: Vadim Fedorenko --- tools/testing/selftests/net/txtimestamp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c index 490a8cc..3d6bf54 100644 --- a/tools/testing/selftests/net/txtimestamp.c +++ b/tools/testing/selftests/net/txtimestamp.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -34,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -53,6 +53,7 @@ #define NSEC_PER_USEC 1000L #define USEC_PER_SEC 1000000L #define NSEC_PER_SEC 1000000000LL +#define PACKET_TX_TIMESTAMP 16 /* command line parameters */ static int cfg_proto = SOCK_STREAM; @@ -495,12 +496,12 @@ static void do_test(int family, unsigned int report_opt) total_len = cfg_payload_len; if (cfg_use_pf_packet || cfg_proto == SOCK_RAW) { total_len += sizeof(struct udphdr); - if (cfg_use_pf_packet || cfg_ipproto == IPPROTO_RAW) + if (cfg_use_pf_packet || cfg_ipproto == IPPROTO_RAW) { if (family == PF_INET) total_len += sizeof(struct iphdr); else total_len += sizeof(struct ipv6hdr); - + } /* special case, only rawv6_sendmsg: * pass proto in sin6_port if not connected * also see ANK comment in net/ipv4/raw.c