initial commit of file from CVS for smeserver-openvpn-s2s on Sat Sep 7 19:57:57 AEST 2024
This commit is contained in:
46
root/etc/openvpn/s2s/bin/up
Normal file
46
root/etc/openvpn/s2s/bin/up
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2010 Firewall Services
|
||||
# Daniel Berteaud <daniel@firewall-services.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Support up to 20 remote networks (should be enough)
|
||||
|
||||
for N in $(seq 1 20); do
|
||||
net="route_network_$N"
|
||||
mask="route_netmask_$N"
|
||||
if [ ! -z "${!net}" ]; then
|
||||
db=$(/sbin/e-smith/db networks getprop ${!net} VPN)
|
||||
if [ ! -z $db ]; then
|
||||
# if the network already exists in the DB, just push the route
|
||||
/sbin/route add -net ${!net} netmask ${!mask} gw $ifconfig_remote
|
||||
else
|
||||
/sbin/e-smith/db networks set ${!net} network Mask ${!mask} Router $ifconfig_remote VPN $vpnid Removable no
|
||||
/sbin/e-smith/signal-event network-create ${!net}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Check route for the VPN itself
|
||||
db=$(/sbin/e-smith/db networks getprop $ifconfig_remote VPN)
|
||||
if [ -z $db ]; then
|
||||
/sbin/e-smith/db networks set $ifconfig_remote network Mask 255.255.255.255 VPN $vpnid Removable no
|
||||
/sbin/e-smith/signal-event network-create $ifconfig_remote
|
||||
fi
|
||||
|
Reference in New Issue
Block a user