Skip to content

Commit ae02992

Browse files
upsupertjfontaine
authored andcommitted
os: networkInterfaces include scopeid for ipv6
1 parent 937e2e3 commit ae02992

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/node_os.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ using v8::Context;
5050
using v8::FunctionCallbackInfo;
5151
using v8::Handle;
5252
using v8::HandleScope;
53+
using v8::Integer;
5354
using v8::Local;
5455
using v8::Number;
5556
using v8::Object;
@@ -272,6 +273,12 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
272273
o->Set(FIXED_ONE_BYTE_STRING(node_isolate, "mac"),
273274
FIXED_ONE_BYTE_STRING(node_isolate, mac));
274275

276+
if (interfaces[i].address.address4.sin_family == AF_INET6) {
277+
uint32_t scopeid = interfaces[i].address.address6.sin6_scope_id;
278+
o->Set(FIXED_ONE_BYTE_STRING(node_isolate, "scopeid"),
279+
Integer::NewFromUnsigned(scopeid));
280+
}
281+
275282
const bool internal = interfaces[i].is_internal;
276283
o->Set(FIXED_ONE_BYTE_STRING(node_isolate, "internal"),
277284
internal ? True(node_isolate) : False(node_isolate));

0 commit comments

Comments
 (0)