netfilter: nf_tables: fix port natting in little endian archs
Make sure this fetches 16-bits port data from the register. Remove casting to make sparse happy, not needed anymore. Signed-off-by: leroy christophe <christophe.leroy@c-s.fr> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
70314fc684
commit
7b5bca4676
3 changed files with 12 additions and 12 deletions
|
@ -27,10 +27,10 @@ static void nft_redir_ipv4_eval(const struct nft_expr *expr,
|
|||
|
||||
memset(&mr, 0, sizeof(mr));
|
||||
if (priv->sreg_proto_min) {
|
||||
mr.range[0].min.all = (__force __be16)
|
||||
data[priv->sreg_proto_min].data[0];
|
||||
mr.range[0].max.all = (__force __be16)
|
||||
data[priv->sreg_proto_max].data[0];
|
||||
mr.range[0].min.all =
|
||||
*(__be16 *)&data[priv->sreg_proto_min].data[0];
|
||||
mr.range[0].max.all =
|
||||
*(__be16 *)&data[priv->sreg_proto_max].data[0];
|
||||
mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ static void nft_redir_ipv6_eval(const struct nft_expr *expr,
|
|||
|
||||
memset(&range, 0, sizeof(range));
|
||||
if (priv->sreg_proto_min) {
|
||||
range.min_proto.all = (__force __be16)
|
||||
data[priv->sreg_proto_min].data[0];
|
||||
range.max_proto.all = (__force __be16)
|
||||
data[priv->sreg_proto_max].data[0];
|
||||
range.min_proto.all =
|
||||
*(__be16 *)&data[priv->sreg_proto_min].data[0];
|
||||
range.max_proto.all =
|
||||
*(__be16 *)&data[priv->sreg_proto_max].data[0];
|
||||
range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,10 +65,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
|
|||
}
|
||||
|
||||
if (priv->sreg_proto_min) {
|
||||
range.min_proto.all = (__force __be16)
|
||||
data[priv->sreg_proto_min].data[0];
|
||||
range.max_proto.all = (__force __be16)
|
||||
data[priv->sreg_proto_max].data[0];
|
||||
range.min_proto.all =
|
||||
*(__be16 *)&data[priv->sreg_proto_min].data[0];
|
||||
range.max_proto.all =
|
||||
*(__be16 *)&data[priv->sreg_proto_max].data[0];
|
||||
range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue