aix: add netmask, mac address into net interfaces#1410
aix: add netmask, mac address into net interfaces#1410gireeshpunathil wants to merge 1 commit intolibuv:v1.xfrom
Conversation
| continue; | ||
|
|
||
| if (p->ifr_addr.sa_family == AF_INET6) | ||
| inet6 = 1; |
There was a problem hiding this comment.
Simplify to inet6 = (p->ifr_addr.sa_family == AF_INET6)? That also lets you drop the assignment on line 1081.
There was a problem hiding this comment.
thanks, done.
| } | ||
|
|
||
| /* TODO: Retrieve netmask using SIOCGIFNETMASK ioctl */ | ||
| memset(address->phys_addr, 0, sizeof(address->phys_addr)); |
| sa_addr = (struct sockaddr_dl*) &p->ifr_addr; | ||
| memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); | ||
|
|
||
| if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) { |
There was a problem hiding this comment.
Is there a plausible scenario where this could fail?
There was a problem hiding this comment.
There is no documented evidence about ioctl on SIOCGIFNETMASK could fail in any AIX versions due to known functional limitations but based on the runtime characteristics, the usual suspects apply:
EAGAIN: Unable to allocate buffers for the output (p).
EBADF: Bad file descriptor (sockfd)
EINVAL: invalid pointer (in p)
EINTR: system call was interrupted
...
c523e1a to
de4e15a
Compare
santigimeno
left a comment
There was a problem hiding this comment.
LGTM with a couple of nits
| address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr); | ||
| } else { | ||
| address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr); | ||
| } |
There was a problem hiding this comment.
style: while you're here you could remove the braces
There was a problem hiding this comment.
sure, thanks. removed.
| address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr); | ||
| } else { | ||
| address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr); | ||
| } |
uv_interface_addresses API extracts the network interface entries. In AIX, this was not fully implemented. retrieve the network mask and the mac addresses. Fixes: nodejs/node#14119
de4e15a to
d6a4994
Compare
cjihrig
left a comment
There was a problem hiding this comment.
LGTM pending CI.
CI: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/330/
uv_interface_addresses API extracts the network interface entries. In AIX, this was not fully implemented. retrieve the network mask and the mac addresses. Fixes: nodejs/node#14119 PR-URL: #1410 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
|
Cheers Gireesh, landed in 810377f. |
|
thank you! |
|
Could someone help me testing this? |
|
@kuroljov Can you be more specific? What do you need help with? |
|
nodejs/node@1c142ff#diff-c7afac570407fa8ca5c2298e0b7ac4b9R173 |
|
No, it should work like other platforms now. |
|
@bnoordhuis thanks |
uv_interface_addresses API extracts the network interface entries.
In AIX, this was not fully implemented. retrieve the network mask and
the mac addresses.
Fixes: nodejs/node#14119