UsualCoding.eu

To content | To menu | To search

Tag - python

Entries feed - Comments feed

Monday, July 14 2008

Python on OpenWrt Kamikaze 7.09

It is not possible to install python on OpenWrt Kamikaze 7.09 because it depends on libreadline which is not available in the repositories for now.
There is a simple workaround:

  • Install the libreadline from 7.06 (brcm47xx-2.6 for mipsel and atheros-2.6 for mips)
   # ipkg install http://downloads.openwrt.org/kamikaze/7.06/brcm47xx-2.6/packages/libreadline_5.1-1_mipsel.ipk
  • Install python
   # ipkg install python

I tested this on the au1000 7.09 build. It should work on other mipsel and mips builds and on 7.07.

Monday, July 7 2008

NFQueue python bingings

A few month ago I needed python bindings for the nfqueue netfilter library (libnetfilter_queue).

I was going to write them myself since I found none, but then I stumbled across this on the netfilter mailing list.

I like this wrapper because it is simple and the code is clear. I was able to adapt my work to them very quickly.

There were some little problems though.


First of all the unchanged code cannot be used in multithreaded programs (see http://www.python.org/doc/api/threads.html).

So I wrote a little patch which adds the necessary Py_BEGIN_ALLOW_THREADS and a "stop" function to stop the queue.

The code can be found here:


The second problem appears only on Linux >=2.6.23 (see http://www.spinics.net/lists/netfilter/msg42063.html).

Here is the patch:


Special thanks to Mathieu Geli for this wrapper, it helped me a lot and saved time in my work.

By the way, I found new nfqueue bindings based on SWIG that look nice. They are brand new, but I haven't tested them yet.

Links: