All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Jeremy Sowden <jeremy@azazel.net>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nf-next 12/13] netfilter: nft_redir: deduplicate eval call-backs
Date: Tue, 7 Mar 2023 13:37:40 +0100	[thread overview]
Message-ID: <20230307123740.GD13059@breakpoint.cc> (raw)
In-Reply-To: <20230305121817.2234734-13-jeremy@azazel.net>

Jeremy Sowden <jeremy@azazel.net> 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@strlen.de>

> -	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(
> -			&regs->data[priv->sreg_proto_min]);
> -		range.max_proto.all = (__force __be16)nft_reg_load16(
> -			&regs->data[priv->sreg_proto_max]);
> -		range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
> +		range.min_proto.all = (__force __be16)
> +			nft_reg_load16(&regs->data[priv->sreg_proto_min]);
> +		range.max_proto.all = (__force __be16)
> +			nft_reg_load16(&regs->data[priv->sreg_proto_max]);
>  	}
>  
>  	range.flags |= priv->flags;

Nit: This could be updated to 'range.flags = priv->flags'

  reply	other threads:[~2023-03-07 12:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-05 12:18 [PATCH nf-next 00/13] Support for shifted port-ranges in NAT Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 01/13] netfilter: conntrack: fix typo Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 02/13] netfilter: nat: fix indentation of function arguments Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 03/13] netfilter: nat: extend core support for shifted port-ranges Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 04/13] netfilter: nft_nat: correct length for loading protocol registers Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 05/13] netfilter: nft_nat: add support for shifted port-ranges Jeremy Sowden
2023-03-07 12:27   ` Florian Westphal
2023-03-07 18:42     ` Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 06/13] netfilter: nft_masq: correct length for loading protocol registers Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 07/13] netfilter: nft_masq: deduplicate eval call-backs Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 08/13] netfilter: nft_masq: add support for shifted port-ranges Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 09/13] netfilter: nft_redir: correct value of inet type `.maxattrs` Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 10/13] netfilter: nf_nat_redirect: use `struct nf_nat_range2` in ipv4 API Jeremy Sowden
2023-03-07 12:35   ` Florian Westphal
2023-03-05 12:18 ` [PATCH nf-next 11/13] netfilter: nft_redir: correct length for loading protocol registers Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 12/13] netfilter: nft_redir: deduplicate eval call-backs Jeremy Sowden
2023-03-07 12:37   ` Florian Westphal [this message]
2023-03-07 18:42     ` Jeremy Sowden
2023-03-05 12:18 ` [PATCH nf-next 13/13] netfilter: nft_redir: add support for shifted port-ranges Jeremy Sowden
2023-03-07 12:46 ` [PATCH nf-next 00/13] Support for shifted port-ranges in NAT Florian Westphal
2023-03-07 19:35   ` Jeremy Sowden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230307123740.GD13059@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=jeremy@azazel.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.