datapath: Provide simple version of if_ether.h on non-Linux systems.
authorJesse Gross <jesse@nicira.com>
Sat, 30 Mar 2013 01:41:13 +0000 (18:41 -0700)
committerJesse Gross <jesse@nicira.com>
Sat, 30 Mar 2013 01:47:25 +0000 (18:47 -0700)
Signed-off-by: Jesse Gross <jesse@nicira.com>
configure.ac
include/linux/automake.mk
include/linux/if_ether.h [new file with mode: 0644]

index bd49179..79fb46e 100644 (file)
@@ -61,7 +61,7 @@ OVS_CHECK_STRTOK_R
 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec],
   [], [], [[#include <sys/stat.h>]])
 AC_CHECK_FUNCS([mlockall strnlen strsignal getloadavg statvfs setmntent])
-AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h execinfo.h])
+AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h execinfo.h])
 
 OVS_CHECK_PKIDIR
 OVS_CHECK_RUNDIR
index 6fba507..6ca0e40 100644 (file)
@@ -1,3 +1,4 @@
 noinst_HEADERS += \
+       include/linux/if_ether.h \
        include/linux/openvswitch.h \
        include/linux/types.h
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
new file mode 100644 (file)
index 0000000..a3cc9bc
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013 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 LINUX_IF_ETHER_H
+#define LINUX_IF_ETHER_H 1
+
+/* On Linux, this header file just includes <linux/if_ether.h>.
+ *
+ * On other platforms, this header file implements just enough of
+ * <linux/if_ether.h> to allow <linux/openvswitch.h> to work. */
+
+#if defined(HAVE_LINUX_IF_ETHER_H) || defined(__KERNEL__)
+#include_next <linux/if_ether.h>
+#else  /* no <linux/if_ether.h> */
+#define ETH_ALEN        6               /* Octets in one ethernet addr   */
+#endif
+
+#endif /* <linux/if_ether.h> */