2 * Copyright (c) 2013 Proofpoint, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
11 SM_IDSTR(id, "@(#)$Id: t-inet6_ntop.c,v 1.2 2013-11-22 20:51:43 ca Exp $")
17 #include <sm/string.h>
18 #include <sys/socket.h>
19 #include <netinet/in.h>
20 #include <arpa/inet.h>
22 static char *ipv6f[] = {
23 "1234:5678:9abc:def0:fedc:dead:f00f:101",
24 "1080:0:0:0:8:800:200c:417a",
25 "ff01:0:0:0:0:0:0:43",
43 struct sockaddr_in6 addr;
44 char *ip, *ipf, ipv6str[INET6_ADDRSTRLEN];
46 for (i = 0; (ip = ipv6f[i]) != NULL; i++) {
47 r = inet_pton(AF_INET6, ip, &addr.sin6_addr);
49 ipf = sm_inet6_ntop(&addr.sin6_addr, ipv6str, sizeof(ipv6str));
51 SM_TEST(strcmp(ipf, ip) == 0);
60 sm_test_begin(argc, argv, "test inet6_ntop");