react-native-xcode.sh doesn't filter out link local addresses correctly
Description
At https://github.com/facebook/react-native/blob/63e893d23d84c9bf65bad64fc359b9686eb19b4d/packages/react-native/scripts/react-native-xcode.sh#L17-L22 the script goes through a list of interfaces looking for an IP, using ipconfig getifaddr.
At https://github.com/facebook/react-native/blob/63e893d23d84c9bf65bad64fc359b9686eb19b4d/packages/react-native/scripts/react-native-xcode.sh#L23-L25 if the previous search hasn't found anything (IP is empty) it uses a looser search, grepping for inet and discarding link local addresses (127.x and 169.254.x).
The scenario I have is where my en0 has a link local address (169.254.36.33) and so as the first search doesn't filter out these addresses, this is what is written to ip.txt at https://github.com/facebook/react-native/blob/63e893d23d84c9bf65bad64fc359b9686eb19b4d/packages/react-native/scripts/react-native-xcode.sh#L27 and so my iOS device cannot connect to the metro instance.
Steps to reproduce
React Native Version
0.74.1
Affected Platforms
Runtime - iOS
Output of npx react-native info
-
Stacktrace or Logs
-
Reproducer
Screenshots and Videos
No response
| :warning: | Missing Reproducible Example |
|---|---|
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
| :warning: | Add or Reformat Version Info |
|---|---|
| :information_source: | We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2 |
cc @cipolleschi @robhogan et al. if we need to fix this in a different way for iOS
@msbit you have issues with your physical device only, right? It works properly on the simulator, correct?
@cipolleschi I haven't checked explicitly, but I'm guessing the check of platform at: https://github.com/facebook/react-native/blob/63e893d23d84c9bf65bad64fc359b9686eb19b4d/packages/react-native/scripts/react-native-xcode.sh#L16 would exclude this behaviour under simulators.
yes, it is possible. @robhogan could you take this? I'm going to be on PTO next week. Otherwise I can look into it when I'm back.
This issue 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.
This issue was closed because it has been stalled for 7 days with no activity.