From: Michael Tremer Date: Mon, 3 Jun 2019 10:15:01 +0000 (+0200) Subject: vlan: Check if parent device exists before bringing it up X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4776723194ad4d1ba75d1b373c1892e44ddcbf97;p=people%2Fstevee%2Fnetwork.git vlan: Check if parent device exists before bringing it up Signed-off-by: Michael Tremer --- diff --git a/src/hooks/ports/vlan b/src/hooks/ports/vlan index f19eda49..98178e3d 100644 --- a/src/hooks/ports/vlan +++ b/src/hooks/ports/vlan @@ -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}"