Greylisting for qmail with IPv6 support

I have been using the greylisting implementation for qmail from
http://shupp.org/ which is based on the implementation for exim from
http://www.digitaleveryware.com/projects/greylisting/.

I wanted to add IPv6 support and found no references on the web
regarding greylisting and IPv6 (at least no implementation
mentioning IPv6).

PostgreSQL was selected as the database backend because of its builtin
support for the inet data type and accompanying functions.

With PostgreSQL it was an easy task to rewrite local_scan.c to support
IPv6. At least with qmail as sender_host_address is set to the value of
$TCPREMOTEIP which is either an IPv4 or IPv6 address. I do not know exim
and if exim does it the same way.

Even IPv4 benefits from using the inet data type of PostgreSQL
because of the CIDR support. Manual white or black listing entries now
are not limited to the class based approach of the MySQL
implementation any more.

See the below for my local_scan.c version and the database definition for PostgreSQL.
The executable has to be linked against libpq and not libmysqlclient,
i.e. you need to adjust the Makefile accordingly.

convert_relaydelay.py is a python script converting the MySQL database
into the PostgreSQL version.

I have also made a patch against netqmail-1.05 based on the patch from shupp.

It works for me, YMMV.

A qmail IPv6 patch can be found here: http://member.wide.ad.jp/~fujiwara/

A ucspi-tcp IPv6 patch can be found here: http://www.fefe.de/ucspi/

A rblsmtpd IPv6 patch can be found here: http://gurubert.de/qmail/rblsmtpd/IPv6

A djbdns IPv6 patch can be found here: http://www.fefe.de/dns/

AttachmentSize
netqmail-1.05-greylisting-ipv6-pgsql.patch21.02 KB
local_scan.c10.77 KB
convert_relaydelay.py.txt2.39 KB
dbdef_pg.sql.txt1.25 KB