Skip to content

Commit

Permalink
os: networkInterfaces include scopeid for ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
upsuper authored and tjfontaine committed Feb 18, 2014
1 parent 937e2e3 commit ae02992
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope;
using v8::Integer;
using v8::Local;
using v8::Number;
using v8::Object;
Expand Down Expand Up @@ -272,6 +273,12 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
o->Set(FIXED_ONE_BYTE_STRING(node_isolate, "mac"),
FIXED_ONE_BYTE_STRING(node_isolate, mac));

if (interfaces[i].address.address4.sin_family == AF_INET6) {
uint32_t scopeid = interfaces[i].address.address6.sin6_scope_id;
o->Set(FIXED_ONE_BYTE_STRING(node_isolate, "scopeid"),
Integer::NewFromUnsigned(scopeid));
}

const bool internal = interfaces[i].is_internal;
o->Set(FIXED_ONE_BYTE_STRING(node_isolate, "internal"),
internal ? True(node_isolate) : False(node_isolate));
Expand Down

0 comments on commit ae02992

Please sign in to comment.