in-addr-util: move IPV4_ADDRESS_FMT_STR/VAL macros from networkd-address.h

This commit is contained in:
Yu Watanabe
2021-05-12 10:30:45 +09:00
parent ae7b68db97
commit 280323984b
2 changed files with 7 additions and 7 deletions
+7
View File
@@ -126,3 +126,10 @@ extern const struct hash_ops in_addr_data_hash_ops;
extern const struct hash_ops in_addr_prefix_hash_ops;
extern const struct hash_ops in_addr_prefix_hash_ops_free;
extern const struct hash_ops in6_addr_hash_ops;
#define IPV4_ADDRESS_FMT_STR "%u.%u.%u.%u"
#define IPV4_ADDRESS_FMT_VAL(address) \
be32toh((address).s_addr) >> 24, \
(be32toh((address).s_addr) >> 16) & 0xFFu, \
(be32toh((address).s_addr) >> 8) & 0xFFu, \
be32toh((address).s_addr) & 0xFFu