Attention is currently required from: msuraev, dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28995 )
Change subject: Make osmo_sockaddr_str_from_sockaddr() less picky ......................................................................
Patch Set 7: Code-Review-2
(1 comment)
File src/sockaddr_str.c:
https://gerrit.osmocom.org/c/libosmocore/+/28995/comment/e33a20a3_838eba20 PS7, Line 389: guess = (src->ss_family == AF_UNSPEC) ? osmo_sockaddr_guess_unspec((const struct sockaddr *)src) : src->ss_family; This all looks wrong to me, or I'm missing soemthing. So you have a sockaddr_storage, which has size enough to contain whatever. Let's say it has ss_family=AF_UNSPEC; so you call osmo_sockaddr_guess_unspec() on it.
Then, osmo_sockaddr_guess_unspec() calls osmo_sockaddr_str_from_in6_addr() on it, which should convert fine no matter the random contents in the struct, since any possible value is acceptable in there.
So you end up handling AD_UNSPEC as AF_INET6, printing random stuff which may not be correct.