Skip to content

Conversation

mosys0815
Copy link

Using ip route structured data allows to query safely the default route interface, no matter the output of the standard 'ip route' output.

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
Copy link

boring-cyborg bot commented Oct 7, 2025

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.54%. Comparing base (4d46bec) to head (6b9c422).
⚠️ Report is 331 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11800      +/-   ##
============================================
+ Coverage     16.57%   17.54%   +0.96%     
- Complexity    13987    15467    +1480     
============================================
  Files          5746     5897     +151     
  Lines        510860   527397   +16537     
  Branches      62140    64407    +2267     
============================================
+ Hits          84696    92516    +7820     
- Misses       416690   424486    +7796     
- Partials       9474    10395     +921     
Flag Coverage Δ
uitests 3.60% <ø> (-0.31%) ⬇️
unittests 18.60% <100.00%> (+1.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@weizhouapache
Copy link
Member

it worked on ubuntu 24

# /bin/ip -j a | /bin/jq -r '.[] | .addr_info | map(select(.local == "'`/bin/ip -j r s default | /bin/jq -r '.[0] | .prefsrc'`'")) | .[].label'
eth0

however, on RHEL and variants, the path of ip is not /bin/ip

# which ip
/usr/sbin/ip

@mosys0815
Copy link
Author

mosys0815 commented Oct 7, 2025

well, until now plain ip is used, i could replace is with just ip, or the script can get the path beforehand, what would you prefer?

@mosys0815
Copy link
Author

I changed the script to use short-paths for ipand jq, as like as it was before

@mosys0815 mosys0815 changed the title [10996] - use 'ip route' structured data to safely retrieve default route interface [10996] - use 'ip' structured data to safely retrieve default route interface Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants