From: Peter Korsgaard Date: Wed, 29 Apr 2015 20:55:09 +0000 (+0200) Subject: dhcpcd: add upstream patch to fix build issue X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e98995068fdaf1880bc1942ec3a8424bd754e9f;p=buildroot.git dhcpcd: add upstream patch to fix build issue Fixes http://autobuild.buildroot.net/results/523/523858fb930e74fe28f24989ff0697693b5fdd67/ Patch from http://roy.marples.name/projects/dhcpcd/vpatch?from=e05490e2d12d03b1&to=c32714545158ca83 Signed-off-by: Peter Korsgaard --- diff --git a/package/dhcpcd/0001-fix-in6_pktinfo-build-issue-on-linux.patch b/package/dhcpcd/0001-fix-in6_pktinfo-build-issue-on-linux.patch new file mode 100644 index 0000000000..69919d6e37 --- /dev/null +++ b/package/dhcpcd/0001-fix-in6_pktinfo-build-issue-on-linux.patch @@ -0,0 +1,162 @@ +[PATCH] fix in6_pktinfo build issue on Linux + +From http://roy.marples.name/projects/dhcpcd/vpatch?from=e05490e2d12d03b1&to=c32714545158ca83 + +Give up on _BSD_SOURCE and use _GNU_SOURCE for Linux. This is requires for +newer Linux headers as there is no easy way to get at the in6_pktinfo +structure, so we have to fallback to the glibc variant which requires +_GNU_SOURCE being set. This does have the advantage of no longer sprinkling +_GNU_SOURCE around and no longer having to cast ipi.ipi_ifindex but may +break compile on older Linux. + +Signed-off-by: Peter Korsgaard +-- + +Index: common.c +================================================================== +--- a/common.c ++++ b/common.c +@@ -23,15 +23,10 @@ + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +-/* Needed define to get at getline for glibc and FreeBSD */ +-#ifndef _GNU_SOURCE +-# define _GNU_SOURCE +-#endif +- + #ifdef __APPLE__ + # include + # include + #endif + + +Index: configure +================================================================== +--- a/configure ++++ b/configure +@@ -358,27 +358,25 @@ + echo "There is no fork" + echo "CPPFLAGS+= -DTHERE_IS_NO_FORK" >>$CONFIG_MK + fi + + case "$OS" in +-kfreebsd*) ++freebsd*|kfreebsd*) + echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK + echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK + ;; + linux*) +- echo "CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700" >>$CONFIG_MK ++ echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK + # Large File Support, should be fine for 32-bit systems. + # But if this is the case, why is it not set by default? + echo "CPPFLAGS+= -D_FILE_OFFSET_BITS=64" >>$CONFIG_MK + echo "CPPFLAGS+= -D_LARGEFILE_SOURCE" >>$CONFIG_MK + echo "CPPFLAGS+= -D_LARGEFILE64_SOURCE" >>$CONFIG_MK +- # glibc-2.20 +- echo "CPPFLAGS+= -D_DEFAULT_SOURCE" >>$CONFIG_MK + echo "DHCPCD_SRCS+= if-linux.c" >>$CONFIG_MK + # for RTM_NEWADDR and friends +- echo "#include /* fix broken headers */" >>$CONFIG_H +- echo "#include " >>$CONFIG_H ++ echo "#include /* fix broken headers */" >>$CONFIG_H ++ echo "#include " >>$CONFIG_H + ;; + qnx*) + echo "CPPFLAGS+= -D__EXT" >>$CONFIG_MK + echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK + ;; +@@ -592,11 +590,10 @@ + fi + + if [ -z "$GETLINE" ]; then + printf "Testing for getline ... " + cat <_getline.c +-#define _GNU_SOURCE + #include + int main(void) { + char *buf = NULL; + size_t n = 0; + getline(&buf, &n, stdin); + +Index: dhcp6.c +================================================================== +--- a/dhcp6.c ++++ b/dhcp6.c +@@ -1149,11 +1149,11 @@ + return -1; + cm->cmsg_level = IPPROTO_IPV6; + cm->cmsg_type = IPV6_PKTINFO; + cm->cmsg_len = CMSG_LEN(sizeof(pi)); + memset(&pi, 0, sizeof(pi)); +- pi.ipi6_ifindex = CAST_IPI6_IFINDEX(ifp->index); ++ pi.ipi6_ifindex = ifp->index; + memcpy(CMSG_DATA(cm), &pi, sizeof(pi)); + + if (sendmsg(ctx->dhcp_fd, &ctx->sndhdr, 0) == -1) { + logger(ifp->ctx, LOG_ERR, + "%s: %s: sendmsg: %m", ifp->name, __func__); + +Index: eloop.c +================================================================== +--- a/eloop.c ++++ b/eloop.c +@@ -23,13 +23,10 @@ + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +-/* Needed for ppoll(2) */ +-#define _GNU_SOURCE +- + #include + + #include + #include + #include + +Index: ipv6.h +================================================================== +--- a/ipv6.h ++++ b/ipv6.h +@@ -27,18 +27,12 @@ + + #ifndef IPV6_H + #define IPV6_H + + #include +- + #include + +-#if defined(__linux__) && defined(__GLIBC__) +-# define _LINUX_IN6_H +-# include +-#endif +- + #include "config.h" + #include "dhcpcd.h" + + #define ALLROUTERS "ff02::2" + +Index: ipv6nd.c +================================================================== +--- a/ipv6nd.c ++++ b/ipv6nd.c +@@ -293,11 +293,11 @@ + return; + cm->cmsg_level = IPPROTO_IPV6; + cm->cmsg_type = IPV6_PKTINFO; + cm->cmsg_len = CMSG_LEN(sizeof(pi)); + memset(&pi, 0, sizeof(pi)); +- pi.ipi6_ifindex = CAST_IPI6_IFINDEX(ifp->index); ++ pi.ipi6_ifindex = ifp->index; + memcpy(CMSG_DATA(cm), &pi, sizeof(pi)); + + logger(ifp->ctx, LOG_DEBUG, + "%s: sending Router Solicitation", ifp->name); + if (sendmsg(ctx->nd_fd, &ctx->sndhdr, 0) == -1) { +