Ignore all loopback addresses for ip detection #13415
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
There is a bug with IP detection on Macs that have (1) multiple ethernet interfaces, (2) are using the second or third interface as their primary connection and (3) have extra loopback IPs configured (for example when running OpenVPN, running some Docker configurations or other more exotic applications). In those cases, automatic IP detection will falsely detect the IP as something like
127.94.0.1
, which will make it impossible to run debug builds from a physical device.Cause
The underlying network configurations looks something similar to this (irrelevant parts omitted):
In this configuration the packager will currently figure out
127.94.0.1
instead of192.168.0.226
.Proposed Fix
In addition to the existing filter on
127.0.0.1
, also filter out all loopback addresses by changing the grep filter on127.
[with a space in front of127
to make sure we only filter out leading127
addresses]. This PR does exactly that.Tested and found working on the culprit systems as well as various MacBooks.
Note: this PR replaces #12875 as it seems something went wrong with a rebase I did. Decided it was less of a risk to submit a new PR with this simple fix rather than retry the rebase.