Skip to content

bind EINVAL on valid IPv6 Address (IPv4 works fine!) #37870

@yoyo00xx

Description

@yoyo00xx

What steps will reproduce the bug?

  1. Use the https library and bind an IPv6 localaddress

How often does it reproduce? Is there a required condition?

Can be reproduced with the usage of any IPv6 address in the interface

What is the expected behavior?

I am supposed to be able to make the request without any problems just like when binding an IPv4

What do you see instead?

bind EINVAL error

Additional information

I have tested with multiple IPv4 addresses in the interface and they all worked but non of the IPv6 are working

This is the code:

`const https = require('https');
(async () => {
const options = {
//Not real site
hostname: 'example.com',
path: '/test',
localAddress:'Ipv6 address'
}
https.get(options,(res) => {
let body = "";

    res.on("data", (chunk) => {
        body += chunk;
    });

    res.on("end", () => {
        try {
            let json = JSON.parse(body);
            console.log(json)
            // do something with JSON
        } catch (error) {
            console.error(error.message);
        };
    });

}).on("error", (error) => {
    console.error(error.message);
});

})();`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions