net: ip: Check IPv4 multicast address using big-endian

The IPv4 address in struct in_addr is in big endian so check
the multicast address value correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-09-21 23:05:23 +03:00
parent 604cdb6b6d
commit 6edb0e3d18

View file

@ -445,7 +445,7 @@ static inline bool net_is_ipv4_addr_unspecified(const struct in_addr *addr)
*/
static inline bool net_is_ipv4_addr_mcast(const struct in_addr *addr)
{
return (addr->s_addr & 0xE0000000) == 0xE0000000;
return (ntohl(addr->s_addr) & 0xE0000000) == 0xE0000000;
}
extern struct net_if_addr *net_if_ipv4_addr_lookup(const struct in_addr *addr,