daviftorres commented on code in PR #11800:
URL: https://github.com/apache/cloudstack/pull/11800#discussion_r2534435901


##########
utils/src/main/java/com/cloud/utils/net/NetUtils.java:
##########
@@ -306,7 +306,7 @@ public static String getDefaultEthDevice() {
             final String defDev = Script.runSimpleBashScript("/sbin/route -n 
get default 2> /dev/null | grep interface | awk '{print $2}'");
             return defDev;
         }
-        return Script.runSimpleBashScript("ip route show default 0.0.0.0/0 | 
head -1 | awk '{print $5}'");
+        return Script.runSimpleBashScript("ip -j a | jq -r '.[] | .addr_info | 
map(select(.local == \"'`ip -j r s default | jq -r '.[0] | .prefsrc'`'\")) | 
.[].label'");

Review Comment:
   ```suggestion
           return Script.runSimpleBashScript("ip route show default | awk 
'{print $5}'");
   ```
   My suggestion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to