summaryrefslogtreecommitdiff
path: root/include/sparse
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-01-16 17:21:55 -0800
committerBen Pfaff <blp@nicira.com>2014-01-16 23:40:43 -0800
commit55bc98d6cb340626eab68fa91eeffafe5e5a2339 (patch)
tree361c78520f1c522e08549dd605257406213d6c56 /include/sparse
parentddd43de9ba729023dbee897a330727dfa9a6a7a6 (diff)
downloadopenvswitch-55bc98d6cb340626eab68fa91eeffafe5e5a2339.tar.gz
netdev-linux: Fix build break on RHEL 6.1.
Commit 73c85181d (netdev-linux: Read packet auxdata to obtain vlan_tid) added #include <linux/if_packet.h> 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 <blp@nicira.com>
Diffstat (limited to 'include/sparse')
-rw-r--r--include/sparse/automake.mk1
-rw-r--r--include/sparse/netpacket/packet.h37
2 files changed, 38 insertions, 0 deletions
diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk
index 45ae1f506..572c7c2c7 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 000000000..21bdd2ea7
--- /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 /* <netpacket/packet.h> sparse */