提交 76c4d85c 编写于 作者: R Rahul Lakkireddy 提交者: David S. Miller

cxgb4: fix all-mask IP address comparison

Convert all-mask IP address to Big Endian, instead, for comparison.

Fixes: f286dd8e ("cxgb4: use correct type for all-mask IP address comparison")
Signed-off-by: NRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a34f8291
...@@ -1112,16 +1112,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family) ...@@ -1112,16 +1112,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family)
struct in_addr *addr; struct in_addr *addr;
addr = (struct in_addr *)ipmask; addr = (struct in_addr *)ipmask;
if (ntohl(addr->s_addr) == 0xffffffff) if (addr->s_addr == htonl(0xffffffff))
return true; return true;
} else if (family == AF_INET6) { } else if (family == AF_INET6) {
struct in6_addr *addr6; struct in6_addr *addr6;
addr6 = (struct in6_addr *)ipmask; addr6 = (struct in6_addr *)ipmask;
if (ntohl(addr6->s6_addr32[0]) == 0xffffffff && if (addr6->s6_addr32[0] == htonl(0xffffffff) &&
ntohl(addr6->s6_addr32[1]) == 0xffffffff && addr6->s6_addr32[1] == htonl(0xffffffff) &&
ntohl(addr6->s6_addr32[2]) == 0xffffffff && addr6->s6_addr32[2] == htonl(0xffffffff) &&
ntohl(addr6->s6_addr32[3]) == 0xffffffff) addr6->s6_addr32[3] == htonl(0xffffffff))
return true; return true;
} }
return false; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册