question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subnet is returned as 255.255.255.255 instead of 255.255.255.0

See original GitHub issue

Environment

System:
    OS: Linux 5.18 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K
    Memory: 13.71 GB / 31.11 GB
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 16.18.0 - /usr/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 17.0.4 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.67.4 => 0.67.4 
  npmGlobalPackages:
    *react-native*: Not Found

Platforms

Android 11

Versions

  • Android: 11 (8901.4.A.0017.3 release-keys)
  • react-native-netinfo: 9.3.4
  • react-native: 0.67.4
  • react: 17.0.2

Description

On my Android 11 device (Fairphone 3+) running NetInfo.fetch gives correct information, aside from subnet:

[{"details":{"isConnectionExpensive":false,"txLinkSpeed":57,"rxLinkSpeed":-1,"linkSpeed":57,"subnet":"255.255.255.255","ipAddress":"10.0.0.133","frequency":2462,"strength":72,"bssid":"xxx","ssid":"xxx"},"isConnected":true,"type":"wifi","isInternetReachable":true,"isWifiEnabled":true}]

The correct network information would be 10.0.0.133/24, i.e. a subnet of 255.255.255.0. On my desktop machine (in the same network) I see

inet 10.0.0.2/24 brd 10.0.0.255 scope global dynamic noprefixroute eno1
       valid_lft 860383sec preferred_lft 860383sec

When checking the network details manully (long-pressing on the Wifi icon) I also get a subnet mask of 255.255.255.0.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mikehardycommented, Oct 26, 2022

You win the internet points for the day for nailing this with what appears to be a squeaky clean PR. Chapeau

1reaction
mikehardycommented, Oct 25, 2022

I guess your code doesn’t like IPv6?

It’s open source, it’s your code 😆

If there’s something that needs to change I’m open to any+all reasonable PRs

This module existed long before I had heard of react-native, and it’ll be here long after I’ve stopped hitting the “merge” button, I imagine you are correct and it’s just IPv4-only at the moment, or incorrectly-IPv6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change subnet mask from 255.255.255.0 to ... - Super User
If your device lets you enter 255.255.255.255 as the subnet mask it won't be able to communicate with other devices on the network....
Read more >
What is a 255.255 255.0 subnet? - Quora
It means the first 24 bits of the IP address are the network or subnet portion of the address, and the last 8...
Read more >
255.255.255.0 Subnet Mask for IP Networks - Lifewire
The subnet mask 255.255.255.0 address is the most common subnet mask used on computers connected to Internet Protocol (IPv4) networks.
Read more >
Understanding 255.255.255.0 : r/linuxquestions - Reddit
255.255.255.0 tells you that in your subnet (=part of the global IPv4 network), the first three parts of the network address always stay...
Read more >
Subnets and IP addresses - Router Security
A subnet mask of 255.255.255.0 is actually 24 binary ones, followed by 8 binary zeros. For this reason, you often see it referred...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found