From: Jo-Philipp Wich Date: Tue, 29 May 2012 01:47:57 +0000 (+0000) Subject: [packages] natpmp: use network.sh to find device names X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=f27bbbe42a0cd2d5ac4a3876e1001038f879b691;p=openwrt%2Fsvn-archive%2Farchive.git [packages] natpmp: use network.sh to find device names SVN-Revision: 31976 --- diff --git a/net/natpmp/Makefile b/net/natpmp/Makefile index 4bb496ef48..c936359d85 100644 --- a/net/natpmp/Makefile +++ b/net/natpmp/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=natpmp PKG_VERSION:=0.2.3 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE_URL:=http://download.savannah.nongnu.org/releases/natpmp/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/net/natpmp/files/natpmp.init b/net/natpmp/files/natpmp.init index 3b4bba2457..374e3648f5 100644 --- a/net/natpmp/files/natpmp.init +++ b/net/natpmp/files/natpmp.init @@ -22,8 +22,7 @@ start() { config_load natpmp config_foreach natpmp_config natpmp - include /lib/network - scan_interfaces + . /lib/functions/network.sh # Flush all the rules in the natpmp chain, or create it, if it doesn't exists. $IPTABLES -t nat -F $IPTABLES_CHAIN 2>/dev/null || \ @@ -36,15 +35,16 @@ start() { # Iterate through the private interfaces. BIND_ARGS="" for IF in $PRIVATE_IFS; do - config_get IF "$IF" ifname "$IF" + local dev + network_get_device dev "$IF" || dev="$IF" # Get the IP address of this interface. - ADDR=`$IP addr show dev $IF 2>/dev/null | grep "^ *inet .* $IF\$" | cut -d " " -f 6 | cut -d / -f 1` + ADDR=`$IP addr show dev $dev 2>/dev/null | grep "^ *inet .* $dev\$" | cut -d " " -f 6 | cut -d / -f 1` if [ -n "$ADDR" ] ; then # Add the IP address to the argument list. BIND_ARGS="$BIND_ARGS -a $ADDR" else - echo "Could not get IP address of interface $IF. Skipping." >&2 + echo "Could not get IP address of interface $dev. Skipping." >&2 fi done @@ -53,10 +53,11 @@ start() { exit 1 fi - config_get PUBLIC_IF "$PUBLIC_IF" ifname "$PUBLIC_IF" + local pubdev + network_get_device pubdev "$PUBLIC_IF" || pubdev="$PUBLIC_IF" SERVICE_PID_FILE="$PIDFILE" - service_start $NATPMP -i "$PUBLIC_IF" $BIND_ARGS -- "$IPTABLES_CHAIN" + service_start $NATPMP -i "$pubdev" $BIND_ARGS -- "$IPTABLES_CHAIN" } stop() {