- Testing Done:
-
~ ran traversity-test on linux (Debian Bookworm AMD64), OpenBSD 7.1 64bit, Freebsd 13.1 32bit, macOS Monterey 64bit, and Haiku OS (not sure version/arch).
~ ran traversity-test on Debian Bookworm AMD64, OpenBSD 7.1 64bit, Freebsd 13.1 32bit, macOS Monterey 64bit, and Haiku OS (not sure version/arch).
I also force the ioctl path on all of them, Haiku only uses the ioctl path, but OpenBSD does not support the ioctl path.
Implement traversity_core_get_local_ips for UNIX systems
Review Request #1963 — Created Oct. 25, 2022 and submitted
This is basically an import from the original code in purple2 with some clean ups.
ran traversity-test on Debian Bookworm AMD64, OpenBSD 7.1 64bit, Freebsd 13.1 32bit, macOS Monterey 64bit, and Haiku OS (not sure version/arch).
I also force the ioctl path on all of them, Haiku only uses the ioctl path, but OpenBSD does not support the ioctl path.
Summary | ID |
---|---|
208a31ff2c5986cc9e192683f36afb15d29f7e93 |
Description | From | Last Updated |
---|---|---|
Should we add some error information to error here in case of tmp being NULL? inet_ntop sets errno. |
ivanhoe | |
freeifaddrs is not called in case if this early return. |
ivanhoe | |
Should we use error to collect possible errors from socket, ioctl, and inet_ntop? |
ivanhoe | |
Is this a typo or some special version of ioctl that returns the error code? Judging from the Linux man … |
ivanhoe | |
Should free ifc.ifc_req in case of this early return. |
ivanhoe | |
Should free ifc.ifc_req in case of this early return. |
ivanhoe | |
I think the G_GNUC_UNUSED can be removed now. |
ivanhoe | |
Same as above, is it correct to use ret here instead of errno? |
ivanhoe |
-
-
-
-
The man page of netdevice suggests the following regarding the size of
buffer
:If the size specified by ifc_len is insufficient to store all the addresses, the kernel will skip the exceeding ones and return success. There is no reliable way of detecting this condition once it has occurred. It is therefore recommended to either determine the necessary buffer size beforehand by calling SIOCGIFCONF with ifc_req set to NULL, or to retry the call with a bigger buffer whenever ifc_len upon return differs by less than sizeof(struct ifreq) from its original value.
- Change Summary:
-
address issues
- Commits:
-
Summary ID b19bfb19bf5e9fa892262a097ca6cb7743f9c82f 4d54fd2002e8d5b564d89094786facf51bb7b517
- Change Summary:
-
special case haiku as it doesn't support calling SIOCGIFCONF with a NULL parameter to get the buffer size.
- Commits:
-
Summary ID 4d54fd2002e8d5b564d89094786facf51bb7b517 9ca25f34c40b66838b542dac2ee4b1ca6e38292f
- Change Summary:
-
fix typo
- Commits:
-
Summary ID 9ca25f34c40b66838b542dac2ee4b1ca6e38292f 9b0f18986dc12744cee8fac52d523681729e3312