On 2023-03-07, at 13:37:40 +0100, Florian Westphal wrote: > Jeremy Sowden <jeremy@xxxxxxxxxx> wrote: > > nft_redir has separate ipv4 and ipv6 call-backs which share much of > > their code, and an inet one switch containing a switch that calls one of > > the others based on the family of the packet. Merge the ipv4 and ipv6 > > ones into the inet one in order to get rid of the duplicate code. > > > > Const-qualify the `priv` pointer since we don't need to write through > > it. > > > > Set the `NF_NAT_RANGE_PROTO_SPECIFIED` flag once during init, rather > > than on every eval. > > Reviewed-by: Florian Westphal <fw@xxxxxxxxx> > > > - struct nft_redir *priv = nft_expr_priv(expr); > > + const struct nft_redir *priv = nft_expr_priv(expr); > > struct nf_nat_range2 range; > > > > memset(&range, 0, sizeof(range)); > > if (priv->sreg_proto_min) { > > - range.min_proto.all = (__force __be16)nft_reg_load16( > > - ®s->data[priv->sreg_proto_min]); > > - range.max_proto.all = (__force __be16)nft_reg_load16( > > - ®s->data[priv->sreg_proto_max]); > > - range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; > > + range.min_proto.all = (__force __be16) > > + nft_reg_load16(®s->data[priv->sreg_proto_min]); > > + range.max_proto.all = (__force __be16) > > + nft_reg_load16(®s->data[priv->sreg_proto_max]); > > } > > > > range.flags |= priv->flags; > > Nit: This could be updated to 'range.flags = priv->flags' Will fix. J.
Attachment:
signature.asc
Description: PGP signature