packages/net/ptunnel/files/ptunnel.init
nico ad04b648d1 packages/ptunnel: use new service functions
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29098 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-11-14 02:38:51 +00:00

33 lines
641 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org
START=70
start_instance() {
local section="$1"
config_get interface "$section" interface
config_get ifname "$interface" ifname
[ -z "$ifname" ] && {
echo "${initscript}: Error: Interface '$interface' not found" 1>&2
return 1
}
SERVICE_PID_FILE="/var/run/ptunnel.$ifname.pid"
service_start /usr/sbin/ptunnel -c "$ifname" -daemon $SERVICE_PID_FILE
}
start() {
include /lib/network
scan_interfaces
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
}