fix variable bugs master
authorIan Kelling <iank@fsf.org>
Fri, 18 Oct 2019 14:21:59 +0000 (10:21 -0400)
committerIan Kelling <iank@fsf.org>
Fri, 18 Oct 2019 14:21:59 +0000 (10:21 -0400)
vpn-server-setup

index a311ba8..1224ff2 100755 (executable)
@@ -193,11 +193,17 @@ push "dhcp-option DNS 10.8.0.1"
 EOF
 fi
 
-if $ip6; then
+if [[ $ip6 ]]; then
   cat >>$server_dir/server.conf <<EOF
 push tun-ipv6 # legacy option that flidas needs, has no harm.
-ifconfig-ipv6 $ip6 $ip6_route
+ifconfig-ipv6 $ip6 $ip6route
 EOF
+
+  sed -i --follow-symlinks '/^ *net.ipv6.conf.all.forwarding=.*/d' /etc/sysctl.conf
+  cat >>/etc/sysctl.conf <<'EOF'
+net.ipv6.conf.all.forwarding=1
+EOF
+
 fi
 
 
@@ -206,7 +212,7 @@ if $route; then
 # Be the default gateway for clients.
 push "redirect-gateway def1"
 EOF
-  if $ip6; then
+  if [[ $ip6 ]]; then
     cat >>$server_dir/server.conf <<'EOF'
 push "route-ipv6 2000::/3"
 EOF
@@ -214,10 +220,8 @@ EOF
 fi
 
 sed -i --follow-symlinks '/^ *net\.ipv4\.ip_forward=.*/d' /etc/sysctl.conf
-sed -i --follow-symlinks '/^ *net.ipv6.conf.all.forwarding=.*/d' /etc/sysctl.conf
 cat >>/etc/sysctl.conf <<'EOF'
 net.ipv4.ip_forward=1
-net.ipv6.conf.all.forwarding=1
 EOF
 sysctl -p /etc/sysctl.conf