Sometimes INET6_ADDRSTRLEN is 48 (#46)
Co-authored-by: Doug Cook (WINDOWS) <dcook@windows.microsoft.com>
This commit is contained in:
Родитель
cc98576a9f
Коммит
20797b28fe
|
@ -705,10 +705,10 @@ void lttngh_FormatIPv4(const void* pIPv4, char* buf16) lttng_ust_notrace;
|
|||
|
||||
/*
|
||||
Formats a 16-byte IPv6 address as a nul-terminated string.
|
||||
Output buffer is assumed to be at least 46 chars.
|
||||
Output buffer is assumed to be at least LTTNGH_FORMAT_IPV6_LEN chars.
|
||||
*/
|
||||
void lttngh_FormatIPv6(const void* pIPv6, char* buf46) lttng_ust_notrace;
|
||||
#define LTTNGH_FORMAT_IPV6_LEN 46u // Buffer length for lttngh_FormatIPv6.
|
||||
void lttngh_FormatIPv6(const void* pIPv6, char* buf48) lttng_ust_notrace;
|
||||
#define LTTNGH_FORMAT_IPV6_LEN 48u // Buffer length for lttngh_FormatIPv6.
|
||||
|
||||
/*
|
||||
Formats a sockaddr as a nul-terminated string.
|
||||
|
|
|
@ -11,16 +11,18 @@
|
|||
|
||||
void lttngh_FormatIPv4(const void* pIPv4, char* buf16)
|
||||
{
|
||||
buf16[0] = 0;
|
||||
inet_ntop(AF_INET, pIPv4, buf16, LTTNGH_FORMAT_IPV4_LEN);
|
||||
assert(strlen(buf16) < LTTNGH_FORMAT_IPV4_LEN);
|
||||
buf16[LTTNGH_FORMAT_IPV4_LEN - 1] = 0;
|
||||
}
|
||||
|
||||
void lttngh_FormatIPv6(const void* pIPv6, char* buf46)
|
||||
void lttngh_FormatIPv6(const void* pIPv6, char* buf48)
|
||||
{
|
||||
inet_ntop(AF_INET6, pIPv6, buf46, LTTNGH_FORMAT_IPV6_LEN);
|
||||
assert(strlen(buf46) < LTTNGH_FORMAT_IPV6_LEN);
|
||||
buf46[LTTNGH_FORMAT_IPV6_LEN - 1] = 0;
|
||||
buf48[0] = 0;
|
||||
inet_ntop(AF_INET6, pIPv6, buf48, LTTNGH_FORMAT_IPV6_LEN);
|
||||
assert(strlen(buf48) < LTTNGH_FORMAT_IPV6_LEN);
|
||||
buf48[LTTNGH_FORMAT_IPV6_LEN - 1] = 0;
|
||||
}
|
||||
|
||||
void lttngh_FormatSockaddr(const void* pSockaddr, unsigned cbSockaddr,
|
||||
|
|
Загрузка…
Ссылка в новой задаче