Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linux): use RTM_GETROUTE before RTM_GETADDR #101

Merged
merged 1 commit into from
Feb 27, 2023

Conversation

cgzones
Copy link
Contributor

@cgzones cgzones commented Feb 26, 2023

Before using the IP of the first non-loopback interface returned by RTM_GETADDR, try to use the IP address of the interface routing external traffic via RTM_GETROUTE.

@LeoBorai LeoBorai changed the title Linux: rework local IP retrieval feat(linux): rework local IP retrieval Feb 27, 2023
@LeoBorai LeoBorai changed the title feat(linux): rework local IP retrieval feat(linux): use RTM_GETROUTE before RTM_GETADDR Feb 27, 2023
@LeoBorai
Copy link
Owner

Thanks so much for taking the time @cgzones!

Copy link
Owner

@LeoBorai LeoBorai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Just a minor naming improvement but other than that LGTM!

src/linux.rs Outdated Show resolved Hide resolved
Before using the IP of the first non-loopback interface returned by
RTM_GETADDR, try to use the IP address of the interface routing external
traffic via RTM_GETROUTE.
Copy link
Owner

@LeoBorai LeoBorai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks so much @cgzones!

@LeoBorai LeoBorai merged commit da0d5a8 into LeoBorai:main Feb 27, 2023
@cgzones cgzones deleted the getroute branch February 28, 2023 14:06
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