From 6d12c623fccd122a1cd2996e7714648130799da9 Mon Sep 17 00:00:00 2001 From: Henning Heinold Date: Wed, 11 Dec 2013 19:51:31 +0100 Subject: [PATCH] busybox: backport the ifplugd-larger-buffer patch for kernel 3.9 and above To use the busybox-ipflugd a larger buffer for netdev messages is needed. This is orginal patch from http://git.busybox.net/busybox/commit/networking/ifplugd.c?id=da331d779c19d7d5d4ef05152ee467d617913a01 which is needed until a new busybox version is released. This commit only is only relevant to the dora release of poky. * bump PRINC --- .../ifplugd-use-a-larger-netlink-buffer.patch | 62 +++++++++++++++++++ recipes-core/busybox/busybox_sysmocom.inc | 2 +- .../busybox/busybox_sysmocom_systemd.inc | 2 + 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 recipes-core/busybox/busybox-1.21.1/ifplugd-use-a-larger-netlink-buffer.patch diff --git a/recipes-core/busybox/busybox-1.21.1/ifplugd-use-a-larger-netlink-buffer.patch b/recipes-core/busybox/busybox-1.21.1/ifplugd-use-a-larger-netlink-buffer.patch new file mode 100644 index 0000000..a0670a5 --- /dev/null +++ b/recipes-core/busybox/busybox-1.21.1/ifplugd-use-a-larger-netlink-buffer.patch @@ -0,0 +1,62 @@ +Upstream-Status: Backport +Signed-off-by: Henning Heinold + +From da331d779c19d7d5d4ef05152ee467d617913a01 Mon Sep 17 00:00:00 2001 +From: Tito Ragusa +Date: Sun, 4 Aug 2013 18:08:40 +0200 +Subject: [PATCH 001/104] ifplugd: use a larger netlink buffer + +function old new delta +check_existence_through_netlink 310 321 +11 + +Signed-off-by: Tito Ragusa +Signed-off-by: Denys Vlasenko +--- + networking/ifplugd.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/networking/ifplugd.c b/networking/ifplugd.c +index 3cdc2c9..b578f4c 100644 +--- a/networking/ifplugd.c ++++ b/networking/ifplugd.c +@@ -451,20 +451,24 @@ static smallint detect_link(void) + static NOINLINE int check_existence_through_netlink(void) + { + int iface_len; +- char replybuf[1024]; ++ /* Buffer was 1K, but on linux-3.9.9 it was reported to be too small. ++ * netlink.h: "limit to 8K to avoid MSG_TRUNC when PAGE_SIZE is very large". ++ * Note: on error returns (-1) we exit, no need to free replybuf. ++ */ ++ enum { BUF_SIZE = 8 * 1024 }; ++ char *replybuf = xmalloc(BUF_SIZE); + + iface_len = strlen(G.iface); + while (1) { + struct nlmsghdr *mhdr; + ssize_t bytes; + +- bytes = recv(netlink_fd, &replybuf, sizeof(replybuf), MSG_DONTWAIT); ++ bytes = recv(netlink_fd, replybuf, BUF_SIZE, MSG_DONTWAIT); + if (bytes < 0) { + if (errno == EAGAIN) +- return G.iface_exists; ++ goto ret; + if (errno == EINTR) + continue; +- + bb_perror_msg("netlink: recv"); + return -1; + } +@@ -507,6 +511,8 @@ static NOINLINE int check_existence_through_netlink(void) + } + } + ++ ret: ++ free(replybuf); + return G.iface_exists; + } + +-- +1.7.10.4 + diff --git a/recipes-core/busybox/busybox_sysmocom.inc b/recipes-core/busybox/busybox_sysmocom.inc index 9b64562..b846a2d 100644 --- a/recipes-core/busybox/busybox_sysmocom.inc +++ b/recipes-core/busybox/busybox_sysmocom.inc @@ -1,6 +1,6 @@ SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}" FILESEXTRAPATHS_prepend := "${SYSMOCOM}/busybox-${SYSMOCOM_ORIG_PV}:${SYSMOCOM}/files:" -PRINC = "19" +PRINC = "20" SRC_URI += "file://busybox-ifplugd.sh \ file://ifplugd.sh" diff --git a/recipes-core/busybox/busybox_sysmocom_systemd.inc b/recipes-core/busybox/busybox_sysmocom_systemd.inc index 03460c1..f0bd7c9 100644 --- a/recipes-core/busybox/busybox_sysmocom_systemd.inc +++ b/recipes-core/busybox/busybox_sysmocom_systemd.inc @@ -2,3 +2,5 @@ SYSMOCOM_D := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}" FILESEXTRAPATHS_prepend := "${SYSMOCOM}/${PN}-systemd:${SYSMOCOM_D}/${PN}:" PRINC := "${@int(PRINC) + 2}" + +SRC_URI += "file://ifplugd-use-a-larger-netlink-buffer.patch"