[packages] sshtunnel: Add SSH VPN support

Signed-off-by: Henning Botha <hjbotha at gmail.com>


git-svn-id: svn://svn.openwrt.org/openwrt/packages@33857 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nunojpg 2012-10-19 11:01:50 +00:00
parent 243734b1df
commit ab05ace28a
2 changed files with 30 additions and 0 deletions

View File

@ -73,6 +73,24 @@ load_tunnelD() {
append_string "ARGS_tunnels" "-D $localaddress:$localport"
}
load_tunnelW() {
config_get section_server $1 server
[ "$server" = "$section_server" ] || return 0 # continue to read next section if this is not for the current server
let count++ # count nr of valid sections to make sure there are at least one
config_get localdev $1 localdev "*"
config_get remotedev $1 remotedev "*"
config_get vpntype $1 vpntype "*"
[ "$vpntype" == "ethernet" ] || [ "$vpntype" == "point-to-point" ] || append_string "error" "[tunnelW: $1] vpntype must be \"ethernet\" (tap) or \"pointopoint\" (tun)" "; "
[ "$localdev" == "any" ] || [ "$localdev" -ge 0 ] || append_string "error" "[tunnelW: $1] localdev must be an integer or \"any\"" "; "
[ "$remotedev" == "any" ] || [ "$remotedev" -ge 0 ] || append_string "error" "[tunnelW: $1] remotedev must be an integer or \"any\"" "; "
[ "$user" == "root" ] || logger -p user.warn -t "sshtunnel" "warning: root is required unless the tunnel device has been created manually"
[ -n "$error" ] && return 1
append_string "ARGS_tunnels" "-w $localdev:$remotedev -o Tunnel=$vpntype"
}
load_server() {
server="$1"

View File

@ -49,3 +49,15 @@
# option server disney
# option localaddress *
# option localport 4055
# tunnelW - creates TUN/TAP devices on client and server to establish a VPN tunnel between them
# vpntypes:
# point-to-point = TUN
# ethernet = TAP
#
#config tunnelW proxy
# option server disney
# option vpntype point-to-point|ethernet
# option localdev any|0|1|2|...
# option remotedev any|0|1|2|...