Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2762156imj; Mon, 11 Feb 2019 08:06:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IarkaPbmHdFk4ewJ/3CEIhVzvFdyL335J54ngjbAXBkzenz9ofxZlpo5xvEvt5Ry/kexafT X-Received: by 2002:a17:902:b68d:: with SMTP id c13mr38128643pls.102.1549901180980; Mon, 11 Feb 2019 08:06:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901180; cv=none; d=google.com; s=arc-20160816; b=ozUCDtby90Rza0/MiDm1s94psYhCve+Pdn+jT6IPjykU7yZXImWTZwHkDWE8a3TnrC P4GAoAHzm9jUHyH8Y4XEJ9moFw0RUyWNAIoNPVgx3z8OeB9Yb0pSU2ISDDVYTfKRKm1e uNtffzxuPGDGgH1kUP4hd2JjG7vqF6a9BOSOU05Hei1mkGMsa3J6DHaLk22S9l5dUnH3 7LUx1uhybW5KXFQnNslX1At0yYTwhSpUlrfYRz3E4MoIMC/dBhah3pRsME/irqAmBiEd wuNCcLDQHqYZwiuM90F2+V4V6xqalsaCsS/nS7BveHOsd83rVPs+99nYftUSrg/Eq5qC NsJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V4imQO9TMDh0mbjTTMACHmqC/1Zljnndm6AljT5VEk4=; b=W3iMKLHwHypBGTJYyObVlavm3yWVmAjOX9gdY/isfGZuMEosxMQ7fDE6rADEZ6NBWS W314EUQ+Zrby+E7xmMndw5aKrC+j/gyFmAEP/IU5oIo4ubGUnfTNnh1y61jVD2dYYP+u RybY6GKD+6uy5emR8u7e54jKSMJ7EP4GISwnJNf8NlYY/+PC1bfeL9/e5DrHJIVXLPpt v3xZuMXbDm5Z4l+SPxgwJXExal7UBMhYbk5MBSd7nQGiY4+kfHXieC3ORN3k7w3FNQsz upNszhEpOj9gCOj6XxdRPQSbdpGNiQEIJ1cSw3rsGpRWitg9hAqa0Rmf7juq0V9yqYTr UPDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yjPQwIxv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si10901791pla.334.2019.02.11.08.05.53; Mon, 11 Feb 2019 08:06:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yjPQwIxv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730132AbfBKQEs (ORCPT + 99 others); Mon, 11 Feb 2019 11:04:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:34346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728875AbfBKO2X (ORCPT ); Mon, 11 Feb 2019 09:28:23 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E07520838; Mon, 11 Feb 2019 14:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895302; bh=vOZblrMHiMPy/N2g4ULaI1y/2bqLsgO3ZEKp9zyj7Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yjPQwIxv5rNDOY/AODBVuzZqee2UYIUIXjwkmWWdollwcdUD6DE/BpBrOhBxbULpN r9oj0MAPQJU8cYEWqk+hGmE1BCpq2afKLvJp00ZfW7P3vf1GVeJcdBmQ2nvH/CZ7QV 4YcDBfDjjZ/pPtazi7TmYdEfsJLVlt640t/TwfNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislav Fomichev , Daniel Borkmann , Alexei Starovoitov , Sasha Levin Subject: [PATCH 4.20 161/352] selftests/bpf: use __bpf_constant_htons in test_prog.c Date: Mon, 11 Feb 2019 15:16:28 +0100 Message-Id: <20190211141857.142945451@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit a0517a0f7ef23550b4484c37e2b9c2d32abebf64 ] For some reason, my older GCC (< 4.8) isn't smart enough to optimize the !__builtin_constant_p() branch in bpf_htons, I see: error: implicit declaration of function '__builtin_bswap16' Let's use __bpf_constant_htons as suggested by Daniel Borkmann. I tried to use simple htons, but it produces the following: test_progs.c:54:17: error: braced-group within expression allowed only inside a function .eth.h_proto = htons(ETH_P_IP), Signed-off-by: Stanislav Fomichev Signed-off-by: Daniel Borkmann Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_progs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 2d3c04f45530..6ac7232b0fde 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -51,10 +51,10 @@ static struct { struct iphdr iph; struct tcphdr tcp; } __packed pkt_v4 = { - .eth.h_proto = bpf_htons(ETH_P_IP), + .eth.h_proto = __bpf_constant_htons(ETH_P_IP), .iph.ihl = 5, .iph.protocol = 6, - .iph.tot_len = bpf_htons(MAGIC_BYTES), + .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES), .tcp.urg_ptr = 123, }; @@ -64,9 +64,9 @@ static struct { struct ipv6hdr iph; struct tcphdr tcp; } __packed pkt_v6 = { - .eth.h_proto = bpf_htons(ETH_P_IPV6), + .eth.h_proto = __bpf_constant_htons(ETH_P_IPV6), .iph.nexthdr = 6, - .iph.payload_len = bpf_htons(MAGIC_BYTES), + .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES), .tcp.urg_ptr = 123, }; -- 2.19.1