react-native icon indicating copy to clipboard operation
react-native copied to clipboard

react-native-xcode.sh doesn't filter out link local addresses correctly

Open msbit opened this issue 1 year ago • 6 comments

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

msbit avatar Jun 03 '24 01:06 msbit

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

github-actions[bot] avatar Jun 03 '24 01:06 github-actions[bot]

: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

github-actions[bot] avatar Jun 03 '24 01:06 github-actions[bot]

cc @cipolleschi @robhogan et al. if we need to fix this in a different way for iOS

cortinico avatar Jun 04 '24 10:06 cortinico

@msbit you have issues with your physical device only, right? It works properly on the simulator, correct?

cipolleschi avatar Jun 06 '24 10:06 cipolleschi

@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.

msbit avatar Jun 09 '24 13:06 msbit

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.

cipolleschi avatar Jun 28 '24 13:06 cipolleschi

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.

react-native-bot avatar Dec 26 '24 05:12 react-native-bot

This issue was closed because it has been stalled for 7 days with no activity.

react-native-bot avatar Jan 02 '25 05:01 react-native-bot