summaryrefslogtreecommitdiffstats
path: root/libipulog
diff options
context:
space:
mode:
authorlaforge <laforge>2003-11-14 19:19:59 +0000
committerlaforge <laforge>2003-11-14 19:19:59 +0000
commit668af39752e5972e1c9a54b0506aa289c41d3f4e (patch)
treee6b8b020fe527b27ffc38cde54210725f16acb9c /libipulog
parent09e799fde246b50d94e81753ed87f2ea59677f45 (diff)
check if messages are really coming from kernel (nl_pid == 0)
Diffstat (limited to 'libipulog')
-rw-r--r--libipulog/libipulog.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libipulog/libipulog.c b/libipulog/libipulog.c
index 0b82fee..b396829 100644
--- a/libipulog/libipulog.c
+++ b/libipulog/libipulog.c
@@ -1,5 +1,5 @@
/*
- * libipulog.c, $Revision: 1.10 $
+ * libipulog.c, $Revision: 1.11 $
*
* netfilter ULOG userspace library.
*
@@ -21,7 +21,7 @@
* This library is still under development, so be aware of sudden interface
* changes
*
- * $Id: libipulog.c,v 1.10 2002/07/30 07:04:12 laforge Exp $
+ * $Id: libipulog.c,v 1.11 2003/05/04 10:00:10 laforge Exp $
*/
#include <stdlib.h>
@@ -78,24 +78,24 @@ ipulog_netlink_recvfrom(const struct ipulog_handle *h,
addrlen = sizeof(h->peer);
status = recvfrom(h->fd, buf, len, 0, (struct sockaddr *)&h->peer,
&addrlen);
- if (status < 0)
- {
+ if (status < 0) {
ipulog_errno = IPULOG_ERR_RECV;
return status;
}
- if (addrlen != sizeof (h->peer))
- {
+ if (addrlen != sizeof (h->peer)) {
ipulog_errno = IPULOG_ERR_RECV;
return -1;
}
- if (status == 0)
- {
+ if (h->peer.nl_pid != 0) {
+ ipulog_errno = IPULOG_ERR_RECV;
+ return -1;
+ }
+ if (status == 0) {
ipulog_errno = IPULOG_ERR_NLEOF;
return -1;
}
nlh = (struct nlmsghdr *)buf;
- if (nlh->nlmsg_flags & MSG_TRUNC || status > len)
- {
+ if (nlh->nlmsg_flags & MSG_TRUNC || status > len) {
ipulog_errno = IPULOG_ERR_TRUNC;
return -1;
}