183
182
print_dns_v4_rev($host, $ipv4);
184
183
print_dns_v6_rev($host, $ipv6addr);
185
184
if ($CONFVER eq "2") {
186
@fw4rules = parse_fw_rules($fw4str);
187
@fw6rules = parse_fw_rules($fw6str);
188
print_fw($FW4, $ipv4, $FW4_CMD, @fw4rules);
189
print_fw($FW6, $ipv6, $FW6_CMD, @fw6rules);
185
@fw4rules = parse_fw_rules($fw4str);
186
@fw6rules = parse_fw_rules($fw6str);
187
print_fw($FW4, $ipv4, $FW4_CMD, @fw4rules);
188
print_fw($FW6, $ipv6, $FW6_CMD, @fw6rules);
282
282
open $DNSREV6, "> $OUTDIR/$DNS_v6_REV_FILENAME" or
283
283
die "FATAL: Could not open $OUTDIR/$DNS_v6_REV_FILENAME for writing\n";
284
284
push @fhandles, $DNSREV6;
286
if ($CONFVER eq "2") {
287
open $FW4, "> $OUTDIR/$FW_v4_FILENAME" or
288
die "FATAL: Could not open $OUTDIR/$FW_v4_FILENAME for writing\n";
289
push @fhandles, $FW4;
291
open $FW6, "> $OUTDIR/$FW_v6_FILENAME" or
292
die "FATAL: Could not open $OUTDIR/$FW_v6_FILENAME for writing\n";
293
push @fhandles, $FW6;
296
286
foreach (@IPv4_REV_ZONES) {
297
287
my ($zone,$fn) = split(/:/, $_);
298
288
open $DNSREV4{$zone}, "> $OUTDIR/$fn" or
303
293
# @fhandles now contains all DNS/Bind related filehandles we will ever
304
294
# have open. So print a nice message to each file reminding the user
305
# not to mess with the automaticly gernated file!
295
# not to mess with the automatically generated file!
306
296
foreach (@fhandles) {
307
print $_ "; AUTOMATICLY GENERATED FILE -- DO NOT EDIT\n";
308
print $_ "; I REALLY MEAN DO NOT EDIT!!\n";
297
print $_ "; $autowarn\n";
311
300
foreach (@DHCP_REALMS) {
312
301
my ($realm,$fn) = split(/:/, $_);
313
302
open $DHCP_CONF{$realm}, "> $OUTDIR/$fn" or
314
die "FATAL: Could not open $OUTDIR/$fn for writing\n";
303
die "FATAL: Could not open $OUTDIR/$fn for writing\n";
315
304
my $tmpfh = $DHCP_CONF{$realm};
316
print $tmpfh "# AUTOMATICLY GENERATED FILE -- DO NOT EDIT\n";
317
print $tmpfh "# I REALLY MEAN DO NOT EDIT!!\n";
305
print $tmpfh "# $autowarn\n";
318
306
push @fhandles, $DHCP_CONF{$realm};
309
if ($CONFVER eq "2") {
310
open $FW4, "> $OUTDIR/$FW_v4_FILENAME" or
311
die "FATAL: Could not open $OUTDIR/$FW_v4_FILENAME for writing\n";
312
print $FW4 "# $autowarn\n";
313
push @fhandles, $FW4;
315
open $FW6, "> $OUTDIR/$FW_v6_FILENAME" or
316
die "FATAL: Could not open $OUTDIR/$FW_v6_FILENAME for writing\n";
317
print $FW6 "# $autowarn\n";
318
push @fhandles, $FW6;
320
321
return @fhandles;
389
390
$revaddr = `ipv6calc --in ipv6addr $ipv6addr --out revnibbles.arpa`;
391
392
if ($revaddr =~ /^([a-fA-F0-9]\.){32}ip6.arpa.$/ ) {
392
# each 4 Bits of the address is 2 characters wide (nibble + dot)
393
# therefor: the number of nibbles we need is (128-prefixlen)/4
394
# then multiply with two to account for the dot
395
# then subtract 1 to get rid of the trailing dot.
396
$revaddr = substr($revaddr, 0, (128-$PREFIXLEN)/2-1);
397
print $DNSREV6 "$revaddr\tIN PTR\t$host.$DOMAIN.\n";
393
# each 4 Bits of the address is 2 characters wide (nibble + dot)
394
# therefore: the number of nibbles we need is (128-prefixlen)/4
395
# then multiply with two to account for the dot
396
# then subtract 1 to get rid of the trailing dot.
397
$revaddr = substr($revaddr, 0, (128-$PREFIXLEN)/2-1);
398
print $DNSREV6 "$revaddr\tIN PTR\t$host.$DOMAIN.\n";
399
400
else { # ipv6calc returned bogus data
400
401
print STDERR "ERROR: ipv6calc generated stupid results for host $host (reverse entry)\n";