2007-12-21 09:34:01 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2012-05-29 01:19:54 +00:00
|
|
|
# Copyright (C) 2007-2012 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
|
2012-05-29 01:19:54 +00:00
|
|
|
network_get_device ifname "$interface" || {
|
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() {
|
2012-05-29 01:19:54 +00:00
|
|
|
. /lib/functions/network.sh
|
2009-09-19 13:23:26 +00:00
|
|
|
|
2011-11-14 02:38:51 +00:00
|
|
|
config_load 'ptunnel'
|
|
|
|
config_foreach start_instance 'ptunnel'
|
2012-05-29 01:19:54 +00:00
|
|
|
iptables -I OUTPUT 1 -p icmp -j ACCEPT 2>/dev/null
|
2011-11-14 02:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
service_stop /usr/sbin/ptunnel
|
2012-05-29 01:19:54 +00:00
|
|
|
iptables -D OUTPUT -p icmp -j ACCEPT 2>/dev/null
|
2007-12-21 09:34:01 +00:00
|
|
|
}
|