package: replace ifconfig-usage with ip
authorSteven Barth <cyrus@openwrt.org>
Tue, 8 Sep 2015 17:44:24 +0000 (17:44 +0000)
committerSteven Barth <cyrus@openwrt.org>
Tue, 8 Sep 2015 17:44:24 +0000 (17:44 +0000)
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 46832

package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
package/kernel/hostap-driver/files/lib/wifi/hostap.sh
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
package/kernel/trelay/files/trelay.init
package/network/config/swconfig/files/switch.sh
package/network/services/openvpn/Makefile
package/utils/admswconfig/files/admswswitch.sh

index 859fca1bb1d3e63e8a22e93d47cd6c042f3ece8c..a9c4de22e9f47de5e0d5b423e9622d8a298e6fa3 100644 (file)
@@ -101,7 +101,7 @@ disable_broadcom() {
                for dev in /sys/class/net/wds${device##wl}-* /sys/class/net/${device}-* /sys/class/net/${device}; do
                        if [ -e "$dev" ]; then
                                ifname=${dev##/sys/class/net/}
-                               ifconfig "$ifname" down
+                               ip link set dev "$ifname" down
                                unbridge "$ifname"
                        fi
                done
@@ -372,8 +372,8 @@ enable_broadcom() {
                local if_cmd="if_pre_up"
                [ "$ifname" != "${ifname##${device}-}" ] && if_cmd="if_up"
                append $if_cmd "macaddr=\$(wlc ifname '$ifname' cur_etheraddr)" ";$N"
-               append $if_cmd "ifconfig '$ifname' \${macaddr:+hw ether \$macaddr}" ";$N"
-               append if_up "ifconfig '$ifname' up" ";$N"
+               append $if_cmd "ip link set dev '$ifname' address \$macaddr" ";$N"
+               append if_up "ip link set dev '$ifname' up" ";$N"
 
                local net_cfg="$(find_net_config "$vif")"
                [ -z "$net_cfg" ] || {
index 62d2e7e472f1a128b56b2e685080537b74dd52cf..e35b76c0fd37b4be5881a95a63ea735e5cd69be1 100755 (executable)
@@ -78,7 +78,7 @@ disable_prism2() (
                set $line
                [ -f "/var/run/wifi-${1}.pid" ] &&
                        kill "$(cat "/var/run/wifi-${1}.pid")"
-               ifconfig "$1" down
+               ip link set dev "$1" down
                unbridge "$1"
                iwpriv "$phy" wds_del "$2"
        done
@@ -204,7 +204,7 @@ enable_prism2() {
                                        hostapd_setup_vif "$vif" hostap || {
                                                echo "enable_prism2($device): Failed to set up hostapd for interface $ifname" >&2
                                                # make sure this wifi interface won't accidentally stay open without encryption
-                                               ifconfig "$ifname" down
+                                               ip link set dev "$ifname" down
                                                continue
                                        }
                                fi
@@ -213,7 +213,7 @@ enable_prism2() {
                                if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
                                        wpa_supplicant_setup_vif "$vif" wext || {
                                                echo "enable_prism2($device): Failed to set up wpa_supplicant for interface $ifname" >&2
-                                               ifconfig "$ifname" down
+                                               ip link set dev "$ifname" down
                                                continue
                                        }
                                fi
index c9bc3d610de770674f32d36658ec7976dcebed96..2a8d2f9430a5964555f55400892de29ca758ab16 100644 (file)
@@ -486,7 +486,7 @@ mac80211_prepare_vif() {
                # All interfaces must have unique mac addresses
                # which can either be explicitly set in the device
                # section, or automatically generated
-               ifconfig "$ifname" hw ether "$macaddr"
+               ip link set dev "$ifname" address "$macaddr"
        fi
 
        json_select ..
@@ -582,7 +582,7 @@ mac80211_setup_vif() {
        json_get_vars mode
        json_get_var vif_txpower txpower
 
-       ifconfig "$ifname" up || {
+       ip link set dev "$ifname" up || {
                wireless_setup_vif_failed IFUP_ERROR
                json_select ..
                return
@@ -638,7 +638,7 @@ mac80211_interface_cleanup() {
        local phy="$1"
 
        for wdev in $(list_phy_interfaces "$phy"); do
-               ifconfig "$wdev" down 2>/dev/null
+               ip link set dev "$wdev" down 2>/dev/null
                iw dev "$wdev" del
        done
 }
index c812e12c694ee278f49d4a36f6f1e6342c341608..e705275e3a8e51b0ad3dd9c599f8452bb8fe1afd 100644 (file)
@@ -13,8 +13,8 @@ check_relay() {
        [ -d "/sys/kernel/debug/trelay/${dev1}-${dev2}" ] && return
        [ -d "/sys/class/net/${dev1}" -a -d "/sys/class/net/${dev2}" ] || return
 
-       ifconfig "$dev1" up
-       ifconfig "$dev2" up
+       ip link set dev "$dev1" up
+       ip link set dev "$dev2" up
        echo "${dev1}-${dev2},${dev1},${dev2}" > /sys/kernel/debug/trelay/add
 }
 
index ba6924d9d21d16f134c078187e554de860b5f6cc..74d259073f0b105bf38a197a05cf6022451d1def 100644 (file)
@@ -5,7 +5,7 @@ setup_switch_dev() {
        local name
        config_get name "$1" name
        name="${name:-$1}"
-       [ -d "/sys/class/net/$name" ] && ifconfig "$name" up
+       [ -d "/sys/class/net/$name" ] && ip link set dev "$name" up
        swconfig dev "$name" load network
 }
 
index f3de63d0c6f75d1784e55af7362e0369ed2cb014..a1784f4c851049257b86eef3122b9592b149084f 100644 (file)
@@ -62,7 +62,7 @@ endif
 CONFIGURE_VARS += \
        IFCONFIG=/sbin/ifconfig \
        ROUTE=/sbin/route \
-       IPROUTE=/usr/sbin/ip \
+       IPROUTE=/sbin/ip \
        NETSTAT=/sbin/netstat
 
 define Build/Configure
index 984d7eea791fb24f780c2d8285b4ee3c7cb00ad3..3b8aabf34d18b02d527a736204d8c46e8c5e219f 100644 (file)
@@ -4,9 +4,9 @@
 setup_switch_vlan() {
        config_get ports "$CONFIG_SECTION" "eth$1"
        ports=`echo "$ports"| sed s/" "/""/g`
-       ifconfig eth$1 down
+       ip link set dev eth$1 down
        admswconfig eth$1 ${ports}c
-       ifconfig eth$1 up
+       ip link set dev eth$1 up
 }
 
 setup_switch() {