aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2020-05-22 16:05:16 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2020-05-22 16:57:01 +0300
commit2593d8b2ac2f996396e0e074a6e2b702b696bb6b (patch)
tree9b5c3e16ea71643da574642b4d2b99e407f7d9c4
parentef7e395291df6aef426c3e76ce0cfe4d6a89f32f (diff)
downloaddmvpn-tools-2593d8b2ac2f996396e0e074a6e2b702b696bb6b.tar.gz
dmvpn-tools-2593d8b2ac2f996396e0e074a6e2b702b696bb6b.tar.bz2
dmvpn-tools-2593d8b2ac2f996396e0e074a6e2b702b696bb6b.tar.xz
setup-dmvpn: config file for shortcut route parametersHEADv1.4.0master
-rwxr-xr-xsetup-dmvpn28
1 files changed, 18 insertions, 10 deletions
diff --git a/setup-dmvpn b/setup-dmvpn
index 0ddc02b..ff8a924 100755
--- a/setup-dmvpn
+++ b/setup-dmvpn
@@ -23,16 +23,24 @@ done
NFLOG_GROUP=
if [ $VPNC_TYPE = hub ]; then
- ask "NFLOG group" 1
- NFLOG_GROUP=$resp
-
- ask "DMVPN site IPv4 prefix length" 16
- SITE_PREFIX_LEN_IPV4=$resp
-
- if [ "$GRE_IPV6_ADDRESS" ]; then
- ask "DMVPN site IPv6 prefix length" 48
- SITE_PREFIX_LEN_IPV6=$resp
- fi
+ CONF_FILE=/etc/dmvpn.conf
+ [ -e $CONF_FILE ] && . $CONF_FILE
+
+ get_param() {
+ eval "[ \"\$$1\" ]" && return
+ resp=
+ while ! expr "$resp" : '[1-9][0-9]\?[0-9]\?$' > /dev/null; do
+ ask "$2" $3
+ done
+ eval $1=$resp
+ echo $1=$resp >> $CONF_FILE
+ }
+
+ get_param NFLOG_GROUP "NFLOG group" 1
+ get_param SITE_PREFIX_LEN_IPV4 "DMVPN site IPv4 prefix length" 16
+ [ "$GRE_IPV6_ADDRESS" ] && \
+ get_param SITE_PREFIX_LEN_IPV6 "DMVPN site IPv6 prefix length" \
+ 48
fi