> One way to fix this would be to make check-missing-firmware refuse to > reload NIC modules whose interfaces have an address assigned. > Problem: How to map from module to interface? Attached patch implements that. Please test. -- see shy jo
Index: debian/changelog
===================================================================
--- debian/changelog (revision 65847)
+++ debian/changelog (working copy)
@@ -1,3 +1,10 @@
+hw-detect (1.84) UNRELEASED; urgency=low
+
+ * check-missing-firmware: Avoid reloading modules that have a network
+ interface that is already configured. Closes: #605983
+
+ -- Joey Hess <joeyh@debian.org> Sun, 05 Dec 2010 13:43:13 -0400
+
hw-detect (1.83) unstable; urgency=low
* Set DI_PROGRESS_BAR_VISIBLE flag when running discover-pkginstall
Index: check-missing-firmware.sh
===================================================================
--- check-missing-firmware.sh (revision 65845)
+++ check-missing-firmware.sh (working copy)
@@ -43,6 +43,24 @@
done
}
+# Checks if a given module is a nic module and has an interface that
+# is up and has an IP address. Such modules should not be reloaded,
+# to avoid taking down the network after it's been configured.
+nic_is_configured() {
+ module="$1"
+
+ for iface in $(ip link show up | grep -v "^ " | cut -d : -f 2); do
+ dir="/sys/class/net/$iface/device/driver"
+ if [ -e "$dir" ] && [ "$(basename "$(readlink "$dir")")" = "$module" ]; then
+ if ip address show scope global dev "$iface" | grep -q 'scope global'; then
+ return 0
+ fi
+ fi
+ done
+
+ return 1
+}
+
check_missing () {
upnics
@@ -237,7 +255,9 @@
# Sort to only reload a given module once if it asks for more
# than one firmware file (example iwlagn)
for module in $(echo $modules | tr " " "\n" | sort -u); do
- modprobe -r $module || true
- modprobe $module || true
+ if ! nic_is_configured $module; then
+ modprobe -r $module || true
+ modprobe $module || true
+ fi
done
done
Attachment:
signature.asc
Description: Digital signature