Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2022-05-10 12:10:03 +0300
committerDanielle Adams <adamzdanielle@gmail.com>2022-06-16 04:28:47 +0300
commit0bb84b09a55eb1605b8e231529d10f15aa9ed7f1 (patch)
treece1652a94c9923fb088de398ebe8be8d2d48d3fe /src/node_os.cc
parentf91babe49409c4dd9d1093959522c84f48e0576a (diff)
dns: accept `'IPv4'` and `'IPv6'` for `family`
Refs: https://github.com/nodejs/node/issues/43014 PR-URL: https://github.com/nodejs/node/pull/43054 Fixes: https://github.com/nodejs/node/issues/43014 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/node_os.cc')
-rw-r--r--src/node_os.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_os.cc b/src/node_os.cc
index 6e62af00f5f..046a6106ccd 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -174,8 +174,7 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
char ip[INET6_ADDRSTRLEN];
char netmask[INET6_ADDRSTRLEN];
std::array<char, 18> mac;
- Local<String> name;
- Local<Integer> family;
+ Local<String> name, family;
int err = uv_interface_addresses(&interfaces, &count);
@@ -215,14 +214,14 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
if (interfaces[i].address.address4.sin_family == AF_INET) {
uv_ip4_name(&interfaces[i].address.address4, ip, sizeof(ip));
uv_ip4_name(&interfaces[i].netmask.netmask4, netmask, sizeof(netmask));
- family = Integer::New(env->isolate(), 4);
+ family = env->ipv4_string();
} else if (interfaces[i].address.address4.sin_family == AF_INET6) {
uv_ip6_name(&interfaces[i].address.address6, ip, sizeof(ip));
uv_ip6_name(&interfaces[i].netmask.netmask6, netmask, sizeof(netmask));
- family = Integer::New(env->isolate(), 6);
+ family = env->ipv6_string();
} else {
strncpy(ip, "<unknown sa family>", INET6_ADDRSTRLEN);
- family = Integer::New(env->isolate(), 0);
+ family = env->unknown_string();
}
result.emplace_back(name);