GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: don't print interface if sin6_scope_id is 0 · nodejs/node@6076291

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • tcp_wrap.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/tcp_wrap.cc‎

Copy file name to clipboardExpand all lines: src/tcp_wrap.cc
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,20 @@ Local<Object> AddressToJS(Environment* env,
360360
a6 = reinterpret_cast<const sockaddr_in6*>(addr);
361361
uv_inet_ntop(AF_INET6, &a6->sin6_addr, ip, sizeof ip);
362362
// Add an interface identifier to a link local address.
363-
if (IN6_IS_ADDR_LINKLOCAL(&a6->sin6_addr)) {
364-
const size_t addrlen = strlen(ip);
365-
CHECK_LT(addrlen, sizeof(ip));
366-
ip[addrlen] = '%';
367-
size_t scopeidlen = sizeof(ip) - addrlen - 1;
368-
CHECK_GE(scopeidlen, UV_IF_NAMESIZE);
369-
const int r = uv_if_indextoiid(a6->sin6_scope_id,
370-
ip + addrlen + 1,
371-
&scopeidlen);
372-
CHECK_EQ(r, 0);
363+
if (IN6_IS_ADDR_LINKLOCAL(&a6->sin6_addr) && a6->sin6_scope_id > 0) {
364+
const size_t addrlen = strlen(ip);
365+
CHECK_LT(addrlen, sizeof(ip));
366+
ip[addrlen] = '%';
367+
size_t scopeidlen = sizeof(ip) - addrlen - 1;
368+
CHECK_GE(scopeidlen, UV_IF_NAMESIZE);
369+
const int r = uv_if_indextoiid(a6->sin6_scope_id,
370+
ip + addrlen + 1,
371+
&scopeidlen);
372+
if (r) {
373+
env->ThrowUVException(r, "uv_if_indextoiid");
374+
// TODO(addaleax): Do proper MaybeLocal handling here
375+
return scope.Escape(info);
376+
}
373377
}
374378
port = ntohs(a6->sin6_port);
375379
info->Set(env->context(),

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.