usage: netcalc split [-h] NETWORK LENGTH [MAXLENGTH]

netcalc split: error: argument LENGTH: invalid int value: '172.31.16.0/21'
This commit is contained in:
sump pump 2020-06-21 03:52:29 +00:00
parent ee80d07fb6
commit f094a6e4cc
3 changed files with 21 additions and 5 deletions

View File

@ -10,3 +10,5 @@
${tld:-lixo} CNAME rpz-passthru.
*.${tld:-lixo} CNAME rpz-passthru.
{{ range "$root_reverse_zones" | split "," }}*.{{ . }} CNAME rpz-passthru.
{{ end }}

View File

@ -59,6 +59,14 @@ view "lixonet" {
forward only;
forwarders { ${bind_forward_address-"${internal_gateway}"}; };
};
# Local reverse zone forwarders
{{ if len "${local_reverse_zones:-}" }}{{ range "$local_reverse_zones" | split "," }}zone "{{ . }}" {
type forward;
forward only;
forwarders { ${bind_forward_address-"${internal_gateway}"}; };
};
{{ end }}{{ end }}
# Peer forwarding zones
{{ range files "bind/peers" }} {{ if ne . "${tinc_peer_name}" }}
@ -69,10 +77,10 @@ view "lixonet" {
};{{ end }}{{ end }}
# Custom mesh zones
{{ range files "bind/zones" }}
zone "{{ . | replace "_" "." }}" {
{{ range files "bind/zones" }}zone "{{ . | replace "_" "." }}" {
{{ include (print "bind/zones/" .) }}
};{{ end }}
};
{{ end }}
};
view "default" {

View File

@ -7,6 +7,8 @@ process_template ( ) {
rm $1
}
function join_by { local IFS="$1"; shift; echo "$*"; }
process_templates ( ) {
for template_filename in `find $1 -type f -name '*.tmpl'`
do
@ -18,8 +20,6 @@ topdir=`pwd`
for dir in `find /etc/lixonet/* -type d -maxdepth 0`
do
echo "Inspecting $dir..."
dir=${dir%*/} # remove the trailing "/"
netname=${dir##*/} # print everything after the final "/"
@ -29,6 +29,12 @@ do
if [ -z "$git" ]; then echo "Missing 'git' variable in $dir/lixonet.conf"; exit 1; fi
sigil_vars=$(cat /etc/lixonet/${netname}/lixonet.conf | tr "\\n" " ")
# Parse subnets into a collection of IP reverse zones
root_reverse_zones=$(echo '${network_address}/${global_prefix:-16}' | sigil -p $sigil_vars | xargs -I '{}' netcalc split {} 24 | sed 's/.0\/24$//' | awk 'BEGIN{FS="."}{print $3"."$2"."$1".in-addr.arpa"}' | sed -e ':a;N;$!ba;s/\n/,/g')
sigil_vars=$(echo "$sigil_vars root_reverse_zones=$root_reverse_zones")
local_reverse_zones=$(echo "$bgp_routes" | tr "," "\n" | xargs -I '{}' netcalc split {} 24 | sed 's/.0\/24$//' | awk 'BEGIN{FS="."}{print $3"."$2"."$1".in-addr.arpa"}' | sed -e ':a;N;$!ba;s/\n/,/g')
sigil_vars=$(echo "$sigil_vars local_reverse_zones=$local_reverse_zones")
echo "Configuring Lixonet3 network $netname from $git..."
echo "Variables: $sigil_vars"