Skip to content

Commit 19a5573

Browse files
author
Bjoern Anters
committed
Squashed commit of the following:
commit dbe1f87 Merge: 35b7a74 4d46bec Author: Bjoern Anters <[email protected]> Date: Mon Jul 14 09:41:30 2025 +0200 Merge branch 'main' into 10996_get_default_nic commit 35b7a74 Author: Bjoern Anters <[email protected]> Date: Thu Jun 26 16:25:57 2025 +0200 use ip route structured data to retrieve default interface commit 234dfd3 Merge: a310b80 16c60c7 Author: Björn Anters <[email protected]> Date: Tue Jun 24 17:51:37 2025 +0200 Merge branch 'apache:main' into 10996_get_default_nic commit a310b80 Author: Bjoern Anters <[email protected]> Date: Mon Jun 23 16:40:10 2025 +0200 use ip route structured data to retrieve default interface commit 8e8549c Author: Bjoern Anters <[email protected]> Date: Mon Jun 23 15:47:13 2025 +0200 Revert "make debian build vars work" This reverts commit c1ccb16. commit 0446631 Author: Bjoern Anters <[email protected]> Date: Mon Jun 23 15:45:37 2025 +0200 Revert "use ip route structured data to retrieve default interface" This reverts commit 91578d7. commit c1ccb16 Author: Bjoern Anters <[email protected]> Date: Tue Jun 17 12:06:44 2025 +0200 make debian build vars work commit 91578d7 Author: Bjoern Anters <[email protected]> Date: Mon Jun 16 16:18:36 2025 +0200 use ip route structured data to retrieve default interface commit dbaeeda Author: Bjoern Anters <[email protected]> Date: Mon Jun 16 16:17:49 2025 +0200 use ip route structured data to retrieve default interface commit 44207cd Author: Bjoern Anters <[email protected]> Date: Mon Jun 16 16:15:33 2025 +0200 use ip route structured data to retrieve default interface commit c88a905 Author: Bjoern Anters <[email protected]> Date: Mon Jun 16 16:12:13 2025 +0200 use ip route structured data to retrieve default interface commit 6200d66 Author: Bjoern Anters <[email protected]> Date: Mon Jun 16 16:07:40 2025 +0200 use ip route structured data to retrieve default interface commit e547724 Author: Bjoern Anters <[email protected]> Date: Mon Jun 16 15:53:43 2025 +0200 use ip route structured data to retrieve default interface commit 9fb0150 Author: Bjoern Anters <[email protected]> Date: Tue Jun 10 17:23:45 2025 +0200 use ip route structured data to retrieve default interface
1 parent 4d46bec commit 19a5573

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/src/main/java/com/cloud/utils/net/NetUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public static String getDefaultEthDevice() {
306306
final String defDev = Script.runSimpleBashScript("/sbin/route -n get default 2> /dev/null | grep interface | awk '{print $2}'");
307307
return defDev;
308308
}
309-
return Script.runSimpleBashScript("ip route show default 0.0.0.0/0 | head -1 | awk '{print $5}'");
309+
return Script.runSimpleBashScript("/bin/ip -j a | /bin/jq -r '.[] | .addr_info | map(select(.local == \"'`/bin/ip -j r s default | /bin/jq -r '.[0] | .prefsrc'`'\")) | .[].label'");
310310
}
311311

312312
public static String getLocalIPString() {

0 commit comments

Comments
 (0)