Changeset 31976


Ignore:
Timestamp:
2012-05-29T03:47:57+02:00 (6 years ago)
Author:
jow
Message:

[packages] natpmp: use network.sh to find device names

Location:
packages/net/natpmp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • packages/net/natpmp/Makefile

    r31644 r31976  
    1010PKG_NAME:=natpmp 
    1111PKG_VERSION:=0.2.3 
    12 PKG_RELEASE:=4 
     12PKG_RELEASE:=5 
    1313 
    1414PKG_SOURCE_URL:=http://download.savannah.nongnu.org/releases/natpmp/ 
  • packages/net/natpmp/files/natpmp.init

    r31644 r31976  
    2323        config_foreach natpmp_config natpmp 
    2424 
    25         include /lib/network 
    26         scan_interfaces 
     25        . /lib/functions/network.sh 
    2726 
    2827        # Flush all the rules in the natpmp chain, or create it, if it doesn't exists. 
     
    3736        BIND_ARGS="" 
    3837        for IF in $PRIVATE_IFS; do 
    39                 config_get IF "$IF" ifname "$IF" 
     38                local dev 
     39                network_get_device dev "$IF" || dev="$IF" 
    4040 
    4141                # Get the IP address of this interface. 
    42                 ADDR=`$IP addr show dev $IF 2>/dev/null | grep "^ *inet .* $IF\$" | cut -d " " -f 6 | cut -d / -f 1` 
     42                ADDR=`$IP addr show dev $dev 2>/dev/null | grep "^ *inet .* $dev\$" | cut -d " " -f 6 | cut -d / -f 1` 
    4343                if [ -n "$ADDR" ] ; then 
    4444                        # Add the IP address to the argument list. 
    4545                        BIND_ARGS="$BIND_ARGS -a $ADDR" 
    4646                else 
    47                         echo "Could not get IP address of interface $IF. Skipping." >&2 
     47                        echo "Could not get IP address of interface $dev. Skipping." >&2 
    4848                fi 
    4949        done 
     
    5454        fi 
    5555 
    56         config_get PUBLIC_IF "$PUBLIC_IF" ifname "$PUBLIC_IF" 
     56        local pubdev 
     57        network_get_device pubdev "$PUBLIC_IF" || pubdev="$PUBLIC_IF" 
    5758 
    5859        SERVICE_PID_FILE="$PIDFILE" 
    59         service_start $NATPMP -i "$PUBLIC_IF" $BIND_ARGS -- "$IPTABLES_CHAIN" 
     60        service_start $NATPMP -i "$pubdev" $BIND_ARGS -- "$IPTABLES_CHAIN" 
    6061} 
    6162 
Note: See TracChangeset for help on using the changeset viewer.