[packages] ptunnel: use network.sh to find device, remove iptables rules on stop added in start

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31970 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-29 01:19:54 +00:00
parent 88bac66cf0
commit 4997a53386
2 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2011 OpenWrt.org
# Copyright (C) 2006-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ptunnel
PKG_VERSION:=0.71
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=PingTunnel-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.cs.uit.no/~daniels/PingTunnel

View File

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org
# Copyright (C) 2007-2012 OpenWrt.org
START=70
@ -7,9 +7,7 @@ start_instance() {
local section="$1"
config_get interface "$section" interface
config_get ifname "$interface" ifname
[ -z "$ifname" ] && {
network_get_device ifname "$interface" || {
echo "${initscript}: Error: Interface '$interface' not found" 1>&2
return 1
}
@ -19,14 +17,14 @@ start_instance() {
}
start() {
include /lib/network
scan_interfaces
. /lib/functions/network.sh
config_load 'ptunnel'
config_foreach start_instance 'ptunnel'
iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null
iptables -I OUTPUT 1 -p icmp -j ACCEPT 2>/dev/null
}
stop() {
service_stop /usr/sbin/ptunnel
iptables -D OUTPUT -p icmp -j ACCEPT 2>/dev/null
}