]> mj.ucw.cz Git - nsc-5.git/commitdiff
Rewritten blackhole zones
authorMartin Mares <mj@ucw.cz>
Sat, 15 Oct 2011 20:43:41 +0000 (22:43 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 15 Oct 2011 20:43:41 +0000 (22:43 +0200)
It turned out that if we follow RFC 6303, BIND complains about invalid
NS records. So let them point to our address instead.

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

index e410064223d6eeb942f4025c159862574728c637..521c51d87134a272952c87a61362de27bf08c215 100644 (file)
@@ -1,4 +1,7 @@
+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 @ nobody.invalid. 1 3600 1200 604800 10800
-@ 10800 IN NS @
+@ 10800 IN SOA NSNAME nobody.invalid. 1 3600 1200 604800 10800
+@ 10800 IN NS NSNAME
index ced7cd26ab0245c2b32b237244d0a7af8c607452..bb65116baf1a03790c8e920fbfc73074bfac62a3 100644 (file)
@@ -19,6 +19,8 @@ define(`PRIMARIES', PRIMARIES ZONEDIR/nsc_file_name($1))
 
 define(`REVERSE', `PRIMARY(nsc_if_v6($1,`nsc_revblock6($1)',`nsc_revaddr($1)'), shift($@))')
 
+define(`BLACKHOLE', `define(`NEED_BLACKHOLE', 1)')
+
 # Insertion of raw makefile material
 
 define(`MAKEFILE', `divert(0)$1
@@ -26,9 +28,13 @@ divert(-1)')
 
 # Last words
 
-define(`nsc_cleanup', `divert(0)VERSDIR/.version: CFDIR/domains ROOTCACHE`'PRIMARIES
+define(`nsc_cleanup', `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:
        find BAKDIR ZONEDIR -maxdepth 1 -type f | xargs rm -f
index 05a73245959120ed6466c014206fc02022470107..2baf29945bff900403f09b4dc3fe6221b3be9353 100644 (file)
--- a/m4/nsc.m4
+++ b/m4/nsc.m4
@@ -1,6 +1,6 @@
 dnl ###
 dnl ### NSC -- Zone File Generator
-dnl ### (c) 1997--2008 Martin Mares <mj@ucw.cz>
+dnl ### (c) 1997--2011 Martin Mares <mj@ucw.cz>
 dnl ###
 dnl ### Usage: m4 -DVERS=path-to-version-file nsc.m4 domain-source-files >zone-file
 dnl ###
@@ -8,7 +8,7 @@ include(m4/dnslib.m4)
 
 # Version number
 
-ifdef(`VERS',`',`nsc_fatal_error(`VERS macro not defined')')
+ifdef(`VERS',`
 
 define(TODAY_CODE, translit(esyscmd(`date +"%Y%m%d"'),`
 ',`'))
@@ -21,6 +21,10 @@ 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)')