From afd9b2da93c451eec26ba4d026368ce71ca6a01d Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 23 Jan 2014 16:28:16 +0100 Subject: [PATCH] clean up networking code in build mode we rely on DHCP and so everything is as simple as it gets --- lbuild-initvm.sh | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh index 11d22d29..bb2e540c 100755 --- a/lbuild-initvm.sh +++ b/lbuild-initvm.sh @@ -63,22 +63,6 @@ function discover_interface () { # still not found ? that's bad echo unknown } -########## check for a free IP -function ip_is_busy () { - target=$1; shift - ping -c 1 -W 1 $target >& /dev/null -} - -function random_private_byte () { - for attempt in $(seq $PRIVATE_ATTEMPTS); do - byte=$(($RANDOM % 256)) - if [ "$byte" == 0 -o "$byte" == 1 ] ; then continue; fi - ip=${PRIVATE_PREFIX}${byte} - ip_is_busy $ip || { echo $byte; return; } - done - echo "Cannot seem to find a free IP address in range ${PRIVATE_PREFIX}.xx/24 after $PRIVATE_ATTEMPTS attempts - exiting" - exit 1 -} ########## networking -- ctd function gethostbyname () { @@ -532,7 +516,7 @@ function write_guest_interfaces_test () { cat <