mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-23 10:40:43 +01:00
Update network.sh
This commit is contained in:
@@ -311,7 +311,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Added interface: \"${_if}\""
|
echo "Added bridge interface: \"${_if}\""
|
||||||
|
|
||||||
elif [ "${VNET}" -eq 1 ]; then
|
elif [ "${VNET}" -eq 1 ]; then
|
||||||
if [ "${bastille_network_vnet_type}" = "if_bridge" ]; then
|
if [ "${bastille_network_vnet_type}" = "if_bridge" ]; then
|
||||||
@@ -462,8 +462,6 @@ EOF
|
|||||||
sed -i '' "s/interface = .*/&\n ip4.addr += ${_if}|${_ip};/" ${_jail_config}
|
sed -i '' "s/interface = .*/&\n ip4.addr += ${_if}|${_ip};/" ${_jail_config}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Added interface: \"${_if}\""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_interface() {
|
remove_interface() {
|
||||||
@@ -487,12 +485,12 @@ remove_interface() {
|
|||||||
local _if_type="if_bridge"
|
local _if_type="if_bridge"
|
||||||
|
|
||||||
if [ -n "${_jib_epair}" ]; then
|
if [ -n "${_jib_epair}" ]; then
|
||||||
local _epaira="$(grep "e[0-9]+a_${_jib_epair}" ${_jail_config})"
|
local _epaira="$(grep -A 1 "${_if}" ${_jail_config} | grep "e[0-9]+a_${_jib_epair}")"
|
||||||
local _epairb="$(grep "e[0-9]+b_${_jib_epair}" ${_jail_config})"
|
local _epairb="${_epaira%a_}b_"
|
||||||
local _if_jail="${_epairb}"
|
local _if_jail="${_epairb}"
|
||||||
else
|
else
|
||||||
local _epaira="$(grep 'e[0-9]+a_[^;" ]+' ${_jail_config})"
|
local _epaira="$(grep -m 1 "${_if}" ${_jail_config} | grep 'e[0-9]+a_[^;" ]+')"
|
||||||
local _epairb="$(grep 'e[0-9]+b_[^;" ]+' ${_jail_config})"
|
local _epairb="${_epaira%a_}b_"
|
||||||
local _if_jail="${_epairb}"
|
local _if_jail="${_epairb}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -509,7 +507,7 @@ remove_interface() {
|
|||||||
# Get vnetX value from rc.conf
|
# Get vnetX value from rc.conf
|
||||||
if [ "${_if_type}" = "if_bridge" ]; then
|
if [ "${_if_type}" = "if_bridge" ]; then
|
||||||
if grep -oq "${_if_jail}" ${_jail_config}; then
|
if grep -oq "${_if_jail}" ${_jail_config}; then
|
||||||
local _if_vnet="$(grep ${_if_jail} ${_jail_rc_config} | grep -Eo 'vnet[0-9]+')"
|
local _if_vnet="$(grep "${_if_jail}" ${_jail_rc_config} | grep -Eo 'vnet[0-9]+')"
|
||||||
else
|
else
|
||||||
error_exit "[ERROR]: Interface not found: ${_if_jail}"
|
error_exit "[ERROR]: Interface not found: ${_if_jail}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user