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

fix(react-native): filter out unrouteable addresses #44754

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

msbit
Copy link

@msbit msbit commented Jun 3, 2024

Summary:

When iterating over each interface, filter out loopback (127.) and link-local (169.254.) addresses in a similar way as the fallback search. This fixes an issue where a low numbered interface with one of these addresses would cause an iOS device to be unable to connect to the metro bundler instance.

Changelog:

[IOS] [FIXED] - filter out inaccessible loopback (127.) and link-local (169.254.) addresses in all cases

Test Plan:

Before

$ rm ip.txt
$ CONFIGURATION_BUILD_DIR=. CONFIGURATION=Debug SKIP_BUNDLING=1 packages/react-native/scripts/react-native-xcode.sh
+ DEST=./
+ [[ ! -n '' ]]
+ [[ Debug = *Debug* ]]
+ [[ ! '' == *simulator ]]
+ for num in 0 1 2 3 4 5 6 7 8
++ ipconfig getifaddr en0
+ IP=169.254.36.33
+ '[' '!' -z 169.254.36.33 ']'
+ break
+ '[' -z 169.254.36.33 ']'
+ echo 169.254.36.33
+ [[ -n 1 ]]
+ echo 'SKIP_BUNDLING enabled; skipping.'
SKIP_BUNDLING enabled; skipping.
+ exit 0
$ cat ip.txt
169.254.36.33

After

$ rm ip.txt
$ CONFIGURATION_BUILD_DIR=. CONFIGURATION=Debug SKIP_BUNDLING=1 packages/react-native/scripts/react-native-xcode.sh
+ DEST=./
+ [[ ! -n '' ]]
+ [[ Debug = *Debug* ]]
+ [[ ! '' == *simulator ]]
+ for num in 0 1 2 3 4 5 6 7 8
++ ipconfig getifaddr en0
++ grep -v 127.
++ grep -v 169.254.
++ echo ''
+ IP=
+ '[' '!' -z '' ']'
+ for num in 0 1 2 3 4 5 6 7 8
++ ipconfig getifaddr en1
++ grep -v 127.
++ grep -v 169.254.
+ IP=192.168.9.13
+ '[' '!' -z 192.168.9.13 ']'
+ break
+ '[' -z 192.168.9.13 ']'
+ echo 192.168.9.13
+ [[ -n 1 ]]
+ echo 'SKIP_BUNDLING enabled; skipping.'
SKIP_BUNDLING enabled; skipping.
+ exit 0
$ cat ip.txt
192.168.9.13

When iterating over each interface, filter out loopback (`127.`) and link-local
(`169.254.`) addresses in a similar way as the fallback search. This fixes an
issue where a low numbered interface with one of these addresses would cause an
iOS device to be unable to connect to the metro bundler instance.
@facebook-github-bot
Copy link
Contributor

Hi @msbit!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,576,600 -6
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,946,165 -1
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 033a55f
Branch: main

@react-native-bot
Copy link
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 30, 2024
@msbit
Copy link
Author

msbit commented Nov 30, 2024

Ping

@react-native-bot react-native-bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 1, 2024
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.

4 participants