aboutsummaryrefslogtreecommitdiffstats
path: root/test-localuser.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-11-27 18:31:42 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2019-11-28 15:36:43 +0100
commit66803c6fdb609ed83a78b9194ecb23e9c1b773e7 (patch)
treef0c9def22d22126d3db686584ab0235969cf86f0 /test-localuser.c
parentba89d6ff99e42a69a347ee2fdbe8fb85ae96fb1c (diff)
Add applications the the localuser familyicefish_8.99.2icefish/8.99.28.99.2
This proposal allows to use separate names for separate applications and separate users running on the loopback interface. Bug-AGL: SPEC-2968 Change-Id: I7c25e89da9f51c10c59a72670339f2ea55b31997 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'test-localuser.c')
-rw-r--r--test-localuser.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test-localuser.c b/test-localuser.c
index ed27138..7029fd9 100644
--- a/test-localuser.c
+++ b/test-localuser.c
@@ -20,6 +20,7 @@
* THE SOFTWARE.
*/
#include <stdio.h>
+#include <stdint.h>
#include <netdb.h>
void dumphostent(char *tag, char *arg, struct hostent *h)
@@ -33,6 +34,12 @@ void dumphostent(char *tag, char *arg, struct hostent *h)
(int)(unsigned char)h->h_addr_list[0][1],
(int)(unsigned char)h->h_addr_list[0][2],
(int)(unsigned char)h->h_addr_list[0][3]);
+ else if (h->h_addrtype == AF_INET6)
+ printf("ipv6: %08lx.%08lx.%08lx.%08lx\n",
+ (long)ntohl(((uint32_t*)h->h_addr_list[0])[0]),
+ (long)ntohl(((uint32_t*)h->h_addr_list[0])[1]),
+ (long)ntohl(((uint32_t*)h->h_addr_list[0])[2]),
+ (long)ntohl(((uint32_t*)h->h_addr_list[0])[3]));
} else {
printf("NULL!\n");
}
@@ -51,6 +58,14 @@ int main(int ac, char **av)
h = gethostbyaddr(h->h_addr_list[0], h->h_length, h->h_addrtype);
dumphostent("addr->name", *av, h);
}
+
+ h = gethostbyname2(*av, AF_INET6);
+ dumphostent("name->addr", *av, h);
+
+ if (h) {
+ h = gethostbyaddr(h->h_addr_list[0], h->h_length, h->h_addrtype);
+ dumphostent("addr->name", *av, h);
+ }
}
return 0;
}