]> git.ipfire.org Git - people/stevee/network.git/commitdiff
vlan: Check if parent device exists before bringing it up
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 3 Jun 2019 10:15:01 +0000 (12:15 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 3 Jun 2019 10:15:01 +0000 (12:15 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/ports/vlan

index f19eda493aaaf2910a6b87de198923dcb3e931fb..98178e3d823ef38b5499ca849bdc73e92becf933 100644 (file)
@@ -103,7 +103,15 @@ hook_create() {
        device_exists "${port}" && exit ${EXIT_OK}
 
        # Read configruation
-       port_settings_read "${port}"
+       if ! port_settings_read "${port}"; then
+               return ${EXIT_ERROR}
+       fi
+
+       # Check if the parent port exists
+       if ! port_exists "${PARENT_PORT}"; then
+               error "Port '${PARENT_PORT}' does not exist"
+               return ${EXIT_ERROR}
+       fi
 
        # Create the VLAN device
        vlan_create "${port}" "${PARENT_PORT}" "${TAG}" "${ADDRESS}"