Repository navigation
Undocumented change to "family" attribute in os.networkInterfaces() in Node 18 #42787
Copy link
Copy link
Closed
Closed
Copy link
Labels
osIssues and PRs related to the os subsystem.Issues and PRs related to the os subsystem.
Description
Activity
- changed the title
[-]Undocumented change to "family" attribute in os.networkInterfaces() in Node18[/-][+]Undocumented change to "family" attribute in os.networkInterfaces() in Node 18[/+]on Apr 19, 2022 Related: #41431 (comment)
- added a commit that references this issue
on Apr 19, 2022 - addedosIssues and PRs related to the os subsystem.Issues and PRs related to the os subsystem.
on Apr 20, 2022 #41431 has now introduced an inconsistency between
os.networkInterfaces()and diagnostic reports. e.g.> os.networkInterfaces() { lo: [ { address: '127.0.0.1', netmask: '255.0.0.0', family: 4, mac: '00:00:00:00:00:00', internal: true, cidr: '127.0.0.1/8' }, { address: '::1', netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', family: 6, mac: '00:00:00:00:00:00', internal: true, cidr: '::1/128', scopeid: 0 } ],compared to:
> process.report.getReport().header.networkInterfaces [ { name: 'lo', internal: true, mac: '00:00:00:00:00:00', address: '127.0.0.1', netmask: '255.0.0.0', family: 'IPv4' }, ... { name: 'lo', internal: true, mac: '00:00:00:00:00:00', address: '::1', netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', family: 'IPv6', scopeid: 0 }, ...- added a commit that references this issue
on Apr 21, 2022 - added a commit that references this issue
on Apr 25, 2022 - added a commit that references this issue
on Apr 28, 2022 - added a commit that references this issue
on May 2, 2022 - added a commit that references this issue
on Jun 23, 2022 - added a commit that references this issue
on Jul 5, 2022 - added a commit that references this issue
on Nov 4, 2022 - added a commit that references this issue
on Dec 7, 2022 - added a commit that references this issue
on Jul 29, 2023
Metadata
Metadata
Assignees
Labels
osIssues and PRs related to the os subsystem.Issues and PRs related to the os subsystem.
Version
v18.0.0
Platform
Darwin Bens-MacBook-Pro-2.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
Subsystem
No response
What steps will reproduce the bug?
Easy to reproduce in the REPL - just call
os.networkInterfaces()Each listed IP has a "family" attribute. Before Node 18 this was a string value of "IPv4" or "IPv6", in Node 18 it's a numeric 4 or 6.How often does it reproduce? Is there a required condition?
Happens 100% of the time. Only requirement is to be running Node 18.
What is the expected behavior?
The family attribute should be either "IPv4" or "IPv6". The Node 18 documentation still describes it this way, and the Node 18 changelog doesn't mention this change, so my assumption is that this is unintended. If it actually was intended, then the documentation and changelog should be updated to reflect it.
What do you see instead?
Example from the Node 18 REPL:
Additional information
The changelog does say "net: make server.address() return an integer for family". If this was unintentional, maybe it could be a side effect from whatever was done in that PR? (I haven't looked at that PR, nor am I familiar with Node's internals, so this is just a guess.)