From 6bdb810f3843d73bf8146c3c712ae487a96ff0b6 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Wed, 23 Mar 2016 06:00:49 +0000 Subject: [PATCH] Handle unconfigured interfaces for dhcp-all-ifaces On ubuntu, if an interface exists but is unconfigured then ifquery $iface will return 0 but no output. This will cause dhcp-all-interfaces to not attempt to dhcp on that interface. Change-Id: Ic1532728ae9ca6d759714392f727d25b814ef336 --- .../install.d/dhcp-all-interfaces.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh index e622078e..cb30ceed 100755 --- a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh +++ b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh @@ -56,7 +56,15 @@ function config_exists() { return 0 fi else - ifquery $interface >/dev/null 2>&1 && return 0 || return 1 + if ifquery $interface >/dev/null 2>&1; then + if [ -z "$(ifquery $interface 2>&1)" ]; then + return 1 + else + return 0 + fi + else + return 1 + fi fi return 1 }