Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

src: include scopeid for IPv6 addresses #4880

Closed
wants to merge 2 commits into from

4 participants

Xidorn Quan Nodejs Jenkins Timothy J Fontaine Ben Noordhuis
Xidorn Quan

Include scopeid for IPv6 addresses in the output of os.networkInterfaces.

Xidorn Quan upsuper src: include scopeid for IPv6 addresses
Include scopeid for IPv6 addresses in the output of `os.networkInterfaces`.
a85117b
src/node_os.cc
@@ -235,6 +235,10 @@
o = Object::New();
o->Set(String::New("address"), String::New(ip));
o->Set(String::New("family"), family);
+ if (interfaces[i].address.address4.sin_family == AF_INET6) {
+ o->Set(String::New("scopeid"),
+ Number::New(interfaces[i].address.address6.sin6_scope_id));

Style: arguments should line up.

I guess it could be a call to Integer::NewFromUnsigned() because sin6_scope_id is a uint32_t.

Xidorn Quan
upsuper added a note

@bnoordhuis OK, I'll fix those problems. Do you have any suggestion for that the second line is still too long?

uint32_t scope_id = interfaces[i].address.address6.sin6_scope_id;
o->Set(String::New("scopeid"), Integer::NewFromUnsigned(scope_id));

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Nodejs Jenkins

Can one of the admins verify this patch?

Timothy J Fontaine
Owner

Rebased and squashed, thanks! Landed in ae02992

Timothy J Fontaine tjfontaine closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2013
  1. Xidorn Quan

    src: include scopeid for IPv6 addresses

    upsuper authored
    Include scopeid for IPv6 addresses in the output of `os.networkInterfaces`.
  2. Xidorn Quan

    os: correct type of scopeid

    upsuper authored
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/node_os.cc
4 src/node_os.cc
View
@@ -235,6 +235,10 @@ static Handle<Value> GetInterfaceAddresses(const Arguments& args) {
o = Object::New();
o->Set(String::New("address"), String::New(ip));
o->Set(String::New("family"), family);
+ if (interfaces[i].address.address4.sin_family == AF_INET6) {
+ uint32_t scopeid = interfaces[i].address.address6.sin6_scope_id;
+ o->Set(String::New("scopeid"), Integer::NewFromUnsigned(scopeid));
+ }
const bool internal = interfaces[i].is_internal;
o->Set(String::New("internal"),
Something went wrong with that request. Please try again.