From 89d9bd38ade61fdbac692ce5b8ae9cb3c8f2cab2 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 10 Jan 2008 18:25:04 +0000 Subject: [PATCH] Apply ptunnel patches from #2884 SVN-Revision: 10160 --- net/ptunnel/Makefile | 2 ++ net/ptunnel/files/ptunnel.conf | 3 +++ net/ptunnel/files/ptunnel.init | 25 +++++++++++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 net/ptunnel/files/ptunnel.conf diff --git a/net/ptunnel/Makefile b/net/ptunnel/Makefile index d4aada558c..91764bb3e5 100644 --- a/net/ptunnel/Makefile +++ b/net/ptunnel/Makefile @@ -49,6 +49,8 @@ define Package/ptunnel/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ptunnel $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/ptunnel.init $(1)/etc/init.d/ptunnel + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/ptunnel.conf $(1)/etc/config/ptunnel endef $(eval $(call BuildPackage,ptunnel)) diff --git a/net/ptunnel/files/ptunnel.conf b/net/ptunnel/files/ptunnel.conf new file mode 100644 index 0000000000..35781f935e --- /dev/null +++ b/net/ptunnel/files/ptunnel.conf @@ -0,0 +1,3 @@ +config ptunnel + option interface 'br-lan' + \ No newline at end of file diff --git a/net/ptunnel/files/ptunnel.init b/net/ptunnel/files/ptunnel.init index da3b143372..f834bd49bb 100644 --- a/net/ptunnel/files/ptunnel.init +++ b/net/ptunnel/files/ptunnel.init @@ -1,14 +1,27 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2007 OpenWrt.org START=70 -STOP=70 +BIN=ptunnel start() { - iptables -I OUTPUT 1 -p icmp -j ACCEPT - ptunnel -v 1 -c br-lan + config_load ptunnel + config_foreach start_ptunnel ptunnel } - + +start_ptunnel() { + local section="$1" + + include /lib/network + scan_interfaces + + iptables -I OUTPUT 1 -p icmp -j ACCEPT + config_get interface "$section" interface + + $BIN -c "$interface" > /dev/null& +} + stop() { - killall ptunnel + ps aux | grep ptunnel | awk '{print }' | \ + xargs kill 2> /dev/null } - \ No newline at end of file + \ No newline at end of file -- 2.30.2