in-addr-util: introduce in4_addr_is_local_multicast()

This commit is contained in:
Yu Watanabe
2020-09-17 00:04:22 +09:00
parent 5643cfc0d9
commit ccea244865
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -76,6 +76,12 @@ int in_addr_is_multicast(int family, const union in_addr_union *u) {
return -EAFNOSUPPORT;
}
bool in4_addr_is_local_multicast(const struct in_addr *a) {
assert(a);
return (be32toh(a->s_addr) & UINT32_C(0xffffff00)) == UINT32_C(0xe0000000);
}
bool in4_addr_is_localhost(const struct in_addr *a) {
assert(a);