All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libnfnetlink register callback
@ 2006-09-26  8:13 Maik Hentsche
  2006-10-02 13:10 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Maik Hentsche @ 2006-09-26  8:13 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libnfnetlink-0.0.16_callback_register.patch --]
[-- Type: text/x-patch; name="libnfnetlink-0.0.16_callback_register.patch", Size: 1548 bytes --]

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
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
--- libnfnetlink-0.0.16-pablo-r1/src/libnfnetlink.c	2006-09-04 20:33:39.000000000 +0200
+++ libnfnetlink-0.0.16-pablo-r1.new/src/libnfnetlink.c	2006-09-26 09:56:01.000000000 +0200
@@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libnfnetlink register callback
  2006-09-26  8:13 [PATCH] libnfnetlink register callback Maik Hentsche
@ 2006-10-02 13:10 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2006-10-02 13:10 UTC (permalink / raw)
  To: Maik Hentsche; +Cc: netfilter-devel

Hi Maik,

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

Maik Hentsche wrote:
> 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.

-- 
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-02 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-26  8:13 [PATCH] libnfnetlink register callback Maik Hentsche
2006-10-02 13:10 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.