Commit cff2421e authored by Leigh B. Stoller's avatar Leigh B. Stoller

Named setup gets a serious collagen injection ... As per Mike/Rob

request, beef up named setup so that sites like DETER are handled
properly. I have added 4 new defs variables:

    #
    # If your boss/ops nodes are multihomed (and typically, one of the
    # networks is a public routable network, and the other is an internal
    # unroutable network), then define the the external addresses here (and
    # the internal addresses above).
    #
    EXTERNAL_BOSSNODE_IP=$BOSSNODE_IP
    EXTERNAL_USERNODE_IP=$USERNODE_IP

    #
    # As above, if you have internal and external networks, define the
    # external network here, and the internal network above.
    #
    EXTERNAL_TESTBED_NETWORK=$TESTBED_NETWORK
    EXTERNAL_TESTBED_NETMASK=$TESTBED_NETMASK

which if not set default to the internal values. When the external and
internal networks are different, generate two sets of reverse zone
files and two forward files (one internal and one external).
parent 818739da
...@@ -895,6 +895,10 @@ fi ...@@ -895,6 +895,10 @@ fi
...@@ -1141,6 +1145,18 @@ cat >> confdefs.h <<EOF ...@@ -1141,6 +1145,18 @@ cat >> confdefs.h <<EOF
EOF EOF
if test -z "$EXTERNAL_TESTBED_NETWORK"; then
EXTERNAL_TESTBED_NETWORK=$TESTBED_NETWORK
fi
if test -z "$EXTERNAL_TESTBED_NETMASK"; then
EXTERNAL_TESTBED_NETMASK=$TESTBED_NETMASK
fi
if test -z "$EXTERNAL_BOSSNODE_IP"; then
EXTERNAL_BOSSNODE_IP=$BOSSNODE_IP
fi
if test -z "$EXTERNAL_USERNODE_IP"; then
EXTERNAL_USERNODE_IP=$USERNODE_IP
fi
if test -z "$TBAUTHDOMAIN"; then if test -z "$TBAUTHDOMAIN"; then
TBAUTHDOMAIN=".$OURDOMAIN" TBAUTHDOMAIN=".$OURDOMAIN"
fi fi
...@@ -1374,7 +1390,7 @@ fi ...@@ -1374,7 +1390,7 @@ fi
# Check for the robot vision system dependencies. # Check for the robot vision system dependencies.
# #
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1378: checking how to run the C preprocessor" >&5 echo "configure:1395: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory. # On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then if test -n "$CPP" && test -d "$CPP"; then
CPP= CPP=
...@@ -1389,13 +1405,13 @@ else ...@@ -1389,13 +1405,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser, # On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. # not just through cpp.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1393 "configure" #line 1410 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
...@@ -1406,13 +1422,13 @@ else ...@@ -1406,13 +1422,13 @@ else
rm -rf conftest* rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp" CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1410 "configure" #line 1427 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
...@@ -1423,13 +1439,13 @@ else ...@@ -1423,13 +1439,13 @@ else
rm -rf conftest* rm -rf conftest*
CPP="${CC-cc} -nologo -E" CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1427 "configure" #line 1444 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
...@@ -1457,17 +1473,17 @@ for ac_hdr in linux/videodev.h ...@@ -1457,17 +1473,17 @@ for ac_hdr in linux/videodev.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1461: checking for $ac_hdr" >&5 echo "configure:1478: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1466 "configure" #line 1483 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -1500,7 +1516,7 @@ done ...@@ -1500,7 +1516,7 @@ done
# Extract the first word of "gtk-config", so it can be a program name with args. # Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2 set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1504: checking for $ac_word" >&5 echo "configure:1521: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
...@@ -1572,7 +1588,7 @@ fi ...@@ -1572,7 +1588,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh. # ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1576: checking for a BSD compatible install" >&5 echo "configure:1593: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
...@@ -1973,9 +1989,13 @@ s%@PLAB_ROOTBALL@%$PLAB_ROOTBALL%g ...@@ -1973,9 +1989,13 @@ s%@PLAB_ROOTBALL@%$PLAB_ROOTBALL%g
s%@PLAB_SLICEPREFIX@%$PLAB_SLICEPREFIX%g s%@PLAB_SLICEPREFIX@%$PLAB_SLICEPREFIX%g
s%@LINKTEST_NSPATH@%$LINKTEST_NSPATH%g s%@LINKTEST_NSPATH@%$LINKTEST_NSPATH%g
s%@TESTBED_NETWORK@%$TESTBED_NETWORK%g s%@TESTBED_NETWORK@%$TESTBED_NETWORK%g
s%@EXTERNAL_TESTBED_NETWORK@%$EXTERNAL_TESTBED_NETWORK%g
s%@TESTBED_NETMASK@%$TESTBED_NETMASK%g s%@TESTBED_NETMASK@%$TESTBED_NETMASK%g
s%@EXTERNAL_TESTBED_NETMASK@%$EXTERNAL_TESTBED_NETMASK%g
s%@BOSSNODE_IP@%$BOSSNODE_IP%g s%@BOSSNODE_IP@%$BOSSNODE_IP%g
s%@EXTERNAL_BOSSNODE_IP@%$EXTERNAL_BOSSNODE_IP%g
s%@USERNODE_IP@%$USERNODE_IP%g s%@USERNODE_IP@%$USERNODE_IP%g
s%@EXTERNAL_USERNODE_IP@%$EXTERNAL_USERNODE_IP%g
s%@CONTROL_ROUTER_IP@%$CONTROL_ROUTER_IP%g s%@CONTROL_ROUTER_IP@%$CONTROL_ROUTER_IP%g
s%@CONTROL_NETWORK@%$CONTROL_NETWORK%g s%@CONTROL_NETWORK@%$CONTROL_NETWORK%g
s%@CONTROL_NETMASK@%$CONTROL_NETMASK%g s%@CONTROL_NETMASK@%$CONTROL_NETMASK%g
......
...@@ -70,9 +70,13 @@ AC_SUBST(PLAB_ROOTBALL) ...@@ -70,9 +70,13 @@ AC_SUBST(PLAB_ROOTBALL)
AC_SUBST(PLAB_SLICEPREFIX) AC_SUBST(PLAB_SLICEPREFIX)
AC_SUBST(LINKTEST_NSPATH) AC_SUBST(LINKTEST_NSPATH)
AC_SUBST(TESTBED_NETWORK) AC_SUBST(TESTBED_NETWORK)
AC_SUBST(EXTERNAL_TESTBED_NETWORK)
AC_SUBST(TESTBED_NETMASK) AC_SUBST(TESTBED_NETMASK)
AC_SUBST(EXTERNAL_TESTBED_NETMASK)
AC_SUBST(BOSSNODE_IP) AC_SUBST(BOSSNODE_IP)
AC_SUBST(EXTERNAL_BOSSNODE_IP)
AC_SUBST(USERNODE_IP) AC_SUBST(USERNODE_IP)
AC_SUBST(EXTERNAL_USERNODE_IP)
AC_SUBST(CONTROL_ROUTER_IP) AC_SUBST(CONTROL_ROUTER_IP)
AC_SUBST(CONTROL_NETWORK) AC_SUBST(CONTROL_NETWORK)
AC_SUBST(CONTROL_NETMASK) AC_SUBST(CONTROL_NETMASK)
...@@ -276,6 +280,18 @@ fi ...@@ -276,6 +280,18 @@ fi
changequote([, ])dnl changequote([, ])dnl
AC_DEFINE_UNQUOTED(OURDOMAIN, "$OURDOMAIN") AC_DEFINE_UNQUOTED(OURDOMAIN, "$OURDOMAIN")
if test -z "$EXTERNAL_TESTBED_NETWORK"; then
EXTERNAL_TESTBED_NETWORK=$TESTBED_NETWORK
fi
if test -z "$EXTERNAL_TESTBED_NETMASK"; then
EXTERNAL_TESTBED_NETMASK=$TESTBED_NETMASK
fi
if test -z "$EXTERNAL_BOSSNODE_IP"; then
EXTERNAL_BOSSNODE_IP=$BOSSNODE_IP
fi
if test -z "$EXTERNAL_USERNODE_IP"; then
EXTERNAL_USERNODE_IP=$USERNODE_IP
fi
if test -z "$TBAUTHDOMAIN"; then if test -z "$TBAUTHDOMAIN"; then
TBAUTHDOMAIN=".$OURDOMAIN" TBAUTHDOMAIN=".$OURDOMAIN"
fi fi
......
...@@ -48,8 +48,12 @@ SSLCERT_ORGNAME="Utah Network Testbed" ...@@ -48,8 +48,12 @@ SSLCERT_ORGNAME="Utah Network Testbed"
# #
TESTBED_NETWORK=155.98.32.0 TESTBED_NETWORK=155.98.32.0
TESTBED_NETMASK=255.255.240.0 TESTBED_NETMASK=255.255.240.0
EXTERNAL_TESTBED_NETWORK=$TESTBED_NETWORK
EXTERNAL_TESTBED_NETMASK=$TESTBED_NETMASK
BOSSNODE_IP=155.98.32.70 BOSSNODE_IP=155.98.32.70
EXTERNAL_BOSSNODE_IP=$BOSSNODE_IP
USERNODE_IP=155.98.33.74 USERNODE_IP=155.98.33.74
EXTERNAL_USERNODE_IP=$USERNODE_IP
CONTROL_ROUTER_IP=155.98.36.1 CONTROL_ROUTER_IP=155.98.36.1
CONTROL_NETWORK=155.98.36.0 CONTROL_NETWORK=155.98.36.0
CONTROL_NETMASK=255.255.252.0 CONTROL_NETMASK=255.255.252.0
......
...@@ -102,12 +102,28 @@ SSLCERT_ORGNAME="Utah Network Testbed" ...@@ -102,12 +102,28 @@ SSLCERT_ORGNAME="Utah Network Testbed"
BOSSNODE_IP=155.98.32.70 BOSSNODE_IP=155.98.32.70
USERNODE_IP=155.98.33.74 USERNODE_IP=155.98.33.74
#
# If your boss/ops nodes are multihomed (and typically, one of the
# networks is a public routable network, and the other is an internal
# unroutable network), then define the the external addresses here (and
# the internal addresses above).
#
EXTERNAL_BOSSNODE_IP=$BOSSNODE_IP
EXTERNAL_USERNODE_IP=$USERNODE_IP
# #
# The overall control network range # The overall control network range
# #
TESTBED_NETWORK=155.98.32.0 TESTBED_NETWORK=155.98.32.0
TESTBED_NETMASK=255.255.240.0 TESTBED_NETMASK=255.255.240.0
#
# As above, if you have internal and external networks, define the
# external network here, and the internal network above.
#
EXTERNAL_TESTBED_NETWORK=$TESTBED_NETWORK
EXTERNAL_TESTBED_NETMASK=$TESTBED_NETMASK
# #
# The node control network segment. # The node control network segment.
# #
......
...@@ -12,18 +12,24 @@ SUBDIR = named ...@@ -12,18 +12,24 @@ SUBDIR = named
ETCDIR = /etc ETCDIR = /etc
NAMEDB_DIR = $(ETCDIR)/namedb NAMEDB_DIR = $(ETCDIR)/namedb
OURDOMAIN = @OURDOMAIN@ OURDOMAIN = @OURDOMAIN@
FORWARDERS = @NAMED_FORWARDERS@
# This is silly. Needs to be done properly. # This is silly. Needs to be done properly.
TESTBED_NETWORK = @TESTBED_NETWORK@ TESTBED_NETWORK = @TESTBED_NETWORK@
REVERSE_MAPNAME = $(subst .0,,$(TESTBED_NETWORK)) EXTERNAL_TESTBED_NETWORK = @EXTERNAL_TESTBED_NETWORK@
REVERSE_MAPNAME = $(subst .0,,$(TESTBED_NETWORK))
EXTERNAL_REVERSE_MAPNAME = $(subst .0,,$(EXTERNAL_TESTBED_NETWORK))
REVFILES = $(REVERSE_MAPNAME).db.head
ifneq ($(REVERSE_MAPNAME), $(EXTERNAL_REVERSE_MAPNAME))
REVFILES .= $(REVFILES) $(EXTERNAL_REVERSE_MAPNAME).db.head
endif
BOSSTOKEN = $(shell echo @BOSSNODE@ | sed -e 's/\..*//') BOSSTOKEN = $(shell echo @BOSSNODE@ | sed -e 's/\..*//')
USERTOKEN = $(shell echo @USERNODE@ | sed -e 's/\..*//') USERTOKEN = $(shell echo @USERNODE@ | sed -e 's/\..*//')
NAMED_FILES = named.conf.template named_makeconf \ NAMED_FILES = named.conf.template named_makeconf named_makerev reverse.head \
reverse.head resolv.conf localhost.rev forward.head \ resolv.conf localhost.rev forward.head named_makeforw \
$(REVERSE_MAPNAME).db.head $(OURDOMAIN).db.head \ $(REVFILES) $(OURDOMAIN).db.head $(OURDOMAIN).internal.db.head \
named.conf named.conf
include $(OBJDIR)/Makeconf include $(OBJDIR)/Makeconf
...@@ -35,16 +41,18 @@ all: $(NAMED_FILES) ...@@ -35,16 +41,18 @@ all: $(NAMED_FILES)
include $(TESTBED_SRCDIR)/GNUmakerules include $(TESTBED_SRCDIR)/GNUmakerules
# This file is just a copy for now. Ick. $(OURDOMAIN).db.head: forward.head named_makeforw
$(REVERSE_MAPNAME).db.head: reverse.head perl named_makeforw -external forward.head > $@
cat reverse.head | sed -e 's/$(REVERSE_MAPNAME)\.//' > $(REVERSE_MAPNAME).db.head
$(OURDOMAIN).db.head: forward.head $(OURDOMAIN).internal.db.head: forward.head named_makeforw
cat forward.head | sed -e 's/BOSSTOKEN/$(BOSSTOKEN)/' -e 's/USERTOKEN/$(USERTOKEN)/' > $(OURDOMAIN).db.head perl named_makeforw -internal forward.head > $@
named.conf: named.conf.template named_makeconf named.conf: named.conf.template named_makeconf
perl named_makeconf named.conf.template > named.conf perl named_makeconf named.conf.template > named.conf
$(REVFILES): reverse.head named_makerev
perl named_makerev reverse.head
# This is not a safe install target after initial install! # This is not a safe install target after initial install!
install: install:
echo "Are you sure you want to reinstall the namedb files!" echo "Are you sure you want to reinstall the namedb files!"
...@@ -53,10 +61,9 @@ install-real: resolv.conf \ ...@@ -53,10 +61,9 @@ install-real: resolv.conf \
$(NAMEDB_DIR)/named.conf \ $(NAMEDB_DIR)/named.conf \
$(NAMEDB_DIR)/localhost.rev \ $(NAMEDB_DIR)/localhost.rev \
$(NAMEDB_DIR)/$(OURDOMAIN).db.head \ $(NAMEDB_DIR)/$(OURDOMAIN).db.head \
$(NAMEDB_DIR)/reverse/$(REVERSE_MAPNAME).db.head $(NAMEDB_DIR)/$(OURDOMAIN).internal.db.head \
$(addprefix $(NAMEDB_DIR)/reverse/, $(REVFILES))
$(INSTALL_DATA) resolv.conf $(ETCDIR)/resolv.conf $(INSTALL_DATA) resolv.conf $(ETCDIR)/resolv.conf
-rm -rf $(NAMEDB_DIR)/$(OURDOMAIN).internal.db.head
ln -s $(OURDOMAIN).db.head $(NAMEDB_DIR)/$(OURDOMAIN).internal.db.head
clean: clean:
rm -f $(NAMED_FILES) rm -f $(NAMED_FILES)
......
...@@ -16,14 +16,14 @@ $TTL 30 ...@@ -16,14 +16,14 @@ $TTL 30
; '@OURDOMAIN@' is implied in the line below ; '@OURDOMAIN@' is implied in the line below
IN A @BOSSNODE_IP@ IN A %bossnode_ip%
IN MX 10 ops IN MX 10 ops
; Apparently, CNAME NS records are a bad idea - so, ns.emulab.net ; Apparently, CNAME NS records are a bad idea - so, ns.emulab.net
; and boss are both A records ; and boss are both A records
ns IN A @BOSSNODE_IP@ ns IN A %bossnode_ip%
boss IN A @BOSSNODE_IP@ boss IN A %bossnode_ip%
BOSSTOKEN IN A @BOSSNODE_IP@ %bossnode_ina%
IN MX 10 ops IN MX 10 ops
; CNAMEs for boss ; CNAMEs for boss
...@@ -32,8 +32,8 @@ db IN CNAME boss ...@@ -32,8 +32,8 @@ db IN CNAME boss
cvsup IN CNAME boss cvsup IN CNAME boss
; Plastic and names it is otherwise known as... ; Plastic and names it is otherwise known as...
ops IN A @USERNODE_IP@ ops IN A %usernode_ip%
USERTOKEN IN A @USERNODE_IP@ %usernode_ina%
IN MX 10 ops IN MX 10 ops
users IN CNAME ops users IN CNAME ops
fs IN CNAME ops fs IN CNAME ops
...@@ -42,7 +42,8 @@ ntp2 IN CNAME ops ...@@ -42,7 +42,8 @@ ntp2 IN CNAME ops
event-server IN CNAME ops event-server IN CNAME ops
; Routers interfaces in the various subnets ; Routers interfaces in the various subnets
private-router IN A @PRIVATE_ROUTER@ %private-router%
public-router IN A @PUBLIC_ROUTER@ %public-router%
control-router IN A @CONTROL_ROUTER_IP@ %control-router%
...@@ -66,9 +66,9 @@ view "external" { ...@@ -66,9 +66,9 @@ view "external" {
file "named.root"; file "named.root";
}; };
zone "%internal_network_dotted_reverse%.in-addr.arpa" in { zone "%external_network_dotted_reverse%.in-addr.arpa" in {
type master; type master;
file "reverse/%internal_network_dotted%.db"; file "reverse/%external_network_dotted%.db";
}; };
}; };
...@@ -22,10 +22,15 @@ sub usage { ...@@ -22,10 +22,15 @@ sub usage {
# #
# Configure variables # Configure variables
# #
my $TESTBED_NETWORK = "@TESTBED_NETWORK@"; my $TESTBED_NETWORK = "@TESTBED_NETWORK@";
my $TESTBED_NETMASK = "@TESTBED_NETMASK@"; my $TESTBED_NETMASK = "@TESTBED_NETMASK@";
my $BOSSNODE_IP = "@BOSSNODE_IP@"; my $EXTERNAL_TESTBED_NETWORK = "@EXTERNAL_TESTBED_NETWORK@";
my $USERNODE_IP = "@USERNODE_IP@"; my $EXTERNAL_TESTBED_NETMASK = "@EXTERNAL_TESTBED_NETMASK@";
my $BOSSNODE_IP = "@BOSSNODE_IP@";
my $USERNODE_IP = "@USERNODE_IP@";
my $EXTERNAL_BOSSNODE_IP = "@EXTERNAL_BOSSNODE_IP@";
my $EXTERNAL_USERNODE_IP = "@EXTERNAL_USERNODE_IP@";
my $CONTROL_ROUTER_IP = "@CONTROL_ROUTER_IP@"; my $CONTROL_ROUTER_IP = "@CONTROL_ROUTER_IP@";
my $CONTROL_NETWORK = "@CONTROL_NETWORK@"; my $CONTROL_NETWORK = "@CONTROL_NETWORK@";
my $CONTROL_NETMASK = "@CONTROL_NETMASK@"; my $CONTROL_NETMASK = "@CONTROL_NETMASK@";
...@@ -63,10 +68,22 @@ for (my $i = 0; $i < scalar(@NETMASKS); $i++) { ...@@ -63,10 +68,22 @@ for (my $i = 0; $i < scalar(@NETMASKS); $i++) {
last; last;
} }
} }
my $EXTERNAL_TESTBED_SLASH_NETMASK = "24";
for (my $i = 0; $i < scalar(@NETMASKS); $i++) {
my $foo = pack("N", $NETMASKS[$i]);
if ($EXTERNAL_TESTBED_NETMASK eq inet_ntoa($foo)) {
$EXTERNAL_TESTBED_SLASH_NETMASK = "$i";
last;
}
}
# This is for the dotted and reverse dotted notation needed for the # This is for the dotted and reverse dotted notation needed for the
# reverse maps. This is probably all wrong ... # reverse maps. This is probably all wrong ...
my ($a, $b, $c, $d) = ($TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/); my ($ia, $ib, $ic, $id) =
($TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ea, $eb, $ec, $ed) =
($EXTERNAL_TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
$infile = shift @ARGV || exit &usage; $infile = shift @ARGV || exit &usage;
...@@ -79,10 +96,16 @@ while (<IF>) { ...@@ -79,10 +96,16 @@ while (<IF>) {
print $1 . "${TESTBED_NETWORK}/${TESTBED_SLASH_NETMASK}" ."$3\n"; print $1 . "${TESTBED_NETWORK}/${TESTBED_SLASH_NETMASK}" ."$3\n";
} }
elsif ($2 eq "internal_network_dotted") { elsif ($2 eq "internal_network_dotted") {
print $1 . "${a}.${b}.${c}" . "$3\n"; print $1 . "${ia}.${ib}.${ic}" . "$3\n";
} }
elsif ($2 eq "internal_network_dotted_reverse") { elsif ($2 eq "internal_network_dotted_reverse") {
print $1 . "${c}.${b}.${a}" . "$3\n"; print $1 . "${ic}.${ib}.${ia}" . "$3\n";
}
elsif ($2 eq "external_network_dotted") {
print $1 . "${ea}.${eb}.${ec}" . "$3\n";
}
elsif ($2 eq "external_network_dotted_reverse") {
print $1 . "${ec}.${eb}.${ea}" . "$3\n";
} }
elsif ($2 eq "forwarders") { elsif ($2 eq "forwarders") {
if ($NAMED_FORWARDERS eq "") { if ($NAMED_FORWARDERS eq "") {
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
use Getopt::Std;
use Socket;
#
# named_makeconf - helper script to create named.conf file. The template
# looks like standard file, only with %token% strings that need to be
# replaced. See below.
#
sub usage {
print "Usage: $0 <templatefile>\n";
}
#
# Configure variables
#
my $OURDOMAIN = "@OURDOMAIN@";
my ($BOSSTOKEN) = ("@BOSSNODE@" =~ /^([-\w]+).*$/);
my ($USERTOKEN) = ("@USERNODE@" =~ /^([-\w]+).*$/);
my $TESTBED_NETWORK = "@TESTBED_NETWORK@";
my $TESTBED_NETMASK = "@TESTBED_NETMASK@";
my $EXTERNAL_TESTBED_NETWORK = "@EXTERNAL_TESTBED_NETWORK@";
my $EXTERNAL_TESTBED_NETMASK = "@EXTERNAL_TESTBED_NETMASK@";
my $BOSSNODE_IP = "@BOSSNODE_IP@";
my $USERNODE_IP = "@USERNODE_IP@";
my $EXTERNAL_BOSSNODE_IP = "@EXTERNAL_BOSSNODE_IP@";
my $EXTERNAL_USERNODE_IP = "@EXTERNAL_USERNODE_IP@";
my $CONTROL_ROUTER_IP = "@CONTROL_ROUTER_IP@";
my $CONTROL_NETWORK = "@CONTROL_NETWORK@";
my $CONTROL_NETMASK = "@CONTROL_NETMASK@";
my $PRIVATE_NETWORK = "@PRIVATE_NETWORK@";
my $PRIVATE_ROUTER = "@PRIVATE_ROUTER@";
my $PRIVATE_NETMASK = "@PRIVATE_NETMASK@";
my $PUBLIC_NETWORK = "@PUBLIC_NETWORK@";
my $PUBLIC_ROUTER = "@PUBLIC_ROUTER@";
my $PUBLIC_NETMASK = "@PUBLIC_NETMASK@";
my $NAMED_FORWARDERS = "@NAMED_FORWARDERS@";
# Testbed libraries.
use lib "@prefix@/lib";
use libdb;
sub isroutable($);
# This is for the dotted and reverse dotted notation needed for the
# reverse maps. This is probably all wrong ...
my ($ia, $ib, $ic, $id) =
($TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ea, $eb, $ec, $ed) =
($EXTERNAL_TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my $internal_forwfile = "${ia}.${ib}.${ic}.db.head";
my $external_forwfile = "${ea}.${eb}.${ec}.db.head";
my $internal_strings = "";
my $external_strings = "";
usage()
if (@ARGV != 2);
my $which = $ARGV[0];
my $infile = $ARGV[1];
open(IF,"<$infile") or
die("Unable to open $infile for reading\n");
while (<IF>) {
if (/^(.*)\%([-\w]*)\%(.*)$/) {
if ($2 eq "bossnode_ip") {
$internal_strings .= $1 . "$BOSSNODE_IP" . $3 . "\n";
$external_strings .= $1 . "$EXTERNAL_BOSSNODE_IP" . $3 . "\n";
}
elsif ($2 eq "usernode_ip") {
$internal_strings .= $1 . "$USERNODE_IP" . $3 . "\n";
$external_strings .= $1 . "$EXTERNAL_USERNODE_IP" . $3 . "\n";
}
elsif ($2 eq "usernode_ina") {
$internal_strings .=
"${USERTOKEN}\t\tIN\tA\t\t${USERNODE_IP}\n";
$external_strings .=
"${USERTOKEN}\t\tIN\tA\t\t${EXTERNAL_USERNODE_IP}\n";
}
elsif ($2 eq "bossnode_ina") {
$internal_strings .=
"${BOSSTOKEN}\t\tIN\tA\t\t${BOSSNODE_IP}\n";
$external_strings .=
"${BOSSTOKEN}\t\tIN\tA\t\t${EXTERNAL_BOSSNODE_IP}\n";
}
elsif ($2 eq "private-router") {
my $foo = "private-router\tIN\tA\t${PRIVATE_ROUTER}\n";
$internal_strings .= $foo;
$external_strings .= $foo
if (isroutable($PRIVATE_ROUTER));
}
elsif ($2 eq "public-router") {
my $foo = "public-router\tIN\tA\t${PUBLIC_ROUTER}\n";
$internal_strings .= $foo;
$external_strings .= $foo
if (isroutable($PUBLIC_ROUTER));
}
elsif ($2 eq "control-router") {
my $foo = "control-router\tIN\tA\t${CONTROL_ROUTER_IP}\n";
$internal_strings .= $foo;
$external_strings .= $foo
if (isroutable($CONTROL_ROUTER_IP));
}
else {
die("*** $0:\n".
" Unknown special tag in named template file!\n");
}
}
else {
# A regular line
$internal_strings .= $_;
$external_strings .= $_;
}
}
close(IF);
if ($which eq "-internal") {
print $internal_strings;
}
else {
print $external_strings;
}
exit(0);
#
# Is an IP routable?
#
sub isroutable($)
{
my ($IP) = @_;
my ($a,$b,$c,$d) = ($IP =~ /^(\d*)\.(\d*)\.(\d*)\.(\d*)/);
#
# These are unroutable:
# 10.0.0.0 - 10.255.255.255 (10/8 prefix)
# 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
# 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
#
# Easy tests.
return 0
if (($a eq "10") ||
($a eq "192" && $b eq "168"));
# Lastly
return 0
if (inet_ntoa((inet_aton($IP)