From c0a272653ce8a491e316a2f7f6a6740fb7f652c5 Mon Sep 17 00:00:00 2001 From: laforge Date: Thu, 19 Apr 2001 17:35:53 +0000 Subject: hidden goto in NLMSG_PUT caused 'Error building netlink message' errors. --- kernel/ipt_ULOG.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'kernel') diff --git a/kernel/ipt_ULOG.c b/kernel/ipt_ULOG.c index 7bacbf4..7bb78ef 100644 --- a/kernel/ipt_ULOG.c +++ b/kernel/ipt_ULOG.c @@ -9,7 +9,7 @@ * * Released under the terms of the GPL * - * $Id: ipt_ULOG.c,v 1.8 2001/01/30 11:54:14 laforge Exp $ + * $Id: ipt_ULOG.c,v 1.9 2001/02/10 10:17:50 laforge Exp $ */ #include @@ -25,6 +25,7 @@ #include #include #include +#include #include #define ULOG_NL_EVENT 111 /* Harald's favorite number */ @@ -79,7 +80,12 @@ static unsigned int ipt_ulog_target(struct sk_buff **pskb, * multipart message. WARNING: has to be <= 131000 * due to slab allocator restrictions */ nlskb = alloc_skb((max_qthresh * max_size), GFP_ATOMIC); - } else if (size > skb_tailroom(nlskb)) { + if (!nlskb) + printk("ipt_ULOG: unable to allocate %u*%u bytes!\n", + max_qthresh, max_size); + } + + if (size > skb_tailroom(nlskb)) { DEBUGP("ipt_ULOG: copy expand %d %d\n", skb_tailroom(nlskb), size); newskb = skb_copy_expand(nlskb, skb_headroom(nlskb), @@ -93,11 +99,9 @@ static unsigned int ipt_ulog_target(struct sk_buff **pskb, nlskb = newskb; } - if (!nlskb) - goto nlmsg_failure; - DEBUGP("ipt_ULOG: qlen %d, qthreshold %d\n", qlen, loginfo->qthreshold); + /* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ nlh = NLMSG_PUT(nlskb, 0, qlen, ULOG_NL_EVENT, size - sizeof(*nlh)); qlen++; @@ -230,7 +234,7 @@ static int __init init(void) /* FIXME: does anybody know an easy way to determine the biggest * MTU of all interfaces in the system ? */ - max_size = 1500; + max_size = NLMSG_SPACE(1514); return 0; } -- cgit v1.2.3