tests: improved ipv6-prefix

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos
2020-03-12 19:20:42 +01:00
parent 449e608f86
commit bcc07c935e

View File

@@ -23,18 +23,17 @@
#include "../src/ip-util.h"
#include "../src/ip-util.c"
static char* my_ipv6_prefix_to_mask(const char *str, unsigned prefix)
static char* my_ipv6_prefix_to_mask(char str[MAX_IP_STR], unsigned prefix)
{
struct in6_addr in;
static char out[64];
if (ipv6_prefix_to_mask(&in, prefix) == 0)
return NULL;
if (inet_ntop(AF_INET6, &in, out, sizeof(out)) == NULL)
if (inet_ntop(AF_INET6, &in, str, MAX_IP_STR) == NULL)
return NULL;
return out;
return str;
}
int main()