From 2129d7812475b62cb5ed3c6a27fac83a8215ec39 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Fri, 11 Oct 2013 11:01:06 -0700 Subject: [PATCH] Fix ifquery call in dhcp-all-interfaces Ifquery does not print anything for interfaces which only have a single iface line. It does, however, return non-zero if the interface is not configured at all, so we can use that to indicate whether or not there is a configuration. Fixes bug #1233579 Change-Id: Ia2fdafbea57e806eba99ae8ddaf395ebdcc306e1 --- .../install.d/generate-interfaces-file.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh b/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh index fa9b745c..cc0877f5 100755 --- a/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh +++ b/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh @@ -12,8 +12,9 @@ function get_if_link() { for interface in $(ls /sys/class/net | grep -v ^lo$) ; do echo -n "Inspecting interface: $interface..." - HAS_CONFIG=$(ifquery $interface >/dev/null 2>&1) - if [ "$HAS_CONFIG" == "" ]; then + if ifquery $interface >/dev/null 2>&1 ; then + echo "Has config, skipping." + else ip link set dev $interface up >/dev/null 2>&1 HAS_LINK="$(get_if_link $interface)"