From b97cb8bb1b9e9885ab980aaf6d61a06d7676b0f4 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 15 Oct 2011 23:14:57 +0200 Subject: [PATCH] Blackhole: One more rewrite 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 | 13 +++++++++---- cf.ucw/blackhole | 13 +++++++++---- m4/mkmf.m4 | 8 ++++---- m4/nsc.m4 | 10 +++------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/cf.dist/blackhole b/cf.dist/blackhole index ff70f23..8f30388 100644 --- a/cf.dist/blackhole +++ b/cf.dist/blackhole @@ -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. -`@ 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) diff --git a/cf.ucw/blackhole b/cf.ucw/blackhole index ff70f23..8f30388 100644 --- a/cf.ucw/blackhole +++ b/cf.ucw/blackhole @@ -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. -`@ 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) diff --git a/m4/mkmf.m4 b/m4/mkmf.m4 index bb65116..fd4ca87 100644 --- a/m4/mkmf.m4 +++ b/m4/mkmf.m4 @@ -28,12 +28,12 @@ divert(-1)') # 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 -ifdef(`NEED_BLACKHOLE', ` -ZONEDIR/blackhole: CFDIR/blackhole $(DDEPS) - `$'(`M4') $(NSC) $< >`$'@ ')dnl clean: diff --git a/m4/nsc.m4 b/m4/nsc.m4 index 2baf299..80d091e 100644 --- a/m4/nsc.m4 +++ b/m4/nsc.m4 @@ -8,7 +8,7 @@ include(m4/dnslib.m4) # Version number -ifdef(`VERS',` +ifdef(`VERS',`',`nsc_fatal_error(`VERS macro not defined')') 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)) -',` -define(`VERSION', 1) -') - # 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, ` -$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 -define(`CURRENT_DOMAIN',$1.)dnl +define(`CURRENT_DOMAIN',ifelse($1,@,@,$1.))dnl nsc_set_name(CURRENT_DOMAIN)dnl ifdef(`REVERSE_MODE',,`nsc_SOA')') -- 2.39.5