]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/hooks/ports/vlan
vlan: Check if parent device exists before bringing it up
[people/ms/network.git] / 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}"