From 9792465a8ddd55f49e8994d4abf0a78652992caf Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 25 May 2018 12:03:37 +0200 Subject: [PATCH] netcardconfig: switch from ifconfig to ip(8) The output of ifconfig changed in recent versions, breaking parsing the available interfaces. Use that as a good excuse for switching from ifconfig to ip. The 's/@.*//' is required to strip the '@ethX0' from the interface names 'vlan42@eth0', since in /sys/class/net/ only vlan42 exists as such and not vlan42@eth0. --- sbin/netcardconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/netcardconfig b/sbin/netcardconfig index d85404f..e3d0d11 100755 --- a/sbin/netcardconfig +++ b/sbin/netcardconfig @@ -56,7 +56,7 @@ writeiwline() { for mod in /sys/module/rt2??0/ ; do if [ -d "$mod" ]; then - IWPREUPLINE="$IWPREUPLINE pre-up /sbin/ifconfig $DV up\n" + IWPREUPLINE="$IWPREUPLINE pre-up /sbin/ip link set $DV up\n" break fi done @@ -93,7 +93,7 @@ generate_udev_entry() { # Executing this script generates an entry in /etc/udev/rules.d/z25_persistent-net.rules # for you, please check z25_persistent-net.rules for existing entries before # running this script (once more)." > /etc/udev/scripts/netcardconfig - for interface in $(ifconfig | awk '/^[a-z]/ &&!/^lo/{ print $1} ') ; do + for interface in $(ip -oneline link | awk '!/ lo: / {print $2}' | sed 's/:$//; s/@.*//') ; do echo -n "INTERFACE=$interface /lib/udev/write_net_rules " >> /etc/udev/scripts/netcardconfig && \ if which udevadm >/dev/null 2>&1; then udevadm info -a -p "/sys/class/net/$interface" | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig @@ -158,7 +158,7 @@ remauto(){ scanwlan(){ i=0 - ifconfig "$DV" up + ip link set "$DV" up iwlist "$DV" scanning | grep "ESSID\|Quality" | sed -e "s/^.*ESSID:\"\|\"$//g" | tac > "$TMP" while read -r line do -- 2.1.4