Merge branch 'CleanupTunnels' into release-3.15.1.0

various fixups to improve the quality of bringing tunnel's into mainline code
This commit is contained in:
Conrad Lara - KG6JEI 2015-05-24 15:18:54 -07:00
commit af1eaa1107
5 changed files with 50 additions and 35 deletions

View File

@ -106,8 +106,9 @@ apply_uci_config() {
}
start() {
# only if vtun is installed
if [[ -x "/usr/sbin/vtund" ]]
# only if vtun is installed and ind mesh mode
configmode=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
if [ -x "/usr/sbin/vtund" -a "$configmode" = "mesh" ]
then
apply_uci_config
config_load vtun

64
files/etc/init.d/vtundsrv Normal file → Executable file
View File

@ -97,36 +97,48 @@ apply_uci_config() {
}
start() {
apply_uci_config
config_load vtun
#if options section doesn't exist, add it
echo "testing for options..."
j=`uci get vtun.@options[0]`
if [ $? -ne 0 ]
then
j=`uci add vtun options`
j='uci commit vtun'
configmode=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
if [ -x "/usr/sbin/vtund" -a "$configmode" = "mesh" ]
then
apply_uci_config
config_load vtun
#if options section doesn't exist, add it
echo "testing for options..."
j=`uci get vtun.@options[0]`
if [ $? -ne 0 ]
then
j=`uci add vtun options`
j='uci commit vtun'
config_load vtun
fi
# Remove the current config files
mkdir -p /tmp/vtun
rm -f $SERVER_CONF
config_foreach network_config network
config_foreach options_config options "$SERVER_CONF"
config_foreach allowed_client_config client "$SERVER_CONF"
# START SERVER LISTENER
/usr/sbin/vtund -s -f $SERVER_CONF
fi
# Remove the current config files
mkdir -p /tmp/vtun
rm -f $SERVER_CONF
config_foreach network_config network
config_foreach options_config options "$SERVER_CONF"
config_foreach allowed_client_config client "$SERVER_CONF"
# START SERVER LISTENER
/usr/sbin/vtund -s -f $SERVER_CONF
}
stop() {
# find the vtund SERVER process... --- FIX THIS
for x in `ps -w|grep -F 'vtund[s]:'|grep -v grep|awk '{print $1}'`
do
s=`echo $s $x`
done
kill $s
# only if vtun is installed
if [ -x "/usr/sbin/vtund" ]
then
# find the vtund SERVER process... --- FIX THIS
for x in `ps -w|grep -F 'vtund[s]:'|grep -v grep|awk '{print $1}'`
do
s=`echo $s $x`
done
kill $s
fi
}

View File

@ -215,10 +215,6 @@ sub install_vtun
# allow port 5525 for server connections
open_5525_on_wan();
# enable init.d scripts
system("chmod +x /etc/init.d/vtundsrv");
system("chmod +x /etc/init.d/vtund");
# create UCI config file
system("touch /etc/config/vtun");
# create options section
@ -275,4 +271,4 @@ sub addrtoint { return( unpack( "N", pack( "C4", split( /[.]/,$_[0]))))};
sub inttoaddr { return( join( ".", unpack( "C4", pack( "N", $_[0]))))};
#weird uhttpd/busybox error requires a 1 at the end of this file
1
1

View File

@ -197,8 +197,8 @@ if($parms{button_save} and not @cli_err)
if (&uci_commit("vtun"))
{
push(@errors,"Problem committing UCI vtun");
system("cp -f /etc/config/vtun /etc/config.mesh");
}
system("cp -f /etc/config/vtun /etc/config.mesh");
unless($debug == 3)
{
# Regenerate olsrd files and restart olsrd
@ -214,6 +214,9 @@ if($parms{button_save} and not @cli_err)
http_header() unless $debug == 2;
html_header("$node setup", 1);
print "<body><center>\n";
alert_banner();
print "<form id=vpn method=post action=/cgi-bin/vpn enctype='multipart/form-data'>\n" unless $debug == 2;
print "<form method=post action=test>\n" if $debug == 2;
print "<table width=790>\n";

View File

@ -175,8 +175,8 @@ if($parms{button_save} and not @conn_err)
if (&uci_commit("vtun"))
{
push(@errors,"Problem committing UCI vtun");
system("cp -f /etc/config/vtun /etc/config.mesh");
}
system("cp -f /etc/config/vtun /etc/config.mesh");
unless($debug == 3)
{
# Regenerate olsrd files and restart olsrd
@ -193,6 +193,9 @@ http_header() unless $debug == 2;
html_header("$node setup", 1);
print "<body><center>\n";
alert_banner();
print "<form method=post action=/cgi-bin/vpnc enctype='multipart/form-data'>\n" unless $debug == 2;
print "<form method=post action=test>\n" if $debug == 2;
print "<table width=790>\n";