From 41a122cff3fb71db617f5d7ffd2eef2c15fe4328 Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 3 Feb 2001 18:38:31 +0000 Subject: fixes _severe_ libipulog bug --- libipulog/libipulog.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libipulog') diff --git a/libipulog/libipulog.c b/libipulog/libipulog.c index 4aa12e5..0d4b9fb 100644 --- a/libipulog/libipulog.c +++ b/libipulog/libipulog.c @@ -1,5 +1,5 @@ /* - * libipulog.c, $Revision: 1.5 $ + * libipulog.c, $Revision: 1.6 $ * * netfilter ULOG userspace library. * @@ -9,7 +9,7 @@ * This library is still under development, so be aware of sudden interface * changes * - * $Id: libipulog.c,v 1.5 2000/09/22 06:57:16 laforge Exp $ + * $Id: libipulog.c,v 1.6 2001/01/30 09:28:04 laforge Exp $ */ #include @@ -213,8 +213,10 @@ ulog_packet_msg_t *ipulog_get_packet(struct ipulog_handle *h, } } else { /* we are in n-th part of multilink message */ - if (h->last_nlhdr->nlmsg_type == NLMSG_DONE) { - /* if last part in multilink message, return */ + if (h->last_nlhdr->nlmsg_type == NLMSG_DONE || + !(h->last_nlhdr->nlmsg_flags & NLM_F_MULTI)) { + /* if last part in multilink message, + * or no multipart message at all: return */ h->last_nlhdr = NULL; return NULL; } @@ -225,10 +227,7 @@ ulog_packet_msg_t *ipulog_get_packet(struct ipulog_handle *h, nlh = NLMSG_NEXT(h->last_nlhdr, remain_len); } - /* update last_nlhdr field */ - if (nlh->nlmsg_flags & NLM_F_MULTI) { - h->last_nlhdr = nlh; - } + h->last_nlhdr = nlh; return NLMSG_DATA(nlh); } -- cgit v1.2.3