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

EINVAL at addMembership with ipv6 address&interface (node:dgram) #17240

Open
craftingmod opened this issue Feb 10, 2025 · 1 comment
Open

EINVAL at addMembership with ipv6 address&interface (node:dgram) #17240

craftingmod opened this issue Feb 10, 2025 · 1 comment
Labels
bug Something isn't working needs triage

Comments

@craftingmod
Copy link

What version of Bun is running?

1.2.3-canary.24+b39d84690

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

  1. Prepare bun canary (version after Fix node:dgram addMembership/dropMembership segfault #17049 )
  2. Make broadcast.js with content
import * as dgram from "node:dgram"

// force ipv6Only for testing
const s = dgram.createSocket({
  type: 'udp6',
  ipv6Only: true,
})
s.bind(5167, () => {
  s.addMembership("ff02::fb", "::%12") // ipv6 multicast dns / ipv6 port
  console.log("Hi")
})
  1. bun broadcast.js

What is the expected behavior?

No error with

Hi

in Node.js v22.13.1

What do you see instead?

EINVAL errror with

4 | const s = dgram.createSocket({
5 |   type: 'udp6',
6 |   ipv6Only: true,
7 | })
8 | s.bind(5167, () => {
9 |   s.addMembership("ff02::fb", "::%12") // ipv6 multicast dns / ipv6 port
        ^
EINVAL: invalid argument, setsockopt
 syscall: "setsockopt",
   errno: -22,
    code: "EINVAL"

      at <anonymous> (B:\broadcast.js:9:5)
      at <anonymous> (node:dgram:251:45)
      at emit (node:events:322:22)
      at <anonymous> (node:dgram:306:91)

Bun v1.2.3-canary.24+b39d84690 (Windows x64)

Additional information

Matter.js output with bun (which I have been reproduce this issue.) - ipv4/ipv6 dns broadcast feature is used.

2025-02-11 04:12:38.785 DEBUG  Transaction          Transaction initialize<node0.part0>#a committed and unlocked 4 resources
2025-02-11 04:12:38.785 INFO   Endpoint             node0.part0 ready endpoint#: 1 type: OnOffLight (0x100) behaviors: ✓identify ✓groups ✓onOff ✓descriptor
2025-02-11 04:12:38.787 NOTICE Node                 node0 going online
2025-02-11 04:12:38.791 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: 0.0.0.0:5353
[MEMBERSHIP]: 224.0.0.251 / undefined
2025-02-11 04:12:38.792 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: :::5353
[MEMBERSHIP]: ff02::fb / ::%12
2025-02-11 04:12:38.796 WARN   NodejsChannel        Error adding membership for address ff02::fb with interface ::%12: Error: EINVAL: invalid argument, setsockopt
2025-02-11 04:12:38.797 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: 0.0.0.0:5353
[MEMBERSHIP]: 224.0.0.251 / undefined
2025-02-11 04:12:38.797 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: :::5353
[MEMBERSHIP]: ff02::fb / ::%12
2025-02-11 04:12:38.799 WARN   NodejsChannel        Error adding membership for address ff02::fb with interface ::%12: Error: EINVAL: invalid argument, setsockopt
2025-02-11 04:12:38.800 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5540 localAddress: :::5540


2025-02-11 04:12:38.890 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: 0.0.0.0:5353
2025-02-11 04:12:38.890 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: 0.0.0.0:5353
2025-02-11 04:12:38.890 DEBUG  NodejsChannel        Socket created and bound remoteAddress: undefined:5353 localAddress: :::5353
2025-02-11 04:12:38.894 DEBUG  NodejsChannel        Initialize multicast address: 192.168.3.140:5353 interface: i210-T1 type: udp4
2025-02-11 04:12:38.898 DEBUG  NodejsChannel        Initialize multicast address: 192.168.3.3:5353 interface: Wi-Fi type: udp4
2025-02-11 04:12:38.900 DEBUG  NodejsChannel        Initialize multicast address: ::%12:5353 interface: Wi-Fi type: udp6

Maybe ipv6 parser issue...? or something wrong with me?

@craftingmod craftingmod added bug Something isn't working needs triage labels Feb 10, 2025
@craftingmod
Copy link
Author

Seems like windows-only issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant