Setup of Devuan name server sub system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
657 B

#!/usr/bin/awk -f
# Process zone file for listing all ipv6 revDNS split into 3 columnes:
# <file:hostname> <host_part> <block/64 part>
#
# Usage: ip6arpa zonefile* | column -t
# or: ip6arpa <(echo check AAAA 2001:41d0:8:732b::3624:8eb6)
#
$1 ~/^[;#]/ || $0 !~ / AAAA / || $NF !~ /:/{next;}
{
NX=split( $NF, X, ":" );
R=""
for ( n=1; n<=NX; n++) {
if ( X[n] == "" ) for ( m=NX; m <= 8; m++ ) R=R "0000"
else R=R substr("0000",0,4-length(X[n])) X[n] ;
}
BLK=""
HST=""
for (n=16;n>0;n--) BLK=BLK substr(R,n,1) ".";
for (n=32;n>17;n--) HST=HST substr(R,n,1) ".";
printf "%s %s%s %sip6.arpa\n",FILENAME ":" $1,HST,substr(R,17,1),BLK;
}