From patchwork Wed Mar 6 01:01:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1052088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Db7H2zrVz9s9N for ; Wed, 6 Mar 2019 12:01:30 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EFE95D73; Wed, 6 Mar 2019 01:01:27 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D6767BE0; Wed, 6 Mar 2019 01:01:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9B20D180; Wed, 6 Mar 2019 01:01:25 +0000 (UTC) X-Originating-IP: 208.91.3.26 Received: from ovn.org (unknown [208.91.3.26]) (Authenticated sender: blp@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 642001BF205; Wed, 6 Mar 2019 01:01:21 +0000 (UTC) Date: Tue, 5 Mar 2019 17:01:17 -0800 From: Ben Pfaff To: Fernando Casas =?iso-8859-1?q?Sch=F6ssow?= Message-ID: <20190306010117.GE25780@ovn.org> References: <20190304205924.GL25780@ovn.org> <20190305230306.GX25780@ovn.org> <20190305230859.GY25780@ovn.org> <20190306000844.GB25780@ovn.org> <20190306001755.GD25780@ovn.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: "ovs-dev@openvswitch.org" , "developer@it-offshore.co.uk" , "ovs-discuss@openvswitch.org" Subject: [ovs-dev] MUSL netpacket/packet.h X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Hmm, with the patch I suspect that compilation fails against some systems with glibc, based on e.g. the appended commit. Probably there is some way to resolve it with proper autoconf tests, but I don't know what test is appropriate in this case. I tried building with "musl-gcc" on Debian, but that had a lot of problems other than this one. So unless someone invests some time in solving the problem, maybe your patch is an appropriate stopgap. On Wed, Mar 06, 2019 at 12:30:24AM +0000, Fernando Casas Schössow wrote: > I tried to build the package and it fails without the patch so I guess it is still needed to build on Alpine (I'm adding Stuart Cardall who is the package maintainer in case he can comment on this). > > Probably is only needed in Alpine, because of musl libc. > > On mié, mar 6, 2019 at 1:17 AM, Ben Pfaff wrote: > On Wed, Mar 06, 2019 at 12:13:32AM +0000, Fernando Casas Schössow wrote: > And besides the ifupdown scripts the only patch it applies seems to be required by musl libc: musl-if_packet.patch --- openvswitch-2.4.0/lib/netdev-linux.c 2015-08-20 00:33:42.960971996 +0000 +++ openvswitch-2.4.0/lib/netdev-linux.c.new 2015-08-22 18:16:10.741115156 +0000 @@ -37,10 +37,9 @@ #include #include #include -#include #include #include -#include +#include #include #include #include > I'm going to assume that the 2.4.0 version number in the patch just means that it was originally applied to that version and later forward-ported. If this patch is still needed on master, let me know--we'll get it applied upstream. > > commit 55bc98d6cb340626eab68fa91eeffafe5e5a2339 Author: Ben Pfaff Date: Thu Jan 16 17:21:55 2014 -0800 netdev-linux: Fix build break on RHEL 6.1. Commit 73c85181d (netdev-linux: Read packet auxdata to obtain vlan_tid) added #include to this file, to get the definition of PACKET_AUXDATA and some other definitions, but on RHEL 6.1 this provoked compiler errors: In file included from /usr/include/linux/rtnetlink.h:5, from lib/netdev-linux.c:34: /usr/include/linux/netlink.h:34: error: expected specifier-qualifier-list before 'sa_family_t' Since the old #includes worked everywhere, and this file already defined its own versions of most of the new macros that it needed, this commit just reverts the old #includes and adds the one macro definition it didn't already have. (RHEL 6.1 isn't necessarily the only platform where this is a problem, but it's the first one for which we noticed the problem.) This switches the definition of sockaddr_ll used from the Linux one, which uses __be16 for sll_protocol, to the glibc one, which uses plain "unsigned short int". This makes sparse complain (rightly), so this commit also adds a sparse-specific header that uses ovs_be16 to prevent the warning. Signed-off-by: Ben Pfaff diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk index 45ae1f506062..572c7c2c737e 100644 --- a/include/sparse/automake.mk +++ b/include/sparse/automake.mk @@ -4,6 +4,7 @@ noinst_HEADERS += \ include/sparse/math.h \ include/sparse/netinet/in.h \ include/sparse/netinet/ip6.h \ + include/sparse/netpacket/packet.h \ include/sparse/pthread.h \ include/sparse/sys/socket.h \ include/sparse/sys/wait.h diff --git a/include/sparse/netpacket/packet.h b/include/sparse/netpacket/packet.h new file mode 100644 index 000000000000..21bdd2ea7087 --- /dev/null +++ b/include/sparse/netpacket/packet.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CHECKER__ +#error "Use this header only with sparse. It is not a correct implementation." +#endif + +#ifndef __NETPACKET_PACKET_SPARSE +#define __NETPACKET_PACKET_SPARSE 1 + +#include "openvswitch/types.h" + +struct sockaddr_ll + { + unsigned short int sll_family; + ovs_be16 sll_protocol; + int sll_ifindex; + unsigned short int sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[8]; + }; + +#endif /* sparse */ diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 9c1a36db181e..e756d88a9458 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,11 @@ #include #include +#include #include #include #include #include -#include #include #include #include @@ -37,8 +37,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -116,6 +118,9 @@ COVERAGE_DEFINE(netdev_set_ethtool); * With all this churn it's easiest to unconditionally define a replacement * structure that has everything we want. */ +#ifndef PACKET_AUXDATA +#define PACKET_AUXDATA 8 +#endif #ifndef TP_STATUS_VLAN_VALID #define TP_STATUS_VLAN_VALID (1 << 4) #endif