2007-12-21 09:34:01 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2011-11-14 02:38:51 +00:00
|
|
|
# Copyright (C) 2007-2011 OpenWrt.org
|
2009-09-19 13:23:26 +00:00
|
|
|
|
2007-12-21 09:34:01 +00:00
|
|
|
START=70
|
|
|
|
|
2011-11-14 02:38:51 +00:00
|
|
|
start_instance() {
|
2009-09-19 13:23:26 +00:00
|
|
|
local section="$1"
|
|
|
|
|
|
|
|
config_get interface "$section" interface
|
|
|
|
config_get ifname "$interface" ifname
|
|
|
|
|
|
|
|
[ -z "$ifname" ] && {
|
2011-11-14 02:38:51 +00:00
|
|
|
echo "${initscript}: Error: Interface '$interface' not found" 1>&2
|
2009-09-19 13:23:26 +00:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2011-11-14 02:38:51 +00:00
|
|
|
SERVICE_PID_FILE="/var/run/ptunnel.$ifname.pid"
|
|
|
|
service_start /usr/sbin/ptunnel -c "$ifname" -daemon $SERVICE_PID_FILE
|
2008-01-10 18:25:04 +00:00
|
|
|
}
|
|
|
|
|
2011-11-14 02:38:51 +00:00
|
|
|
start() {
|
|
|
|
include /lib/network
|
|
|
|
scan_interfaces
|
2009-09-19 13:23:26 +00:00
|
|
|
|
2011-11-14 02:38:51 +00:00
|
|
|
config_load 'ptunnel'
|
|
|
|
config_foreach start_instance 'ptunnel'
|
|
|
|
iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
service_stop /usr/sbin/ptunnel
|
2007-12-21 09:34:01 +00:00
|
|
|
}
|