aix,ibmi: use uv_interface_addresses instead of getifaddrs#4222
Conversation
Yes, unnecessary extra memory allocations. Both getifaddrs() and uv_interface_addresses() malloc. |
|
Ah that makes sense. In that case, maybe we should check if ifaddrs is available if so use else fallback to call uv_interface_addresses? Are there any existing variables we can check if ifaddrs is available? |
|
Ran Test Build on AIX CI: https://ci.nodejs.org/job/libuv-test-commit-aix/nodes=aix72-ppc64/2275/console 68 being returned here looks to map to EADDRNOTAVAIL FWIW Test build on Linux was successful: https://ci.nodejs.org/job/libuv-test-commit-linux/nodes=fedora-latest-x64/2372/console |
FWIW from the same job the only interface on the machine with an IPv6 address is lo0: # uv_interface_addresses:
# name: en0
# internal: 0
# physical address: 2a:b0:26:58:5b:02
# address: 10.1.0.6
# netmask: 255.255.254.0
# name: en1
# internal: 0
# physical address: 2a:b0:26:58:5b:03
# address: 140.211.9.101
# netmask: 255.255.255.0
# name: lo0
# internal: 1
# physical address: 00:00:00:00:00:00
# address: 127.0.0.1
# netmask: 255.0.0.0
# name: lo0
# internal: 1
# physical address: 00:00:00:00:00:00
# address: ::1
# netmask: ffff:ffff:ffff:ffff:: |
This is wip PR to test if uv_interface_addresses could be used instead of getifaddrs in `uv__ipv6_link_local_scope_id` https://github.com/libuv/libuv/blob/54d8364c2406758b572621af381f1d83e01ae46c/src/unix/tcp.c#L226-L248 AIX does not have getifaddrs but we do have code in `uv_interface_addresses` to get the interface addresses. https://github.com/libuv/libuv/blob/f01219dfb716ceac9cc7dbc70022a197b20d27b3/src/unix/aix.c#L1116-L1293 Looks like `uv_interface_addresses` uses getifaddrs on Linux https://github.com/libuv/libuv/blob/f01219dfb716ceac9cc7dbc70022a197b20d27b3/src/unix/linux.c#L1927-L2012 Part of #4117
|
I found that after my I opened my PR there was another another commit 54d8364 was added in the test code that checks if the link local traffic is supported . So I re-based this PR and re-ran the AIX CI and got back the following: https://ci.nodejs.org/job/libuv-test-commit-aix/nodes=aix72-ppc64/2277/console So yeah the error I was getting before on AIX in #4222 (comment) looks to be caused by the link local address not being supported on the machine. |
AIX does not implement ifaddrs and when retrieving the network interfaces with uv_interface_addresses there was a test failure in tcp_connect6_link_local. For now disable ipv6 link local on aix to: 1) fix broken aix build 2) stop blocking libuv upgrade in node Refs: #4222 (comment) Refs: nodejs/node#50650
Original commit message: aix: disable ipv6 link local (#4229) AIX does not implement ifaddrs and when retrieving the network interfaces with uv_interface_addresses there was a test failure in tcp_connect6_link_local. For now disable ipv6 link local on aix to: 1) fix broken aix build 2) stop blocking libuv upgrade in node Refs: libuv/libuv#4222 (comment) Refs: #50650 Refs: libuv/libuv@bfbe4e3
Original commit message: aix: disable ipv6 link local (#4229) AIX does not implement ifaddrs and when retrieving the network interfaces with uv_interface_addresses there was a test failure in tcp_connect6_link_local. For now disable ipv6 link local on aix to: 1) fix broken aix build 2) stop blocking libuv upgrade in node Refs: libuv/libuv#4222 (comment) Refs: #50650 Refs: libuv/libuv@bfbe4e3 PR-URL: #50650 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
|
Test Build @ ce65f1d AIX: https://ci.nodejs.org/job/libuv-test-commit-aix/nodes=aix72-ppc64/2281/console These are looking good. I need to rebase on latest v1.x to fixup the IBM i failure: #4197 |
Original commit message: aix: disable ipv6 link local (#4229) AIX does not implement ifaddrs and when retrieving the network interfaces with uv_interface_addresses there was a test failure in tcp_connect6_link_local. For now disable ipv6 link local on aix to: 1) fix broken aix build 2) stop blocking libuv upgrade in node Refs: libuv/libuv#4222 (comment) Refs: #50650 Refs: libuv/libuv@bfbe4e3 PR-URL: #50650 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
Latest Test builds: See: #4222 (comment) I will now work on re-basing this PR to fix up the conflicts |
|
Test builds after resolving conflicts IBM i: https://ci.nodejs.org/job/libuv-test-commit-ibmi/nodes=ibmi73-ppc64/1228/console |
|
After review, please squash and merge these commits into 1 commit. |
|
One question: the comments and the commit log say "aix and ibmi" but the ifdef guard only checks AIX. Is this PR just for AIX or for both platforms? |
Good question, This PR would apply to both platforms because |
Use uv_interface_addresses to get the interfaces addresses on AIX and IBM i as ifaddrs is not available on these platforms.
After retrieving the interfaces we can then set the ipv6 link local scope id.
libuv/src/unix/tcp.c
Lines 226 to 248 in 54d8364
AIX does not have
getifaddrsbut we do have code inuv_interface_addressesto get the interface addresses.libuv/src/unix/aix.c
Lines 1116 to 1293 in f01219d
Looks like
uv_interface_addressesuses getifaddrs on Linuxlibuv/src/unix/linux.c
Lines 1927 to 2012 in f01219d
@bnoordhuis is there a reason why we shouldn't use uv_interface_addresses in
uv__ipv6_link_local_scope_id?CC
@richardlau
Part of #4117