[Pdns-users] Patch for gmysql and gpgsql - change_date = serial when serial = 0
ajlong at worldlink.net
Mon Mar 28 01:33:58 UTC 2005
I have noticed numerous posts regarding people having the same issue I have
regarding PowerDNS's generic mysql backend
not using the change_date column properly when the serial is set to 0 in the
SOA content column.
I have created a patch to fix this.
This patch is developed for and tested on PowerDNS 2.9.17
It implements the missing functionality in the gmysql and gpgsql modules
that existed in the older depreciated pdnsmysql backend.
Whereby the server would first look to the SOA record's content column to
find the serial number for a specific domain.
If the serial was set to 0 there, it would then select all records for all
qtypes for that particular domain_id and do an internal list comparison on
the last_modified (change_date) field for each one to determine the greatest
It would then use this number as a serial for the response.
If there was no change_date field specified or it was set to <= 0 it would
then fall back and use a unix timestamp as the serial number.
I think someone simply forgot to add this feature to the new gsql backends
since the last_modified value was simply hard coded to 0.
It was a rather easy fix. I will submit this patch to the developers for
This patch has been tested and is working in a production environment using
the patched gmysql module.
Now I just set all my SOA content records = "ns1.worldlink.net
dnsadmin.worldlink.net 0 300 600 86400 300"
and I set my serial numbers in the change_date column.
You could further automate this scenario by changing the sql type of the
change_date column to a TIMESTAMP value and
using a custom SQL query in your configuration as follows.
gmysql-list-query = "select content,ttl,prio,type,domain_id,name,MID(0,10,
change_date+0) from records where domain_id='%d' "
or something similar (*note this I have not tested)
USING THE PATCH is pretty straight forward.
1.) cd /usr/src
2.) wget http://downloads.powerdns.com/releases/pdns-2.9.17.tar.gz
3.) tar zxf pdns-2.9.17.tar.gz
5.) patch -p0 < ./pdns-gsql-change_date_eq_serial-1.0.patch
6.) cd pdns-2.9.17
7.) ./configure . etc. make & make install as normal
If you have any questions or comments please feel free to give me a shout...
ajlong AT worldlink.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pdns-users