summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sparse/automake.mk1
-rw-r--r--include/sparse/netpacket/packet.h37
-rw-r--r--lib/netdev-linux.c9
3 files changed, 45 insertions, 2 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 */
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 9c1a36db1..e756d88a9 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 <errno.h>
#include <fcntl.h>
+#include <arpa/inet.h>
#include <inttypes.h>
#include <linux/filter.h>
#include <linux/gen_stats.h>
#include <linux/if_ether.h>
-#include <linux/if_packet.h>
#include <linux/if_tun.h>
#include <linux/types.h>
#include <linux/ethtool.h>
@@ -37,8 +37,10 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <netpacket/packet.h>
#include <net/if.h>
#include <net/if_arp.h>
+#include <net/if_packet.h>
#include <net/route.h>
#include <netinet/in.h>
#include <poll.h>
@@ -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