--- /dev/null
+From afc450807c5e83c5312e9f88dd6911fe3b00f42e Mon Sep 17 00:00:00 2001
+From: Quentin Armitage <quentin@armitage.org.uk>
+Date: Mon, 23 Apr 2018 16:29:05 +0100
+Subject: [PATCH] Fix namespace collision with musl if_ether.h
+
+Using musl libc headers there is a namespace collision between
+netinet/if_ether.h and linux/if_ether.h. This commit incorporates
+a workaround.
+
+Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
+---
+ configure | 30 ++++++++++++++++++++++++++++++
+ configure.ac | 19 +++++++++++++++++++
+ keepalived/include/vrrp_arp.h | 4 ++++
+ keepalived/include/vrrp_vmac.h | 4 ++++
+ lib/config.h.in | 4 ++++
+ 5 files changed, 61 insertions(+)
+
+diff --git a/configure b/configure
+index 0ba4b3b4..28f97e23 100755
+--- a/configure
++++ b/configure
+@@ -9165,6 +9165,36 @@ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="$SAV_CPPFLAGS"
+
++# Including <linux/if_ether.h> and <netinet/if_ether.h> can cause a namespace collision (musl libc).
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linux/if_ether.h and netinet/if_ether.h namespace collision" >&5
++$as_echo_n "checking for linux/if_ether.h and netinet/if_ether.h namespace collision... " >&6; }
++SAV_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS $kernelinc"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++ #include <linux/if_ether.h>
++ #include <netinet/if_ether.h>
++
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++else
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++$as_echo "#define _HAVE_NETINET_LINUX_IF_ETHER_H_COLLISION_ 1 " >>confdefs.h
++
++ BUILD_OPTIONS="$BUILD_OPTIONS NETINET_LINUX_IF_ETHER_H_COLLISION"
++
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++CPPFLAGS="$SAV_CPPFLAGS"
++
+ # Linux 4.5 to 4.5.4 has <libiptc/libiptc.h> indirectly including <net/if.h>
+ # and <linux/if.h> which causes a namespace collision.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libiptc/libiptc.h linux/if.h and net/if.h namespace collision" >&5
+diff --git a/configure.ac b/configure.ac
+index 01a93be3..01dad94d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -930,6 +930,25 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ ])
+ CPPFLAGS="$SAV_CPPFLAGS"
+
++dnl ----[Check if have linux/if_ether.h and netinet/if_ether.h namespace collision]----
++# Including <linux/if_ether.h> and <netinet/if_ether.h> can cause a namespace collision (musl libc).
++AC_MSG_CHECKING([for linux/if_ether.h and netinet/if_ether.h namespace collision])
++SAV_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS $kernelinc"
++AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
++ #include <linux/if_ether.h>
++ #include <netinet/if_ether.h>
++ ]])],
++ [
++ AC_MSG_RESULT([no])
++ ],
++ [
++ AC_MSG_RESULT([yes])
++ AC_DEFINE([_HAVE_NETINET_LINUX_IF_ETHER_H_COLLISION_], [ 1 ], [Define to 1 if have linux/if_ether.h followed by netinet/if_ether.h namespace collision])
++ add_build_opt([NETINET_LINUX_IF_ETHER_H_COLLISION])
++ ])
++CPPFLAGS="$SAV_CPPFLAGS"
++
+ # Linux 4.5 to 4.5.4 has <libiptc/libiptc.h> indirectly including <net/if.h>
+ # and <linux/if.h> which causes a namespace collision.
+ AC_MSG_CHECKING([for libiptc/libiptc.h linux/if.h and net/if.h namespace collision])
+diff --git a/keepalived/include/vrrp_arp.h b/keepalived/include/vrrp_arp.h
+index 07ee7765..3414d391 100644
+--- a/keepalived/include/vrrp_arp.h
++++ b/keepalived/include/vrrp_arp.h
+@@ -25,6 +25,10 @@
+
+ /* system includes */
+ #include <netinet/in.h>
++#ifdef _HAVE_NET_LINUX_IF_H_COLLISION_
++#define _NETINET_IF_ETHER_H
++#include <linux/if_ether.h>
++#endif
+ #include <net/ethernet.h>
+ #include <net/if_arp.h>
+ #include <linux/if_infiniband.h>
+diff --git a/keepalived/include/vrrp_vmac.h b/keepalived/include/vrrp_vmac.h
+index b6b107a4..da14b240 100644
+--- a/keepalived/include/vrrp_vmac.h
++++ b/keepalived/include/vrrp_vmac.h
+@@ -29,6 +29,10 @@
+ #include <arpa/inet.h>
+ #include <string.h>
+ #include <syslog.h>
++#ifdef _HAVE_NET_LINUX_IF_H_COLLISION_
++#define _NETINET_IF_ETHER_H
++#include <linux/if_ether.h>
++#endif
+ #include <net/ethernet.h>
+
+ /* local includes */
+diff --git a/lib/config.h.in b/lib/config.h.in
+index 7be4054a..21a7715a 100644
+--- a/lib/config.h.in
++++ b/lib/config.h.in
+@@ -580,6 +580,10 @@
+ /* Define to 1 if using libnl-3 */
+ #undef _HAVE_LIBNL3_
+
++/* Define to 1 if have linux/if_ether.h followed by netinet/if_ether.h
++ namespace collision */
++#undef _HAVE_NETINET_LINUX_IF_ETHER_H_COLLISION_
++
+ /* Define to 1 if have linux/if.h followed by net/if.h namespace collision */
+ #undef _HAVE_NET_LINUX_IF_H_COLLISION_
+
+--
+2.11.0
+
--- /dev/null
+From 58ae2ba75fa57896bc690c57a892958eb9816cd4 Mon Sep 17 00:00:00 2001
+From: Quentin Armitage <quentin@armitage.org.uk>
+Date: Mon, 23 Apr 2018 17:05:15 +0100
+Subject: [PATCH] Fix commit afc4508 Fix namespace collision with musl
+ if_ether.h
+
+Commit afc4508 used the wrong definitions for checking the if_ether.h
+namespace collision. This commit uses the correct definitions.
+
+Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
+---
+ keepalived/include/vrrp_arp.h | 2 +-
+ keepalived/include/vrrp_vmac.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/keepalived/include/vrrp_arp.h b/keepalived/include/vrrp_arp.h
+index 3414d391..a206f502 100644
+--- a/keepalived/include/vrrp_arp.h
++++ b/keepalived/include/vrrp_arp.h
+@@ -25,7 +25,7 @@
+
+ /* system includes */
+ #include <netinet/in.h>
+-#ifdef _HAVE_NET_LINUX_IF_H_COLLISION_
++#ifdef _HAVE_NETINET_LINUX_IF_ETHER_H_COLLISION_
+ #define _NETINET_IF_ETHER_H
+ #include <linux/if_ether.h>
+ #endif
+diff --git a/keepalived/include/vrrp_vmac.h b/keepalived/include/vrrp_vmac.h
+index da14b240..6cba88fc 100644
+--- a/keepalived/include/vrrp_vmac.h
++++ b/keepalived/include/vrrp_vmac.h
+@@ -29,7 +29,7 @@
+ #include <arpa/inet.h>
+ #include <string.h>
+ #include <syslog.h>
+-#ifdef _HAVE_NET_LINUX_IF_H_COLLISION_
++#ifdef _HAVE_NETINET_LINUX_IF_ETHER_H_COLLISION_
+ #define _NETINET_IF_ETHER_H
+ #include <linux/if_ether.h>
+ #endif
+--
+2.11.0
+