Skip to contentSkip to conversation

libnfnetlink register callback

PATCH In review Maik Hentsche 2 participants 2 messages Sep 26, 2006 – Oct 2, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libnfnetlink register callback

Hi pablo, hello readers of the list!
I found, that nfnl_callback_register() and nfnl_callback_unregister() in libnfnetlink do not behave as documented. Instead of returning -1 and setting errno, they return -EINVAL without setting errno at all. Find a patch attached, that changes this behaviour. The patch has been build and
tested with the unofficial libnfnetlink-0.0.16-pablo-r1 only, but the previous version 0.0.16 also has this bug and therefore, it should also apply there.

so long
Maik

Binary files libnfnetlink-0.0.16-pablo-r1/src/.libs/libnfnetlink.a and libnfnetlink-0.0.16-pablo-r1.new/src/.libs/libnfnetlink.a differ Binary files libnfnetlink-0.0.16-pablo-r1/src/.libs/libnfnetlink.o and libnfnetlink-0.0.16-pablo-r1.new/src/.libs/libnfnetlink.o differ Binary files libnfnetlink-0.0.16-pablo-r1/src/.libs/libnfnetlink.so and libnfnetlink-0.0.16-pablo-r1.new/src/.libs/libnfnetlink.so differ Binary files libnfnetlink-0.0.16-pablo-r1/src/.libs/libnfnetlink.so.1 and libnfnetlink-0.0.16-pablo-r1.new/src/.libs/libnfnetlink.so.1 differ Binary files libnfnetlink-0.0.16-pablo-r1/src/.libs/libnfnetlink.so.1.0.0 and libnfnetlink-0.0.16-pablo-r1.new/src/.libs/libnfnetlink.so.1.0.0 differ

src/libnfnetlink.c +8 -4
diff -U 3 -b -B -d -i -r -N -x .svn -- libnfnetlink-0.0.16-pablo-r1/src/libnfnetlink.c libnfnetlink-0.0.16-pablo-r1.new/src/libnfnetlink.c
@@ -1050,8 +1050,10 @@
 	assert(ssh);
 	assert(cb);
 
-	if (type >= ssh->cb_count)
-		return -EINVAL;
+	if (type >= ssh->cb_count){
+		errno=EINVAL;
+		return -1;
+	}
 
 	memcpy(&ssh->cb[type], cb, sizeof(*cb));
 
@@ -1070,8 +1072,10 @@
 {
 	assert(ssh);
 
-	if (type >= ssh->cb_count)
-		return -EINVAL;
+	if (type >= ssh->cb_count){
+		errno=EINVAL;
+		return -1;
+	}
 
 	ssh->cb[type].call = NULL;
 

Binary files libnfnetlink-0.0.16-pablo-r1/src/libnfnetlink.o and libnfnetlink-0.0.16-pablo-r1.new/src/libnfnetlink.o differ

#1 lore raw

Hi Maik,

Sorry for the late reply, I've been overloaded with work.

Quoted 9 lines · Maik Hentsche

Hi pablo, hello readers of the list!
I found, that nfnl_callback_register() and nfnl_callback_unregister() in libnfnetlink do not behave as documented. Instead of returning -1 and setting errno, they return -EINVAL without setting errno at all. Find a patch attached, that changes this behaviour. The patch has been build and
tested with the unofficial libnfnetlink-0.0.16-pablo-r1 only, but the previous version 0.0.16 also has this bug and therefore, it should also apply there.

I'll add this to my tree including the appropiate credits, I'm periodically posting the patch to the list in the hope that it will be applied to mainline.

Signature · 2 lines
The dawn of the fourth age of Linux firewalling is coming; a time of
great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris