summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch')
-rw-r--r--meta/recipes-extended/iputils/files/arping-fix-arping-hang-if-SIGALRM-is-blocked.patch44
1 files changed, 44 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 }