1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-05 12:56:08 +00:00

Print sdl->sdl_data when sdl->sdl_nlen > 0 as link_ntoa(3) does.

MFC after:	1 week
This commit is contained in:
Hiroki Sato 2015-09-01 08:29:39 +00:00
parent 929d5af546
commit 27a1ccfc19
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287349

View File

@ -396,9 +396,24 @@ getnameinfo_link(const struct sockaddr *sa, socklen_t salen,
n = snprintf(host, hostlen, "link#%d", sdl->sdl_index);
if (n > hostlen) {
*host = '\0';
return EAI_MEMORY;
return (EAI_MEMORY);
}
return 0;
return (0);
}
if (sdl->sdl_nlen > 0) {
if (sdl->sdl_nlen + 1 > hostlen) {
*host = '\0';
return (EAI_MEMORY);
}
memcpy(host, sdl->sdl_data, sdl->sdl_nlen);
n = sdl->sdl_nlen;
host += n;
if (sdl->sdl_alen > 0) {
*host++ = ':';
n++;
}
hostlen -= n;
}
switch (sdl->sdl_type) {
@ -440,10 +455,7 @@ getnameinfo_link(const struct sockaddr *sa, socklen_t salen,
}
static int
hexname(cp, len, host, hostlen)
const u_int8_t *cp;
char *host;
size_t len, hostlen;
hexname(const u_int8_t *cp, size_t len, char *host, size_t hostlen)
{
int i, n;
char *outp = host;