changeset 1212:0e5d4b7fc3d8 draft

add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
author cathugger <cathugger@cock.li>
date Thu, 19 Jul 2018 14:05:14 +0000
parents 5caaf2a85956
children 4204875410e0
files db/ip/15/0A/0B/00/cidr db/ip/15/0A/0B/00/owner db/ip/15/0A/0B/cidr db/ip/15/0A/0B/owner db/ip/15/3F/46/cidr scripts/addmissingcidr.sh scripts/nameserver_autogen/bind_tld_zonefile.sh
diffstat 7 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/db/ip/15/0A/0B/00/cidr	Thu Jul 19 05:21:07 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-21.10.11.0/24
--- a/db/ip/15/0A/0B/00/owner	Thu Jul 19 05:21:07 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-abslimit
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/15/0A/0B/cidr	Thu Jul 19 14:05:14 2018 +0000
@@ -0,0 +1,1 @@
+21.10.11.0/24
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/15/0A/0B/owner	Thu Jul 19 14:05:14 2018 +0000
@@ -0,0 +1,1 @@
+abslimit
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/15/3F/46/cidr	Thu Jul 19 14:05:14 2018 +0000
@@ -0,0 +1,1 @@
+21.63.70.0/24
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/addmissingcidr.sh	Thu Jul 19 14:05:14 2018 +0000
@@ -0,0 +1,31 @@
+#!/bin/sh
+# adds missing ip/*/*/cidr entries
+
+cd db || exit 1
+cd ip || exit 1
+for a in *
+do
+	[ -e "$a" ] || continue
+	ia=$((0x$a)) || exit 1
+	cd "$a" || exit 1
+	for b in *
+	do
+		[ -e "$b" ] || continue
+		ib=$((0x$b)) || exit 1
+		cd "$b" || exit 1
+		for c in *
+		do
+			[ -e "$c" ] || continue
+			ic=$((0x$c)) || exit 1
+			cd "$c" || exit 1
+			if [ ! -e cidr ]
+			then
+				printf "%d.%d.%d.0/24\n" "$ia" "$ib" "$ic"> cidr
+				printf "ip/%s/%s/%s %d.%d.%d.0/24\n" "$a" "$b" "$c" "$ia" "$ib" "$ic" >&2
+			fi
+			cd ..
+		done
+		cd ..
+	done
+	cd ..
+done
--- a/scripts/nameserver_autogen/bind_tld_zonefile.sh	Thu Jul 19 05:21:07 2018 +0000
+++ b/scripts/nameserver_autogen/bind_tld_zonefile.sh	Thu Jul 19 14:05:14 2018 +0000
@@ -27,7 +27,7 @@
 cd "$RESDB_PATH/db/ip" || exit 1
 for PFX in $RDNS_PREFIX;do
  cd "$RESDB_PATH/db/ip/$PFX" 2>/dev/null || continue
- IP=$[0x$PFX]
+ IP=$((0x$PFX))
  DOM=$IP.in-addr.arpa
  RDNS_ZONEFILE="$ZONEFILE_DIR/$DOM"
  echo -n "generating IPv4 reverse lookup zonefile for $IP/8..." >&2
@@ -45,7 +45,7 @@
   a=$(basename $(dirname $i))
   b=$(basename $(dirname $(dirname $i)))
   c=$(basename $(dirname $(dirname $(dirname $i))))
-  ipv4=`printf "%d.%d" $[0x${b}] $[0x${c}]`
+  ipv4=`printf "%d.%d" $((0x$b)) $((0x$c))`
   printf "%-7s IN NS %s\n" $ipv4 ${f}.
  done >> "$RDNS_ZONEFILE".tmp
  mv -f "$RDNS_ZONEFILE".tmp "$RDNS_ZONEFILE"