UsualCoding.eu

To content | To menu | To search

Tag - patches

Entries feed - Comments feed

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:

Friday, June 8 2007

Patching Around

The new pam_usb release has a new feature called the pamusb agent. It is basically a python daemon that you can run in your user session. It allows you to execute all kinds of events when your key is plugged in or out.
What I wanted was a small notification to know when I’m authenticated. Unfortunately there is nothing as cool as GROWL on Linux (as far as I know) so I decided to add a small tray icon to the pamusb agent.

If you are interested you can find the patched version here:

Currently it is just GTK because I already had some code lying around but I’ll add a QT version later.
This thing gave me some ideas like adding a notification bubble and a small graphical interface to add & remove events. Maybe later…

This also reminds me that I have a small patch for Trac lying around.
Sometimes you want to use Trac as a private project management system denying access to anyone except registered users.

This patch allows you to release some pages as public ones by adding “Public” to the page name (example: “TestPublic”).
You can find it here