[PATCH nf] netfilter: nat: fix icmp id endianness when protocol mapping was given

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



net/netfilter/nf_nat_core.c:422:29: sparse: incorrect type in assignment (different base types)
net/netfilter/nf_nat_core.c:422:29:    expected unsigned int [unsigned] [assigned] min
net/netfilter/nf_nat_core.c:422:29:    got restricted __be16 const [usertype] id

The warning is correct, this needs ntohs treatment.

Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Fixes: 203f2e78200c27e ("netfilter: nat: remove l4proto->unique_tuple")
Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 Pablo, feel free to squash this with commit 57be8a51f2a8ba390f7c5a03d2ae812a1b39c9bb
 ("netfilter: nat: fix icmp id randomization"), it touched this area
 already (and moved the faulty line to its current place).

 net/netfilter/nf_nat_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index f79f77d6850b..000952719adf 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -419,7 +419,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
 			min = 0;
 			range_size = 65536;
 		} else {
-			min = range->min_proto.icmp.id;
+			min = ntohs(range->min_proto.icmp.id);
 			range_size = ntohs(range->max_proto.icmp.id) -
 				     ntohs(range->min_proto.icmp.id) + 1;
 		}
-- 
2.21.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux