diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-11-22 12:30:46 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-11-22 12:37:10 +0100 |
commit | 3a599ba4541b2c428e3467650b9ad0a2364b41e6 (patch) | |
tree | d2a0b9dd30b215188c557e6dbf0568cfe724f795 | |
parent | c61815319c1c0e76898048a19151f30844a6989c (diff) |
wds: make ipv6 address endian swap more portable
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | commands-wds.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/commands-wds.c b/commands-wds.c index fabb5f4..fca5fe7 100644 --- a/commands-wds.c +++ b/commands-wds.c @@ -211,13 +211,12 @@ static void wds_to_ipv4(const char *name, const uint32_t addr) static void wds_to_ipv6(const char *name, const uint16_t *addr) { - int i; - struct in6_addr ip_addr; char buf[INET6_ADDRSTRLEN]; + uint16_t ip_addr[8]; + int i; - for (i = 0; i < ARRAY_SIZE(ip_addr.s6_addr16); i++) { - ip_addr.s6_addr16[i] = htons(addr[i]); - } + for (i = 0; i < ARRAY_SIZE(ip_addr); i++) + ip_addr[i] = htons(addr[i]); blobmsg_add_string(&status, name, inet_ntop(AF_INET6, &ip_addr, buf, sizeof(buf))); } |