Skip to content

Commit

Permalink
deps: upgrade to libuv 1.34.2
Browse files Browse the repository at this point in the history
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs#31328
Fixes: nodejs/help#2099

PR-URL: nodejs#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
cjihrig authored and Trott committed Jan 25, 2020
1 parent 3188afe commit 05d350a
Show file tree
Hide file tree
Showing 16 changed files with 491 additions and 243 deletions.
23 changes: 23 additions & 0 deletions deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2020.01.24, Version 1.34.2 (Stable), f868c9ab0c307525a16fff99fd21e32a6ebc3837

Changes since version 1.34.1:

* misc: adjust stalebot deadlines (Jameson Nash)

* test: fix env-vars flakiness (cjihrig)

* test: avoid truncating output lines (Jameson Nash)

* darwin: stop calling SetApplicationIsDaemon() (Ben Noordhuis)

* ibmi: implement uv_interface_addresses() (Xu Meng)

* osx,fsevent: fix race during uv_loop_close (Jameson Nash)

* osx,fsevent: clear pointer when deleting it [NFCI] (Jameson Nash)

* Revert "aix: replace ECONNRESET with EOF if already closed" (Jameson Nash)

* unix: handle uv__open_cloexec return value correctly (Anna Henningsen)


2020.01.13, Version 1.34.1 (Stable), 8aa5636ec72990bb2856f81e14c95813024a5c2b

Changes since version 1.34.0:
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_PREREQ(2.57)
AC_INIT([libuv], [1.34.1], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.34.2], [https://github.com/libuv/libuv/issues])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/as_case.m4])
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/include/uv/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 34
#define UV_VERSION_PATCH 1
#define UV_VERSION_PATCH 2
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""

Expand Down
180 changes: 0 additions & 180 deletions deps/uv/src/unix/aix-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,183 +155,3 @@ int uv_exepath(char* buffer, size_t* size) {
return UV_EINVAL;
}
}


int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
uv_interface_address_t* address;
int sockfd, sock6fd, inet6, i, r, size = 1;
struct ifconf ifc;
struct ifreq *ifr, *p, flg;
struct in6_ifreq if6;
struct sockaddr_dl* sa_addr;

ifc.ifc_req = NULL;
sock6fd = -1;
r = 0;
*count = 0;
*addresses = NULL;

if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) {
r = UV__ERR(errno);
goto cleanup;
}

if (0 > (sock6fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP))) {
r = UV__ERR(errno);
goto cleanup;
}

if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) {
r = UV__ERR(errno);
goto cleanup;
}

ifc.ifc_req = (struct ifreq*)uv__malloc(size);
if (ifc.ifc_req == NULL) {
r = UV_ENOMEM;
goto cleanup;
}
ifc.ifc_len = size;
if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) {
r = UV__ERR(errno);
goto cleanup;
}

#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p))

/* Count all up and running ipv4/ipv6 addresses */
ifr = ifc.ifc_req;
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
p = ifr;
ifr = (struct ifreq*)
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));

if (!(p->ifr_addr.sa_family == AF_INET6 ||
p->ifr_addr.sa_family == AF_INET))
continue;

memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
r = UV__ERR(errno);
goto cleanup;
}

if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
continue;

(*count)++;
}

if (*count == 0)
goto cleanup;

/* Alloc the return interface structs */
*addresses = uv__calloc(*count, sizeof(**addresses));
if (!(*addresses)) {
r = UV_ENOMEM;
goto cleanup;
}
address = *addresses;

ifr = ifc.ifc_req;
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
p = ifr;
ifr = (struct ifreq*)
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));

if (!(p->ifr_addr.sa_family == AF_INET6 ||
p->ifr_addr.sa_family == AF_INET))
continue;

inet6 = (p->ifr_addr.sa_family == AF_INET6);

memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1)
goto syserror;

if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
continue;

/* All conditions above must match count loop */

address->name = uv__strdup(p->ifr_name);

if (inet6)
address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr);
else
address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr);

if (inet6) {
memset(&if6, 0, sizeof(if6));
r = uv__strscpy(if6.ifr_name, p->ifr_name, sizeof(if6.ifr_name));
if (r == UV_E2BIG)
goto cleanup;
r = 0;
memcpy(&if6.ifr_Addr, &p->ifr_addr, sizeof(if6.ifr_Addr));
if (ioctl(sock6fd, SIOCGIFNETMASK6, &if6) == -1)
goto syserror;
address->netmask.netmask6 = *((struct sockaddr_in6*) &if6.ifr_Addr);
/* Explicitly set family as the ioctl call appears to return it as 0. */
address->netmask.netmask6.sin6_family = AF_INET6;
} else {
if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1)
goto syserror;
address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr);
/* Explicitly set family as the ioctl call appears to return it as 0. */
address->netmask.netmask4.sin_family = AF_INET;
}

address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;

address++;
}

/* Fill in physical addresses. */
ifr = ifc.ifc_req;
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
p = ifr;
ifr = (struct ifreq*)
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));

if (p->ifr_addr.sa_family != AF_LINK)
continue;

address = *addresses;
for (i = 0; i < *count; i++) {
if (strcmp(address->name, p->ifr_name) == 0) {
sa_addr = (struct sockaddr_dl*) &p->ifr_addr;
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
}
address++;
}
}

#undef ADDR_SIZE
goto cleanup;

syserror:
uv_free_interface_addresses(*addresses, *count);
*addresses = NULL;
*count = 0;
r = UV_ENOSYS;

cleanup:
if (sockfd != -1)
uv__close(sockfd);
if (sock6fd != -1)
uv__close(sock6fd);
uv__free(ifc.ifc_req);
return r;
}


void uv_free_interface_addresses(uv_interface_address_t* addresses,
int count) {
int i;

for (i = 0; i < count; ++i) {
uv__free(addresses[i].name);
}

uv__free(addresses);
}
Loading

0 comments on commit 05d350a

Please sign in to comment.