summaryrefslogtreecommitdiff
path: root/lib/ipaddr.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipaddr.h')
-rw-r--r--lib/ipaddr.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ipaddr.h b/lib/ipaddr.h
index 98c28008dc..3857b83027 100644
--- a/lib/ipaddr.h
+++ b/lib/ipaddr.h
@@ -85,4 +85,14 @@ static inline char *ipaddr2str(struct ipaddr *ip, char *buf, int size)
}
return buf;
}
+
+static inline void ipv4_to_ipv4_mapped_ipv6(struct in6_addr *in6,
+ struct in_addr in)
+{
+ u_int32_t addr_type = htonl(0xFFFF);
+ memset(in6, 0, sizeof(struct in6_addr));
+ memcpy((char *)in6 + 8, &addr_type, sizeof(addr_type));
+ memcpy((char *)in6 + 12, &in, sizeof(struct in_addr));
+}
+
#endif /* __IPADDR_H__ */