Testing Done: |
|
---|
Implement traversity_core_get_local_ips for UNIX systems
Review Request #1963 — Created Oct. 25, 2022 and submitted
Information | |
---|---|
grim | |
traversity/traversity | |
default | |
Reviewers | |
pidgin | |
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 | |
---|---|
Description | From | Last Updated |
---|---|---|
Should we add some error information to error here in case of tmp being NULL? inet_ntop sets errno. |
![]() |
|
freeifaddrs is not called in case if this early return. |
![]() |
|
Should we use error to collect possible errors from socket, ioctl, and inet_ntop? |
![]() |
|
Is this a typo or some special version of ioctl that returns the error code? Judging from the Linux man … |
![]() |
|
Should free ifc.ifc_req in case of this early return. |
![]() |
|
Should free ifc.ifc_req in case of this early return. |
![]() |
|
I think the G_GNUC_UNUSED can be removed now. |
![]() |
|
Same as above, is it correct to use ret here instead of errno? |
![]() |

-
-
traversity/traversitycoreunix.c (Diff revision 1) Should we add some error information to
error
here in case oftmp
beingNULL
?inet_ntop
setserrno
. -
traversity/traversitycoreunix.c (Diff revision 1) Should we use
error
to collect possible errors fromsocket
,ioctl
, andinet_ntop
? -
traversity/traversitycoreunix.c (Diff revision 1) 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: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+554 -30) |
Change Summary:
special case haiku as it doesn't support calling SIOCGIFCONF with a NULL parameter to get the buffer size.
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+712 -30) |
Change Summary:
fix typo
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+712 -30) |

-
-
traversity/traversitycoreunix.c (Diff revisions 1 - 4) freeifaddrs
is not called in case if this early return. -
traversity/traversitycoreunix.c (Diff revisions 1 - 4) Is this a typo or some special version of
ioctl
that returns the error code? Judging from the Linux man page ofioctl
this should beg_strerror(errno)
. Same issue on line 161. -
traversity/traversitycoreunix.c (Diff revisions 1 - 4) Should free
ifc.ifc_req
in case of this early return. -
traversity/traversitycoreunix.c (Diff revisions 1 - 4) Should free
ifc.ifc_req
in case of this early return. -
traversity/traversitycoreunix.c (Diff revisions 1 - 4) I think the
G_GNUC_UNUSED
can be removed now. -
traversity/traversitycoreunix.c (Diff revisions 1 - 4) Same as above, is it correct to use
ret
here instead oferrno
?
Change Summary:
address issues
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+724 -30) |