Package: python-nfqueue
Version: 0.4-3
Severity: grave
Tags: patch

It seems package python-nfqueue included in Wheezy has changed the
call signature for the nfqueue callback function, breaking all programs
using the library, including the examples.

To reproduce, on a clean Wheezy machine:

a) install python-nfqueue:
# apt-get install python-nfqueue

b) create an iptables rule to queue all incoming ICMP pings to NFQUEUE number 0:
# iptables -t mangle -I PREROUTING -m icmp -p icmp --icmp-type 8 -j NFQUEUE 
--queue-num 0

c) Run one of the included examples:
# cd /usr/share/doc/python-nfqueue/examples
# apt-get install python-dpkt     # needed by the example
# ./example.py

d) then ping the host from a remote machine.
You'll see that calling the callback function fails with:
-- cut here --
# ./example.py
setting callback
open
trying to run
callback failure !
TypeError: cb() takes exactly 2 arguments (1 given)
callback failure !
TypeError: cb() takes exactly 2 arguments (1 given)
-- cut here --

The reason seems to be this commit:

-- cut here --
commit aa0e4e2b2ffd7848df9130e9eb5197797ba3363f
Author: Pierre Chifflier <chiffl...@edenwall.com>
Date:   Tue Aug 17 14:07:57 2010 +0200

    Fix memory leak in Python bindings

diff --git a/python/libnetfilter_queue_python.i 
b/python/libnetfilter_queue_python.i
index fa077b7..9b8b9c1 100644
--- a/python/libnetfilter_queue_python.i
+++ b/python/libnetfilter_queue_python.i
@@ -54,12 +54,9 @@ int  swig_nfq_callback(struct nfq_q_handle *qh, struct 
nfgenmsg *nfmsg,
                 p->id = id;
                 p->qh = qh;
                 p->nfad = nfad;
-                payload_obj = SWIG_NewPointerObj((void*) p, 
SWIGTYPE_p_payload, 1);
-                arglist = Py_BuildValue("(i,O)",42,payload_obj);
-                /*printf("will call python object\n");*/
+                payload_obj = SWIG_NewPointerObj((void*) p, 
SWIGTYPE_p_payload, 0 /* | SWIG_POINTER_OWN */);
+                arglist = Py_BuildValue("(N)",payload_obj);
                 result = PyEval_CallObject(func,arglist);
-                /*printf("result: %p\n", result);*/
-                free(p);
                 Py_DECREF(arglist);
                 if (result) {
                         Py_DECREF(result);
-- cut here --

Which modifies the call signature for the callback function, "(N)", vs. "(i,O").

After reverting the offending commit and rebuilding the debian package,
the example works properly:

-- cut here --
# ./example.py
setting callback
open
trying to run
python callback called !
  len 84 proto 1 src: xxx.xxx.x.xxx   dst yy.yyy.yyy.yy
-- cut here --

Marked bug as grave, since it makes all programs that depend on
python-nfqueue inoperable.

-- System Information:
Debian Release: 7.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-nfqueue depends on:
ii  libc6                2.13-38
ii  libnetfilter-queue1  0.0.17-1
ii  libnfnetlink0        1.0.0-1.1
ii  libpython2.6         2.6.8-1.1
ii  libpython2.7         2.7.3-6
ii  python               2.7.3-4
ii  python2.6            2.6.8-1.1
ii  python2.7            2.7.3-6

python-nfqueue recommends no packages.

python-nfqueue suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to