diff options
Diffstat (limited to 'meta/recipes-extended/watchdog/files')
-rw-r--r-- | meta/recipes-extended/watchdog/files/fix-ping-failure.patch | 65 | ||||
-rw-r--r-- | meta/recipes-extended/watchdog/files/fixsepbuild.patch | 27 |
2 files changed, 92 insertions, 0 deletions
diff --git a/meta/recipes-extended/watchdog/files/fix-ping-failure.patch b/meta/recipes-extended/watchdog/files/fix-ping-failure.patch new file mode 100644 index 0000000000..f5976eb5cf --- /dev/null +++ b/meta/recipes-extended/watchdog/files/fix-ping-failure.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | Fix ping mode failure | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | |||
5 | When watchdog works on ping mode, the system will be rebooted since | ||
6 | watchdog can not receive the expected ECOREPLY on a setting interval. | ||
7 | |||
8 | Ping mode uses a raw socket to send a ECO packet, then uses select() | ||
9 | to wait and recvfrom() to receive the ECOREPLY packet, if select() | ||
10 | shows the data is ready, and the data is not the expected ECOREPLY, | ||
11 | and waiting time is not overdue, it will continue use select() and | ||
12 | recvfrom(). | ||
13 | |||
14 | Problem is that the raw socket can receive any icmp packets, if we do | ||
15 | not set filters, and there are many icmp packets on socket, this | ||
16 | program will not find its interested ECOREPLY packet in a special | ||
17 | interval, which makes the ping mode fail. | ||
18 | |||
19 | |||
20 | Other program is that watchdog sometime can not reach the call of | ||
21 | recvfrom to try to receive packets since tv_sec of struct timeval | ||
22 | of select parameter is 0. | ||
23 | |||
24 | The timeout of select() is the result of ping interval minusing the | ||
25 | time of calling gettimeofday spending, when ping interval is 1 second, | ||
26 | and the call of gettimeofday() spends several useconds, the tv_sec of | ||
27 | struct timeval of select parameter must be 0, at that condition, we | ||
28 | should it is valid of tv_sec of struct timeval of select parameter be 0 | ||
29 | |||
30 | Signed-off-by: Roy.Li <rongqing.li@windriver.com> | ||
31 | --- | ||
32 | src/net.c | 2 +- | ||
33 | src/watchdog.c | 5 ++++- | ||
34 | 2 files changed, 5 insertions(+), 2 deletions(-) | ||
35 | |||
36 | Index: watchdog-5.13/src/watchdog.c | ||
37 | =================================================================== | ||
38 | --- watchdog-5.13.orig/src/watchdog.c 2013-02-01 03:15:44.000000000 -0800 | ||
39 | +++ watchdog-5.13/src/watchdog.c 2013-03-11 22:27:48.741657881 -0700 | ||
40 | @@ -28,6 +28,7 @@ | ||
41 | #include <sys/types.h> | ||
42 | #include <sys/ioctl.h> | ||
43 | #include <linux/oom.h> | ||
44 | +#include <linux/icmp.h> | ||
45 | #include <linux/watchdog.h> | ||
46 | #include <string.h> | ||
47 | |||
48 | @@ -567,6 +568,8 @@ | ||
49 | pid_t child_pid; | ||
50 | int oom_adjusted = 0; | ||
51 | struct stat s; | ||
52 | + struct icmp_filter filt; | ||
53 | + filt.data = ~(1<<ICMP_ECHOREPLY); | ||
54 | |||
55 | #if USE_SYSLOG | ||
56 | char *opts = "d:i:n:Ffsvbql:p:t:c:r:m:a:"; | ||
57 | @@ -703,7 +706,7 @@ | ||
58 | perror(progname); | ||
59 | exit(1); | ||
60 | } | ||
61 | - | ||
62 | + setsockopt(net->sock_fp, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)); | ||
63 | /* this is necessary for broadcast pings to work */ | ||
64 | (void) setsockopt(net->sock_fp, SOL_SOCKET, SO_BROADCAST, (char *)&hold, sizeof(hold)); | ||
65 | |||
diff --git a/meta/recipes-extended/watchdog/files/fixsepbuild.patch b/meta/recipes-extended/watchdog/files/fixsepbuild.patch new file mode 100644 index 0000000000..2fad3a112f --- /dev/null +++ b/meta/recipes-extended/watchdog/files/fixsepbuild.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | Fix out of tree build support: | ||
2 | |||
3 | | installing /etc/watchdog.conf | ||
4 | | /bin/mkdir -p '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man5' | ||
5 | | /bin/mkdir -p '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man8' | ||
6 | | /usr/bin/install -c -m 644 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/watchdog.conf.5 '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man5' | ||
7 | | /usr/bin/install -c -m 644 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/watchdog.8 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/wd_keepalive.8 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/wd_identify.8 '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man8' | ||
8 | | /usr/bin/install: cannot stat `watchdog.conf': No such file or directory | ||
9 | | make[2]: *** [install-etc-local] Error 1 | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | RP 2013/03/21 | ||
14 | |||
15 | Index: watchdog-5.13/Makefile.am | ||
16 | =================================================================== | ||
17 | --- watchdog-5.13.orig/Makefile.am 2013-02-01 11:15:44.000000000 +0000 | ||
18 | +++ watchdog-5.13/Makefile.am 2013-03-21 11:59:35.637139031 +0000 | ||
19 | @@ -16,7 +16,7 @@ | ||
20 | else \ | ||
21 | echo "installing $(CONFIG_FILENAME)"; \ | ||
22 | $(mkinstalldirs) `dirname $(DESTDIR)$(CONFIG_FILENAME)`; \ | ||
23 | - $(INSTALL_DATA) watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ | ||
24 | + $(INSTALL_DATA) $(srcdir)/watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ | ||
25 | fi | ||
26 | |||
27 | install-data-local: install-etc-local | ||