Blame src/regression/inet_ntop-v4mapped.c
|
Szabolcs Nagy |
1a301b |
// commit: 1cd417bdf10366d63cc875e285c6418709a58c17 2013-07-25
|
|
Szabolcs Nagy |
1a301b |
// inet_ntop should use ipv4 notation for v4mapped addresses
|
|
Szabolcs Nagy |
1a301b |
#include <string.h>
|
|
Szabolcs Nagy |
1a301b |
#include <arpa/inet.h>
|
|
Szabolcs Nagy |
1a301b |
#include "test.h"
|
|
Szabolcs Nagy |
1a301b |
|
|
Szabolcs Nagy |
1a301b |
int main(void)
|
|
Szabolcs Nagy |
1a301b |
{
|
|
Szabolcs Nagy |
1a301b |
char *expect = "::ffff:192.168.0.1";
|
|
Szabolcs Nagy |
1a301b |
char buf[100];
|
|
Szabolcs Nagy |
1a301b |
char addr[16];
|
|
Szabolcs Nagy |
1a301b |
if (inet_pton(AF_INET6, expect, addr) == 1) {
|
|
Szabolcs Nagy |
1a301b |
if (!inet_ntop(AF_INET6, addr, buf, sizeof buf))
|
|
Szabolcs Nagy |
1a301b |
t_error("inet_ntop failed\n");
|
|
Szabolcs Nagy |
1a301b |
else if (!strchr(buf, '.'))
|
|
Szabolcs Nagy |
1a301b |
t_error("inet_ntop produced %s instead of %s\n", buf, expect);
|
|
Szabolcs Nagy |
1a301b |
} else {
|
|
Szabolcs Nagy |
1a301b |
t_error("inet_pton failed\n");
|
|
Szabolcs Nagy |
1a301b |
}
|
|
Szabolcs Nagy |
1a301b |
return t_status;
|
|
Szabolcs Nagy |
1a301b |
}
|