[packages] natpmp: use network.sh to find device names
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31976 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
debb9936a4
commit
635485f819
@ -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
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user