Handling of zone transfers and notify messages
Miek Gieben
miekg at atoom.net
Tue Oct 19 10:21:47 UTC 2004
[On 19 Oct, @ 12:07, Måns wrote in "Re: Handling of zone transfers ..."]
> This is a good summary.
>
> While we are summarizing, zonec must also bypass broken data as defined
> above, dealing with it as defined above, but not have one such broken zone
> show-stop the entire NSD instance. (Yeah, I know, I wrote exactly that in
> my last mail but I find it missing above. Sorry for the repetititititions.)
the following patch for nsdc.sh.in does the following:
* it axfr's the zone - if this fails it emits a warning
* then it tries to compile to the zone - if this fails another warning
is given
If both the axfr & compilation have completed succesfully then the
database for nsd is rebuild. In all other cases the current version
of the zones/database is used.
Note1: each zone that is axfr-ed is compiled twice
Note2: aux. files are used: $zone.axfr (for the axfr) and
$zone.axfr.db for the test compile
Index: nsdc.sh.in
===================================================================
RCS file: /cvs/nsd/nsdc.sh.in,v
retrieving revision 1.31
retrieving revision 1.30.2.2
diff -u -r1.31 -r1.30.2.2
--- nsdc.sh.in 28 Jul 2004 11:52:31 -0000 1.31
+++ nsdc.sh.in 19 Oct 2004 10:00:40 -0000 1.30.2.2
@@ -3,6 +3,7 @@
# nsdc.sh -- a shell script to manage the beast
#
# Alexis Yushin, <alexis at nlnetlabs.nl>
+# Miek Gieben, <miekg at nlnetlabs.nl>
#
# Copyright (c) 2001-2004, NLnet Labs. All rights reserved.
#
@@ -69,7 +70,6 @@
#
# You sure heard this many times before: NO USER SERVICEABLE PARTS BELOW
#
-
signal() {
if [ -s ${pidfile} ]
then
@@ -133,7 +133,28 @@
tsiginfoarg="-T ${keysdir}/${masters}.tsiginfo.$$"
fi
- $namedxfer -z $zone -f ${zonesdir}/$file ${tsiginfoarg} -s $serial $masters
+ # AXFR to a temp file $file.axfr
+ $namedxfer -z $zone -f ${zonesdir}/$file.axfr ${tsiginfoarg} -s $serial $masters
+ if [ $? -ne 0 ]
+ then
+ if [ -f ${zonesdir}/$file.axfr ]
+ then
+ # axfr succeeded
+ # test compile the zone to see what happens
+ cat ${zonesdir}/$file.axfr | ${sbindir}/zonec -o ${zone} -f ${zonesdir}/$file.axfr.db - 2>/dev/null
+ if [ $? -eq 1 ]
+ then
+ echo "Warning: AXFR of $zone did not compile"
+ rm -f ${zonesdir}/$file.axfr
+ else
+ # we succeed
+ mv -f ${zonesdir}/$file.axfr ${zonesdir}/$file
+ fi
+ rm -f ${zonesdir}/$file.axfr.db
+ else
+ echo "Warning: AXFR for $zone failed"
+ fi
+ fi
# Do we need to rebuild the database?
if [ ${zonesdir}/$file -nt ${dbfile} ]
More information about the nsd-users
mailing list