watchdog: fix ping mode failure
authorRoy.Li <rongqing.li@windriver.com>
Wed, 18 Jul 2012 01:41:43 +0000 (09:41 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 18 Jul 2012 13:57:27 +0000 (14:57 +0100)
commit0d420309abadbfb2b18932fc5539aaecde878553
tree857408c698c035292ea3c52e4adf17f41a2bf980
parentc94e2ca34a6e94cf3b50eb6290d867bfa209b3e5
watchdog: fix ping mode failure

[YOCTO #2755]

When watchdog works on ping mode, the system will be rebooted since
watchdog can not receive the expected ECOREPLY on a setting interval.

Ping mode uses a raw socket to send a ECO packet, then uses select()
to wait and recvfrom() to receive the ECOREPLY packet, if select()
shows the data is ready, and the data is not the expected ECOREPLY,
and waiting time is not overdue, it will continue use select() and
recvfrom().

Problem is that the raw socket can receive any icmp packets, if we do
not set filters, and there are many icmp packets on socket, this
program will not find its interested ECOREPLY packet in a special
interval, which makes the ping mode fail.

Other program is that watchdog sometime can not reach the call of
recvfrom to try to receive packets since tv_sec of struct timeval
of select parameter is 0.

The timeout of select() is the result of ping interval minusing the
time of calling gettimeofday spending, when ping interval is 1 second,
and the call of gettimeofday() spends several useconds, the tv_sec of
struct timeval of select parameter must be 0, at that condition, we
should think it is valid of tv_sec of struct timeval of select parameter
be 0

(From OE-Core rev: 90f3a90413aa1e08c3206b838dcaee0c1c640dc7)

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/watchdog/files/fix-ping-failure.patch [new file with mode: 0644]
meta/recipes-extended/watchdog/watchdog_5.11.bb