From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2204 invoked from network); 10 Jul 2022 18:07:08 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 10 Jul 2022 18:07:08 -0000 Received: (qmail 7730 invoked by uid 550); 10 Jul 2022 18:07:04 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7694 invoked from network); 10 Jul 2022 18:07:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1657476412; bh=bSN+1KD7Oq5A5pE2kmWIC0S7CcWzNnXj62+dEl7cb8k=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=GKJYZGmYH85+JRd26HV/AGDkOChu3TYc9970lQzEreeBIl/Th5A0EZhp4JSZEhdAe YH4UPfUdCn/GROnpp8rBvygSXVjWOK7Ja9SjstnlWM7cbS+SGRhwr+ImPhlqSyozqt 6ORj9I3qrRjUVZR9o4ZSDCQODZfxoMeymDaRa0Ao= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Date: Sun, 10 Jul 2022 20:06:51 +0200 From: Markus Wichmann To: musl@lists.openwall.com Message-ID: <20220710180651.GC2522@voyager> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Provags-ID: V03:K1:s0Aw/JwEkwWWpNkpKSbBALtVwrK00PFvm2Y2tjv+IQ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CaqvYSZB8QkQSdZAfj3uncAysktoyElHz0uEuSQc 9gK8PGSA7OFg2UHf3DBOYYDx2gLzl3UG7cd6Up0CQDxNyPFh6kMuEwHAg4RR+Fkn3iODHRsfR tib2x0XuVYBhLLyA10Yvs6xw360mIq1yV1pFVssrN/rUrm5Ew136OmGVjY7bJVgmNBsVH4t/t L8cDFLwXxKesR0KyVXSQTwS+UrIfDpsIIx3zOuhxoRzHvQAlEW9H9SnGQ7HgEJxE5Auv4Sid5 PB3Iu5FY2CzG3D4vO/5LyjGHBLjkT75af6IrDkLyb0DJ3ZvNgnGjr/81w== Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] AF_LOCAL On Sun, Jul 10, 2022 at 04:32:51PM +0200, Tomasz Duda wrote: > Hi, > > I'm using > python:3.9-alpine3.14 > It looks that AF_LOCAL is not implemented. > It would be nice if you could include it. > > BR, > TD > It would have been nice to mention you mean getnameinfo(). I wonder if this is even valid, since you cannot call getaddrinfo() with the node and service gained from here and get the socket address back out. I skimmed POSIX on these functions but could not identify if adding AF_LOCAL is OK. > diff --git a/src/network/getnameinfo.c b/src/network/getnameinfo.c > index 949e181..7d3a9c3 100644 > --- a/src/network/getnameinfo.c > +++ b/src/network/getnameinfo.c > @@ -11,7 +11,9 @@ > #include > #include "lookup.h" > #include "stdio_impl.h" > +#include > +#define MIN(a,b) ((a)<(b) ? (a) : (b)) > #define PTR_MAX (64 + sizeof ".in-addr.arpa") > #define RR_PTR 12 > @@ -118,6 +120,29 @@ static int dns_parse_callback(void *c, int rr, cons= t > void *data, int len, const > } > +/* > + * getnameinfo_local(): > + * Format an local address into a printable format. > + */ What is this? Documentation comments are not present anywhere else in the code. > +/* ARGSUSED */ What is this? I've seen these comments before, and they are usually used to silence some kind of linter. But again, these are not used anywhere else in the code. > +static int > +getnameinfo_local(const struct sockaddr *sa, socklen_t salen, > + char *host, socklen_t hostlen, char *serv, socklen_t servlen, > + int flags __attribute__((unused))) We generally don't use GCC attributes unless we can help it. In this case there is no reason for the attribute, but neither is there for the argument. You could just drop it. > +{ > + const struct sockaddr_un *sun =3D > + (const struct sockaddr_un *)(const void *)sa; Why the two conversions? Wouldn't either one suffice? > + if (salen < (socklen_t) offsetof(struct sockaddr_un, sun_path)) { > + return EAI_FAMILY; > + } > + if (serv !=3D NULL && servlen > 0) > + serv[0] =3D '\0'; > + if (host && hostlen > 0) > + strncpy(host, sun->sun_path, > + MIN((socklen_t) sizeof(sun->sun_path) + 1, hostlen)); > + return 0; > +} > + The sizeof expression is invalid; the size of the path field is salen - offsetof(struct sockaddr_un, sun_path). The + 1 is invalid as well (sizeof already gives you the maximum, anyway, you cannot validly go beyond it). And the construction ignores abstract addresses (first path byte is zero, then the name is whatever octets follow, for however much the length given is). Ciao, Markus