]> git.ipfire.org Git - people/ms/network.git/commitdiff
Better handling for dummy interfaces
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Dec 2014 01:16:43 +0000 (01:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Dec 2014 01:16:43 +0000 (01:16 +0000)
Will not create any port configurations for them any more
when the kernel module is loaded into the kernel.

src/functions/functions.device
src/udev/network-hotplug

index d4318f843a20f360b7490d9f0bfa70e7b385dcfa..c9c471a1bc49eb0c8c07f221391bdc9e24e20fab 100644 (file)
@@ -298,6 +298,14 @@ function device_is_loopback() {
        [ "${device}" = "lo" ]
 }
 
+# Check if the device is a dummy device
+#  This is the worst possible check, but all I could come up with
+function device_is_dummy() {
+       local device="${1}"
+
+       [[ ${device} =~ ^dummy[0-9]+$ ]]
+}
+
 # Check if the device is a wireless device
 function device_is_wireless() {
        local device=${1}
@@ -324,6 +332,9 @@ function device_is_serial() {
 function device_is_ethernet() {
        local device=${1}
 
+       device_is_ethernet_compatible "${device}" || \
+               return ${EXIT_ERROR}
+
        device_is_loopback ${device} && \
                return ${EXIT_ERROR}
 
@@ -339,7 +350,7 @@ function device_is_ethernet() {
        device_is_vlan ${device} && \
                return ${EXIT_ERROR}
 
-       [ "$(__device_get_file ${device} type)" != "1" ] && \
+       device_is_dummy ${device} && \
                return ${EXIT_ERROR}
 
        return ${EXIT_OK}
@@ -378,6 +389,9 @@ function device_get_type() {
        elif device_is_wireless ${device}; then
                echo "wireless"
 
+       elif device_is_dummy ${device}; then
+               echo "dummy"
+
        elif device_is_ethernet ${device}; then
                echo "ethernet"
 
index a738970ab75ae29209deb6cdf357a0e3b41fc622..87035e0ae9519052a24c03c81477952a411b97f2 100644 (file)
@@ -78,6 +78,15 @@ case "${SUBSYSTEM}" in
                                fi
                                ;;
 
+                       # dummy
+                       add,dummy)
+                               # Remove the by default created dummy device
+                               if [ "${INTERFACE}" = "dummy0" ]; then
+                                       dummy_remove "${INTERFACE}"
+                                       exit ${EXIT_OK}
+                               fi
+                               ;;
+
                        # Ethernet
                        add,ethernet)
                                # Create a default port for all ethernet devices