diff options
author | anonimal <anonimal@i2pmail.org> | 2017-06-28 21:07:24 +0000 |
---|---|---|
committer | anonimal <anonimal@i2pmail.org> | 2018-03-18 15:52:19 +0000 |
commit | 84c5a9ba481d7a33cc0fd0ca43867b61d127d907 (patch) | |
tree | f05d3d3f107da02005b4a61f0e5074c113a7165c /external/unbound/contrib/build-unbound-localzone-from-hosts.pl | |
parent | Merge pull request #3416 (diff) | |
download | monero-84c5a9ba481d7a33cc0fd0ca43867b61d127d907.tar.xz |
Unbound: remove unbound from in-tree source
We'll instead use a git submodule to pull from our unbound repo.
Diffstat (limited to 'external/unbound/contrib/build-unbound-localzone-from-hosts.pl')
-rw-r--r-- | external/unbound/contrib/build-unbound-localzone-from-hosts.pl | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/external/unbound/contrib/build-unbound-localzone-from-hosts.pl b/external/unbound/contrib/build-unbound-localzone-from-hosts.pl deleted file mode 100644 index c11bbc330..000000000 --- a/external/unbound/contrib/build-unbound-localzone-from-hosts.pl +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/perl -WT - -use strict; -use warnings; - -my $hostsfile = '/etc/hosts'; -my $localzonefile = '/etc/unbound/localzone.conf.new'; - -my $localzone = 'example.com'; - -open( HOSTS,"<${hostsfile}" ) or die( "Could not open ${hostsfile}: $!" ); -open( ZONE,">${localzonefile}" ) or die( "Could not open ${localzonefile}: $!" ); - -print ZONE "server:\n\n"; -print ZONE "local-zone: \"${localzone}\" transparent\n\n"; - -my %ptrhash; - -while ( my $hostline = <HOSTS> ) { - - # Skip comments - if ( $hostline !~ "^#" and $hostline !~ '^\s+$' ) { - - my @entries = split( /\s+/, $hostline ); - - my $ip; - - my $count = 0; - foreach my $entry ( @entries ) { - if ( $count == 0 ) { - $ip = $entry; - } else { - - if ( $count == 1) { - - # Only return localhost for 127.0.0.1 and ::1 - if ( ($ip ne '127.0.0.1' and $ip ne '::1') or $entry =~ 'localhost' ) { - if ( ! defined $ptrhash{$ip} ) { - $ptrhash{$ip} = $entry; - print ZONE "local-data-ptr: \"$ip $entry\"\n"; - } - } - - } - - # Use AAAA for IPv6 addresses - my $a = 'A'; - if ( $ip =~ ':' ) { - $a = 'AAAA'; - } - - print ZONE "local-data: \"$entry ${a} $ip\"\n"; - - } - $count++; - } - print ZONE "\n"; - - - } -} - - - - -__END__ - |