Commit 27ecb1ff authored by Jan Engelhardt's avatar Jan Engelhardt Committed by David S. Miller

[NETFILTER]: xt_iprange: fix subtraction-based comparison

The host address parts need to be converted to host-endian first
before arithmetic makes any sense on them.
Signed-off-by: default avatarJan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7d9904c2
...@@ -102,7 +102,7 @@ iprange_ipv6_sub(const struct in6_addr *a, const struct in6_addr *b) ...@@ -102,7 +102,7 @@ iprange_ipv6_sub(const struct in6_addr *a, const struct in6_addr *b)
int r; int r;
for (i = 0; i < 4; ++i) { for (i = 0; i < 4; ++i) {
r = (__force u32)a->s6_addr32[i] - (__force u32)b->s6_addr32[i]; r = ntohl(a->s6_addr32[i]) - ntohl(b->s6_addr32[i]);
if (r != 0) if (r != 0)
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment