Attention is currently required from: neels.
pespin has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmocore/+/35180?usp=email )
Change subject: socket: Introduce API osmo_sock_multiaddr_get_name_buf()
......................................................................
Patch Set 1:
(5 comments)
File src/core/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/35180/comment/ec1feec8_ff7c2583
PS1, Line 1968: return -EBADF;
i understand, but for the snprintf() like function
signature, if at all possible you should always r […]
Ack
https://gerrit.osmocom.org/c/libosmocore/+/35180/comment/1411b96c_cca4890e
PS1, Line 1993: v6 = !!s
assigning a value to is_v6 in an 'else' clause
and using is_v6 below. […]
I only care about checking if the address is ipv6 in the
case where we only have 1 IP, because in that case I need to put "[]" around it
to separate it from the port number. If there's more than 1, no need, because
everything is already enclosed in "()".
So by doing it here I avoid doing a lookup in a string unless it's strictly needed.
https://gerrit.osmocom.org/c/libosmocore/+/35180/comment/489652e3_5bf0d19e
PS1, Line 2005: OSMO_STRBUF_PRINTF(sb, "<need-more-bufs!>");
(could print this above instead of adding the
need_more_bufs local var, just my opinion) […]
I could write an entire novel
explaining the error there, but have that token printed and looking at the code already
quickly explains what's going on.
I want to print it here because at least is provides as many addresses as it can fit.
https://gerrit.osmocom.org/c/libosmocore/+/35180/comment/ad4d2b6d_0d053a6e
PS1, Line 2019: bool is_v6 = false;
(can this code dup be collapsed with the above, maybe
with a static func?)
It could, I'd need to pass the sb as a param and so on, and
I'm not sure if the macros can use an sb pointer....
https://gerrit.osmocom.org/c/libosmocore/+/35180/comment/4852c8d4_24954207
PS1, Line 2052: int osmo_sock_get_name_buf(char *str, size_t str_len, int fd)
my first thought is "yes, sounds good". […]
I prefer keeping the multiaddr prefix instead of a "2", we already use it
in several places. This way code knowing only to be handling single address protocols can
keep using it.
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/35180?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I48950754ed6f61ee5ffa04a447fab8903f10acc0
Gerrit-Change-Number: 35180
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 01 Dec 2023 15:33:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment