diff --git a/sys/include/net/ipv4/addr.h b/sys/include/net/ipv4/addr.h index 30cc5fcb3c..73a0662d4e 100644 --- a/sys/include/net/ipv4/addr.h +++ b/sys/include/net/ipv4/addr.h @@ -57,6 +57,23 @@ static inline bool ipv4_addr_equal(const ipv4_addr_t *a, const ipv4_addr_t *b) return (a->u32.u32 == b->u32.u32); } +/** + * @brief Check if @p addr is a multicast address. + * + * @see + * RFC 1112, section 4 + * + * + * @param[in] addr An IPv4 address. + * + * @return true, if @p addr is multicast address, + * @return false, otherwise. + */ +static inline bool ipv4_addr_is_multicast(const ipv4_addr_t *addr) +{ + return (addr->u8[0] >= 0xE0 && addr->u8[0] <= 0xEF); +} + /** * @brief Converts an IPv4 address to its string representation *