Log table's uplink only if exists
authorDimitris Aragiorgis <dimara@grnet.gr>
Tue, 4 Mar 2014 16:48:53 +0000 (18:48 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Wed, 5 Mar 2014 16:28:11 +0000 (18:28 +0200)
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

common.sh

index 0c96dc6..ac8e279 100755 (executable)
--- a/common.sh
+++ b/common.sh
@@ -213,7 +213,9 @@ function get_uplink {
   local table=$1
   UPLINK=$(ip route list table $table | grep "default via" | awk '{print $5}')
   UPLINK6=$(ip -6 route list table $table | grep "default via" | awk '{print $5}')
-  $SNF_NETWORK_LOG $0 "* Table $table: uplink -> $UPLINK, uplink6 -> $UPLINK6"
+  if [ -n "$UPLINK" -o -n "$UPLINK6" ]; then
+    $SNF_NETWORK_LOG $0 "* Table $table: uplink -> $UPLINK, uplink6 -> $UPLINK6"
+  fi
 
 }