[packages] ptunnel: use network.sh to find device, remove iptables rules on stop...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:19:54 +0000 (01:19 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:19:54 +0000 (01:19 +0000)
SVN-Revision: 31970

net/ptunnel/Makefile
net/ptunnel/files/ptunnel.init

index 52e9558582e0a4a12ad749a1ec5c4d5f96b26570..d140d4a74c4c8c56320b94efdb3306521a601271 100644 (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
index 9524909b018c325b688ea485f28d0d765966c409..3b10d41d94d9a8ef90fda72751c5624137d11143 100644 (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
 }