[Buildroot] [git commit] dhcpcd: add upstream patch to fix build issue

Peter Korsgaard peter at korsgaard.com
Wed Apr 29 20:58:05 UTC 2015


commit: http://git.buildroot.net/buildroot/commit/?id=2e98995068fdaf1880bc1942ec3a8424bd754e9f
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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 <peter at korsgaard.com>
---
 ...0001-fix-in6_pktinfo-build-issue-on-linux.patch |  162 ++++++++++++++++++++
 1 files changed, 162 insertions(+), 0 deletions(-)

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 0000000..69919d6
--- /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 <peter at korsgaard.com>
+--
+
+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 <mach/mach_time.h>
+ #  include <mach/kern_return.h>
+ #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 <asm/types.h> /* fix broken headers */" >>$CONFIG_H
+-	echo "#include <linux/rtnetlink.h>" >>$CONFIG_H
++	echo "#include		<asm/types.h> /* fix broken headers */" >>$CONFIG_H
++	echo "#include		<linux/rtnetlink.h>" >>$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 <<EOF >_getline.c
+-#define _GNU_SOURCE
+ #include <stdio.h>
+ 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 <sys/time.h>
+ 
+ #include <errno.h>
+ #include <limits.h>
+ #include <signal.h>
+
+Index: ipv6.h
+==================================================================
+--- a/ipv6.h
++++ b/ipv6.h
+@@ -27,18 +27,12 @@
+ 
+ #ifndef IPV6_H
+ #define IPV6_H
+ 
+ #include <sys/uio.h>
+-
+ #include <netinet/in.h>
+ 
+-#if defined(__linux__) && defined(__GLIBC__)
+-#  define _LINUX_IN6_H
+-#  include <linux/ipv6.h>
+-#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) {
+


More information about the buildroot mailing list