From cb4ddaf2e6d3f2b39ea7788f02881c83b4e52a0a Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Thu, 22 May 2025 10:12:21 -0600 Subject: [PATCH] create: Exit if -V and interface already used as member --- usr/local/share/bastille/create.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index 95f6b6af..272f69e1 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -179,10 +179,16 @@ validate_netif() { local LIST_INTERFACES="$(ifconfig -l)" - if echo "${LIST_INTERFACES} VNET" | grep -qwo "${INTERFACE}"; then - info "\nValid: (${INTERFACE})." - else + if ! echo "${LIST_INTERFACES} VNET" | grep -qwo "${INTERFACE}"; then error_exit "[ERROR]: Invalid: (${INTERFACE})." + elif [ -n "${VNET_JAIL}" ] && [ -z "${VNET_JAIL_BRIDGE}" ]; then + for _bridge in $(ifconfig -g bridge | grep -vw "${INTERFACE}bridge"); do + if ifconfig ${_bridge} | grep "member" | grep -owq "${INTERFACE}"; then + error_exit "[ERROR]: Interface (${INTERFACE}) is already a member of bridge: ${_bridge}" + fi + done + else + info "\nValid: (${INTERFACE})." fi }