[PATCH] bind-sdb and notify

Pramberger Peter peter.pramberger at 1012surf.net
Tue Oct 18 09:25:37 UTC 2005


Pramberger Peter schrieb:
> None of these seems to be acceptable to me, so I started "playing around" in the
> bind sources. The result is attached to this post. Maybe someone can give some
> comments on it.

Ok, no attachment - inline:

------------------------------------------------------------------------
--- bind-9.3.1/lib/dns/zone.c.orig	2005-10-18 09:42:44.424073525 +0200
+++ bind-9.3.1/lib/dns/zone.c	2005-10-18 09:42:53.188785076 +0200
@@ -958,9 +958,41 @@ zone_load
 		 * version.bind. CH zone, a zone with a persistent
 		 * database being reloaded, or maybe a zone that
 		 * used to have a master file but whose configuration
-		 * was changed so that it no longer has one.  Do nothing.
+		 * was changed so that it no longer has one.
 		 */
 		result = ISC_R_SUCCESS;
+
+		if (dns_db_ispersistent(zone->db) &&
+		    zone->type == dns_zone_master) {
+			/*
+			 * The zone is a persistent master zone (maybe SDB).
+			 * Try to get its current serial number and compare
+			 * it to the current known serial number. If greater,
+			 * schedule a zone notify.
+			 */
+			isc_uint32_t serial;
+
+			if (ISC_R_SUCCESS !=
+			    dns_db_getsoaserial(zone->db, (void *) 0, &serial))
+				goto cleanup;
+
+			dns_zone_log(zone, ISC_LOG_DEBUG(1),
+				     "checking for update");
+
+			if (isc_serial_gt(serial, zone->serial)) {
+				dns_zone_log(zone, ISC_LOG_DEBUG(1),
+					     "has been updated (serial %i)",
+					     serial);
+
+				zone->serial = serial;
+				DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY);
+				zone_settimer(zone, &now);
+			}
+		}
+
+		/*
+		 * Do nothing.
+		 */
 		goto cleanup;
 	}

------------------------------------------------------------------------


Regards,
Peter



More information about the bind-users mailing list