]> granicus.if.org Git - pdns/commitdiff
implement RFC1982 serial number arithmetic in zone slaving engine (already!) problem...
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 22 Mar 2011 08:27:01 +0000 (08:27 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 22 Mar 2011 08:27:01 +0000 (08:27 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2077 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/slavecommunicator.cc

index 53ac6615f9fada8ab08a9d9ab3aa794aa42c8ed7..a03308c434a536fc4f1fe06798ec967e0d48af22 100644 (file)
 #include <boost/scoped_ptr.hpp>
 using boost::scoped_ptr;
 
+template<typename T> bool rfc1982LessThan(T a, T b)
+{
+  return ((signed)(a - b)) < 0;
+}
+
 void CommunicatorClass::addSuckRequest(const string &domain, const string &master, bool priority)
 {
   Lock l(&d_lock);
@@ -349,7 +354,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
       continue;
     uint32_t theirserial = ssr.d_freshness[di.id].theirSerial, ourserial = di.serial;
     
-    if(theirserial < ourserial) {
+    if(rfc1982LessThan(theirserial, ourserial)) {
       L<<Logger::Error<<"Domain "<<di.zone<<" more recent than master, our serial " << ourserial << " > their serial "<< theirserial << endl;
       di.backend->setFresh(di.id);
     }