From 104e9c65b1e1aadcb375debaa259589702fc08f3 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Wed, 19 Jun 2013 10:07:55 -0500 Subject: autoconfig: update network device name recognission The previous code assumed the old style network names such as eth* were the names of interfaces. With the new udev, this is not always the case, so this updates autoconfig to ignore lo and sit0 and assume that the rest are valid network interfaces. Also we now use /sys/class/net/* to detect interfaces instead of /proc/dev/net. Reported-by: alexeyk13@yandex.ru X-Gentoo-Bug: 471054 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=471054 --- init.d/autoconfig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/init.d/autoconfig b/init.d/autoconfig index 8f5c5db..10a60b7 100755 --- a/init.d/autoconfig +++ b/init.d/autoconfig @@ -375,6 +375,17 @@ detect_sparc() { PC="Detected ${numcpu} active ${cpuinfo} CPU(s) of ${numprobed} total" } +detect_netdevices() { + for dev in /sys/class/net/*; do + n="$(basename $dev)" + case "$n" in + lo|sit0) continue ;; + *) echo $n + esac + done + return 0 +} + start() { ebegin "Starting autoconfig" echo "0" > /proc/sys/kernel/printk @@ -501,7 +512,7 @@ start() { if yesno "${DETECT}" then - NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)" + NETDEVICES="$(detect_netdevices)" else DHCP="no" fi -- cgit v1.2.3-65-gdbad