]> git.ipfire.org Git - people/stevee/network.git/blobdiff - src/udev/network-hotplug
bonding: Improve robustness of the code
[people/stevee/network.git] / src / udev / network-hotplug
index a9787c4977690c4c8effb0b8518225d20af2323b..09ecc0c498ef86d73f8e137bc16e4c143836287b 100644 (file)
@@ -36,10 +36,18 @@ assert isset INTERFACE
 # Check, if the device is a physical network interface and
 # if we can handle it.
 if device_exists ${INTERFACE}; then
-       if ! device_is_ethernet ${INTERFACE}; then
-               log DEBUG "Called for interface '${INTERFACE}' which is a virtual interface. Exiting."
-               exit ${EXIT_OK}
-       fi
+       type="$(device_get_type "${INTERFACE}")"
+       case "${type}" in
+               # Remove automatically created bonding interface without any configuration
+               bonding)
+                       port_exists "${INTERFACE}" || bonding_remove "${INTERFACE}"
+                       exit ${EXIT_OK}
+                       ;;
+               ethernet)
+                       log DEBUG "Called for interface '${INTERFACE}' which is a virtual interface. Exiting."
+                       exit ${EXIT_OK}
+                       ;;
+       esac
 fi
 
 case "${ACTION}" in