]> mj.ucw.cz Git - nsc-5.git/commitdiff
Blackhole: One more rewrite
authorMartin Mares <mj@ucw.cz>
Sat, 15 Oct 2011 21:14:57 +0000 (23:14 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 15 Oct 2011 21:14:57 +0000 (23:14 +0200)
We generate the blackhole zone as any other zone, except that we
hack nsc.m4 to accept `SOA(@)', so that the same zone file can supply
all blackholed domains.

The consequence is that the blackhole zone is properly versioned
and BIND no longer complains that the SOA is the same, while the
file has changed its timestamp.

cf.dist/blackhole
m4/mkmf.m4
m4/nsc.m4

index ff70f2334f0ac2ce7ff108b893cc0c6bd0446ef9..8f303889911a7f26a2bd51e41e385104d9c54377 100644 (file)
@@ -1,8 +1,13 @@
-define(`DISABLE_LOCALHOST', 1)
-divert(0)dnl
 ; Recommended contents of blackhole zones as per RFC 6303
 ; However, we need to set the NS record to our address,
 ; since otherwise BIND complains.
 
 ; Recommended contents of blackhole zones as per RFC 6303
 ; However, we need to set the NS record to our address,
 ; since otherwise BIND complains.
 
-`@ 10800 IN SOA' NSNAME. nobody.invalid. 1 3600 1200 604800 10800
-`@ 10800 IN NS' NSNAME.
+define(`DISABLE_LOCALHOST', 1)
+define(`MAINTNAME', `nobody.invalid.')
+define(`REFRESH', 3600)
+define(`RETRY', 1200)
+define(`EXPIRE', 604800)
+define(`MINTTL', 10800)
+
+SOA(@)
+NS(NSNAME)
index bb65116baf1a03790c8e920fbfc73074bfac62a3..fd4ca8755a75c6fa2036492976b2bda5964ab712 100644 (file)
@@ -28,12 +28,12 @@ divert(-1)')
 
 # Last words
 
 
 # Last words
 
-define(`nsc_cleanup', `divert(0)VERSDIR/.version: CFDIR/domains ROOTCACHE`'PRIMARIES`'ifdef(`NEED_BLACKHOLE',` ZONEDIR/blackhole')
+define(`nsc_cleanup', `
+ifdef(`NEED_BLACKHOLE', `PRIMARY(blackhole)')
+
+divert(0)VERSDIR/.version: CFDIR/domains ROOTCACHE`'PRIMARIES`'ifdef(`NEED_BLACKHOLE',` ZONEDIR/blackhole')
        NAMED_RESTART_CMD
        touch VERSDIR/.version
        NAMED_RESTART_CMD
        touch VERSDIR/.version
-ifdef(`NEED_BLACKHOLE', `
-ZONEDIR/blackhole: CFDIR/blackhole $(DDEPS)
-       `$'(`M4') $(NSC) $< >`$'@
 ')dnl
 
 clean:
 ')dnl
 
 clean:
index 2baf29945bff900403f09b4dc3fe6221b3be9353..80d091e15e111f4e59e8ade983ef0febc5fb1681 100644 (file)
--- a/m4/nsc.m4
+++ b/m4/nsc.m4
@@ -8,7 +8,7 @@ include(m4/dnslib.m4)
 
 # Version number
 
 
 # Version number
 
-ifdef(`VERS',`
+ifdef(`VERS',`',`nsc_fatal_error(`VERS macro not defined')')
 
 define(TODAY_CODE, translit(esyscmd(`date +"%Y%m%d"'),`
 ',`'))
 
 define(TODAY_CODE, translit(esyscmd(`date +"%Y%m%d"'),`
 ',`'))
@@ -21,10 +21,6 @@ syscmd(echo >VERS "`define'(`LAST_TODAY_CODE',TODAY_CODE) `define'(`SUBVER_NUM',
 ifelse(eval(SUBVER_NUM > 99),1,`nsc_fatal_error(`Too many zone changes in a single day, you must tweak 'VERS` manually')')
 define(`VERSION',TODAY_CODE`'format(`%02d', SUBVER_NUM))
 
 ifelse(eval(SUBVER_NUM > 99),1,`nsc_fatal_error(`Too many zone changes in a single day, you must tweak 'VERS` manually')')
 define(`VERSION',TODAY_CODE`'format(`%02d', SUBVER_NUM))
 
-',`
-define(`VERSION', 1)
-')
-
 # Record names
 
 define(nsc_set_name, `define(`CURRENT_NAME', nsc_corr_dot($1))define(`PRINT_NAME', CURRENT_NAME)')
 # Record names
 
 define(nsc_set_name, `define(`CURRENT_NAME', nsc_corr_dot($1))define(`PRINT_NAME', CURRENT_NAME)')
@@ -34,12 +30,12 @@ define(nsc_abs_name, `ifelse(CURRENT_NAME, translit(CURRENT_NAME,.,:), CURRENT_N
 # SOA record
 
 define(nsc_SOA, `
 # SOA record
 
 define(nsc_SOA, `
-$ORIGIN CURRENT_DOMAIN
+ifelse(CURRENT_DOMAIN,@,`',$ORIGIN CURRENT_DOMAIN)
 $TTL   MINTTL
 nsc_emit_name  `SOA'   nsc_corr_dot(NSNAME) MAINTNAME (
                VERSION REFRESH RETRY EXPIRE MINTTL )')
 define(SOA, `ifdef(`CURRENT_DOMAIN',`ifdef(`REVERSE_MODE',,`nsc_fatal_error(`SOA record defined twice')')')dnl
 $TTL   MINTTL
 nsc_emit_name  `SOA'   nsc_corr_dot(NSNAME) MAINTNAME (
                VERSION REFRESH RETRY EXPIRE MINTTL )')
 define(SOA, `ifdef(`CURRENT_DOMAIN',`ifdef(`REVERSE_MODE',,`nsc_fatal_error(`SOA record defined twice')')')dnl
-define(`CURRENT_DOMAIN',$1.)dnl
+define(`CURRENT_DOMAIN',ifelse($1,@,@,$1.))dnl
 nsc_set_name(CURRENT_DOMAIN)dnl
 ifdef(`REVERSE_MODE',,`nsc_SOA')')
 
 nsc_set_name(CURRENT_DOMAIN)dnl
 ifdef(`REVERSE_MODE',,`nsc_SOA')')