From 3e0efc974d3ef5f5d768def9ea151138b1ea443a Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net" Date: Sat, 12 Jan 2008 14:51:49 +0000 Subject: [PATCH 4/5] Workaround of recvfrom() EAGAIN bug This is a workaround which prevents ulogd from logging each time when recvfrom() returns error because of EAGAIN. Since the netlink socket is now O_NONBLOCK, we probably run into the following bug: http://bugzilla.kernel.org/show_bug.cgi?id=5498 which causes recvfrom() get an error when select() had a good return, whenever select() receives a packet with a bad checksum. ipulog_read() always has this problem once after every successful ipulog_read(). Signed-off-by: Peter Warasin [Note: this is not a workaround but correct handling of EAGAIN on a non-blocking socket. -Patrick] --- input/packet/ulogd_inppkt_ULOG.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'input/packet/ulogd_inppkt_ULOG.c') diff --git a/input/packet/ulogd_inppkt_ULOG.c b/input/packet/ulogd_inppkt_ULOG.c index 3a94700..cf44474 100644 --- a/input/packet/ulogd_inppkt_ULOG.c +++ b/input/packet/ulogd_inppkt_ULOG.c @@ -225,6 +225,8 @@ static int ulog_read_cb(int fd, unsigned int what, void *param) while ((len = ipulog_read(u->libulog_h, u->libulog_buf, upi->config_kset->ces[0].u.value, 1))) { if (len <= 0) { + if (errno == EAGAIN) + break; /* this is not supposed to happen */ ulogd_log(ULOGD_ERROR, "ipulog_read = %d! " "ipulog_errno = %d (%s), " -- cgit v1.2.3