From 4aad47b0f1921b272746c7ab5e4a4d740f2a6112 Mon Sep 17 00:00:00 2001 From: beierlm Date: Tue, 7 Dec 2021 16:15:53 -0500 Subject: [PATCH] Bug 1530: Limit IP addresses Adds an exit to the awk command so that only the first IP address is used on a system that might have more than one IP address on the chosen interface Fixes bug 1530 Change-Id: I7d5775ed1c1e801a338e048576d5106dc6c3d23a Signed-off-by: beierlm --- installers/charmed_install.sh | 4 ++-- installers/full_install_osm.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index c686597a..bd714a6a 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -450,8 +450,8 @@ function install_microstack() { version: 3}' } -DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'` -DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'` +DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5; exit}'` +DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]; exit}'` check_arguments $@ mkdir -p ~/.osm diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 27e487f4..75949846 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -647,7 +647,7 @@ function install_osm() { DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}') [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}') [ -z "$DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" - DEFAULT_IP=`ip -o -4 a s ${DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]}'` + DEFAULT_IP=`ip -o -4 a s ${DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]; exit}'` [ -z "$DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" # configure apt proxy -- 2.25.1