summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2017-09-07 10:37:10 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-11 17:30:29 +0100
commit5764589c3d668388e8fe5f3ca4e55487f1db35cd (patch)
treeb3dc645e863406a1691e39d05f39ee06fb4846b6
parent3cf90c0205209d8c3e728271a59493a48714179e (diff)
downloadpoky-5764589c3d668388e8fe5f3ca4e55487f1db35cd.tar.gz
iputils: backport patch to fix arping hang problem
arping hangs if SIGALARM is blocked. Backport a patch to fix this problem. Unblock SIGALRM so that the previously called alarm() can prevent recvfrom() from blocking forever in case the inherited procmask is blocking SIGALRM and no packet is received. (From OE-Core rev: 818d4a97763c69e9289fb99822535cd3ca7af6a2) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch44
-rw-r--r--meta/recipes-extended/iputils/iputils_s20151218.bb1
2 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch b/meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch
new file mode 100644
index 0000000000..7b56276b39
--- /dev/null
+++ b/meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch
@@ -0,0 +1,44 @@
1arping: fix arping hang if SIGALRM is blocked
2
3Unblock SIGALRM so that the previously called alarm() can prevent
4recvfrom() from blocking forever in case the inherited procmask is
5blocking SIGALRM and no packet is received.
6
7Upstream-Status: Backport
8
9Reported-by: Rui Prior <rprior@dcc.fc.up.pt>
10RH-Bugzilla: #1085971
11Signed-off-by: Jan Synacek <jsynacek@redhat.com>
12Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
13
14diff --git a/arping.c.orig b/arping.c
15index 35408c1..2098159 100644
16--- a/arping.c.orig
17+++ b/arping.c
18@@ -1215,16 +1215,22 @@ main(int argc, char **argv)
19 socklen_t alen = sizeof(from);
20 int cc;
21
22+ sigemptyset(&sset);
23+ sigaddset(&sset, SIGALRM);
24+ sigaddset(&sset, SIGINT);
25+ /* Unblock SIGALRM so that the previously called alarm()
26+ * can prevent recvfrom from blocking forever in case the
27+ * inherited procmask is blocking SIGALRM and no packet
28+ * is received. */
29+ sigprocmask(SIG_UNBLOCK, &sset, &osset);
30+
31 if ((cc = recvfrom(s, packet, sizeof(packet), 0,
32 (struct sockaddr *)&from, &alen)) < 0) {
33 perror("arping: recvfrom");
34 continue;
35 }
36
37- sigemptyset(&sset);
38- sigaddset(&sset, SIGALRM);
39- sigaddset(&sset, SIGINT);
40- sigprocmask(SIG_BLOCK, &sset, &osset);
41+ sigprocmask(SIG_BLOCK, &sset, NULL);
42 recv_pack(packet, cc, (struct sockaddr_ll *)&from);
43 sigprocmask(SIG_SETMASK, &osset, NULL);
44 }
diff --git a/meta/recipes-extended/iputils/iputils_s20151218.bb b/meta/recipes-extended/iputils/iputils_s20151218.bb
index 0d4dd1b17c..46de6fc444 100644
--- a/meta/recipes-extended/iputils/iputils_s20151218.bb
+++ b/meta/recipes-extended/iputils/iputils_s20151218.bb
@@ -20,6 +20,7 @@ SRC_URI = "http://www.skbuff.net/iputils/${BPN}-${PV}.tar.bz2 \
20 file://nsgmls-path-fix.patch \ 20 file://nsgmls-path-fix.patch \
21 file://0001-Fix-header-inclusion-for-musl.patch \ 21 file://0001-Fix-header-inclusion-for-musl.patch \
22 file://0001-Intialize-struct-elements-by-name.patch \ 22 file://0001-Intialize-struct-elements-by-name.patch \
23 file://arping-fix-arping-hang-if-SIGALRM-is-blocked.patch \
23 " 24 "
24 25
25SRC_URI[md5sum] = "8aaa7395f27dff9f57ae016d4bc753ce" 26SRC_URI[md5sum] = "8aaa7395f27dff9f57ae016d4bc753ce"