Based on:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/plain/meta/recipes-connectivity/ppp/ppp/0001-pppoe-include-netinet-in.h-before-linux-in.h.patch?h=thud-next

--------------------------------------------------------------------------------
From 50a2997b256e0e0ef7a46fae133f56f60fce539c Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 9 Jan 2017 13:34:23 +0000
Subject: [PATCH] pppoe: include netinet/in.h before linux/in.h

This fixes builds with newer kernels. Basically, <netinet/in.h> needs to be
included before <linux/in.h> otherwise the earlier, unaware of the latter,
tries to redefine symbols and structures. Also, <linux/if_pppox.h> doesn't work
alone anymore, since it pulls the headers in the wrong order, so we better
include <netinet/in.h> early.

Upstream-Status: Backport
[https://github.com/paulusmack/ppp/commit/50a2997b256e0e0ef7a46fae133f56f60fce539c]

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
-----------------------------------------------------------------------------------

To fix the below issue:

                 from plugin.c:29:
/home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/sys/socket.h:90:264: note: originally defined here
In file included from /home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/linux/if_pppol2tp.h:20:0,
                 from /home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/linux/if_pppox.h:26,
                 from plugin.c:52:
/home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/linux/in6.h:32:8: error: redefinition of 'struct in6_addr'
 struct in6_addr {
        ^
In file included from pppoe.h:87:0,
                 from plugin.c:29:
/home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/netinet/in.h:209:8: note: originally defined here
 struct in6_addr
        ^
In file included from /home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/linux/if_pppol2tp.h:20:0,
                 from /home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/linux/if_pppox.h:26,
                 from plugin.c:52:
/home/timesys/factory/build_armv7l-timesys-linux-gnueabihf/toolchain/include/linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6'
 struct sockaddr_in6 {
        ^
In file included from pppoe.h:47:0,
                 from plugin.c:29:
---
 pppd/plugins/rp-pppoe/pppoe.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pppd/plugins/rp-pppoe/pppoe.h b/pppd/plugins/rp-pppoe/pppoe.h
index 9ab2eee..c4aaa6e 100644
--- a/pppd/plugins/rp-pppoe/pppoe.h
+++ b/pppd/plugins/rp-pppoe/pppoe.h
@@ -47,6 +47,10 @@
 #include <sys/socket.h>
 #endif
 
+/* This has to be included before Linux 4.8's linux/in.h
+ * gets dragged in. */
+#include <netinet/in.h>
+
 /* Ugly header files on some Linux boxes... */
 #if defined(HAVE_LINUX_IF_H)
 #include <linux/if.h>
@@ -84,8 +88,6 @@ typedef unsigned long UINT32_t;
 #include <linux/if_ether.h>
 #endif
 
-#include <netinet/in.h>
-
 #ifdef HAVE_NETINET_IF_ETHER_H
 #include <sys/types.h>
 
@@ -98,7 +100,6 @@ typedef unsigned long UINT32_t;
 #endif
 
 
-
 /* Ethernet frame types according to RFC 2516 */
 #define ETH_PPPOE_DISCOVERY 0x8863
 #define ETH_PPPOE_SESSION   0x8864
-- 
2.17.1

