[packages/lxd] - check if bridge is up and nothing more

mis mis at pld-linux.org
Mon Aug 22 14:12:02 CEST 2016


commit 218196491c360d838eebc673b5a195b43dc19c91
Author: mis <mis at pld-linux.org>
Date:   Mon Aug 22 14:11:23 2016 +0200

    - check if bridge is up and nothing more

 lxdbr.init | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/lxdbr.init b/lxdbr.init
index 65a7a33..a638f4a 100755
--- a/lxdbr.init
+++ b/lxdbr.init
@@ -29,7 +29,7 @@ if [ -z "$BRIDGE_DEV" -o -z "$BRIDGE_IPADDR" ]; then
 fi
 
 is_bridge_up() {
-	ip addr show $BRIDGE_DEV 2>/dev/null | grep -q $BRIDGE_IPADDR
+	ip link show $BRIDGE_DEV 2>/dev/null | grep -q ",UP,"
 }
 
 start() {
@@ -42,7 +42,7 @@ start() {
 	busy
 
 	ip link add dev $BRIDGE_DEV type bridge
-	ip a add $BRIDGE_IPADDR dev $BRIDGE_DEV
+	ip addr add $BRIDGE_IPADDR dev $BRIDGE_DEV
 	ip link set up dev $BRIDGE_DEV
 
 	if is_bridge_up; then
@@ -83,9 +83,10 @@ condrestart() {
 
 bridge_status() {
 	local st="down"
-	if ip link show $BRIDGE_DEV >/dev/null; then
+	RETVAL=1
+	if is_bridge_up; then
 		st="up"
-		RETVAL=1
+		RETVAL=0
 	fi
 	nls "lxd bridge %s is %s" "$BRIDGE_DEV" "$st"
 }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lxd.git/commitdiff/218196491c360d838eebc673b5a195b43dc19c91



More information about the pld-cvs-commit mailing list