Commit 1f0c965f authored by Jondy Zhao's avatar Jondy Zhao

slapos-configure.sh: fix ipv4 addr can't be assigned to netcard

parent 03fd75a8
......@@ -233,7 +233,7 @@ function configure_section_network()
csih_error "install network interface ${slapos_ifname} failed"
fi
_addr4=$(echo ${_ipv4_local_network} | sed -e "s%\.0/%.1/%g")
if [[ -n "${_addr}" ]] ; then
if [[ -n "${_addr4}" ]] ; then
netsh interface ip show addr ${slapos_ifname} | grep -q "${_addr4}" ||
ip -4 addr add ${_addr4} dev ${slapos_ifname} ||
csih_error "add ipv4 address failed"
......@@ -743,7 +743,7 @@ while test $# -gt 0; do
done
if [[ -z "${_ipv4_local_network}" ]] ; then
_ipv4_local_network=$(get_free_local_ipv4_network).0/24 ||
_ipv4_local_network=$(get_free_local_ipv4_network) ||
csih_error "no ipv4_local_network specified"
fi
......
......@@ -183,7 +183,7 @@ function reset_slapos_connection()
# ======================================================================
# Routine: get_free_local_ipv4_network
# Get a free local ipv4 network in 10.x.x.0/24, return 10.x.x
# Get a free local ipv4 network in 10.x.x.0/24, return 10.x.x.0/24
# ======================================================================
function get_free_local_ipv4_network()
{
......@@ -204,7 +204,7 @@ function get_free_local_ipv4_network()
addr=${seg1}.${seg2}
! IPCONFIG /ALL | grep -q ${addr} &&
echo 10.${addr} &&
echo "10.${addr}.0/24" &&
return 0
let i--
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment