netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Sowden <jeremy@azazel.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
	netdev@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH net-next,v2 8/9] netfilter: flowtable: bridge port support
Date: Mon, 19 Oct 2020 10:32:25 +0100	[thread overview]
Message-ID: <20201019093225.GF169425@azazel.net> (raw)
In-Reply-To: <20201015163038.26992-9-pablo@netfilter.org>

[-- Attachment #1: Type: text/plain, Size: 2580 bytes --]

On 2020-10-15, at 18:30:37 +0200, Pablo Neira Ayuso wrote:
> Update hardware destination address to the master bridge device to
> emulate the forwarding behaviour.
>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> v2: no changes.
>
>  include/net/netfilter/nf_flow_table.h | 1 +
>  net/netfilter/nf_flow_table_core.c    | 4 ++++
>  net/netfilter/nft_flow_offload.c      | 6 +++++-
>  3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
> index 1b57d1d1270d..4ec3f9bb2f32 100644
> --- a/include/net/netfilter/nf_flow_table.h
> +++ b/include/net/netfilter/nf_flow_table.h
> @@ -172,6 +172,7 @@ struct nf_flow_route {
>  			u32		ifindex;
>  			u8		h_source[ETH_ALEN];
>  			u8		h_dest[ETH_ALEN];
> +			enum flow_offload_xmit_type xmit_type;
>  		} out;
>  		struct dst_entry	*dst;
>  	} tuple[FLOW_OFFLOAD_DIR_MAX];
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
> index 725366339b85..e80dcabe3668 100644
> --- a/net/netfilter/nf_flow_table_core.c
> +++ b/net/netfilter/nf_flow_table_core.c
> @@ -100,6 +100,10 @@ static int flow_offload_fill_route(struct flow_offload *flow,
>
>  	if (dst_xfrm(dst))
>  		flow_tuple->xmit_type = FLOW_OFFLOAD_XMIT_XFRM;
> +	else
> +		flow_tuple->xmit_type = route->tuple[dir].out.xmit_type;
> +
> +	flow_tuple->dst_cache = dst;
>
>  	flow_tuple->dst_cache = dst;

Accidentally duplicated assignment?

> diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
> index d440e436cb16..9efb5d584290 100644
> --- a/net/netfilter/nft_flow_offload.c
> +++ b/net/netfilter/nft_flow_offload.c
> @@ -54,6 +54,7 @@ struct nft_forward_info {
>  	u32 iifindex;
>  	u8 h_source[ETH_ALEN];
>  	u8 h_dest[ETH_ALEN];
> +	enum flow_offload_xmit_type xmit_type;
>  };
>
>  static int nft_dev_forward_path(struct nf_flow_route *route,
> @@ -83,7 +84,9 @@ static int nft_dev_forward_path(struct nf_flow_route *route,
>  		case DEV_PATH_VLAN:
>  			return -1;
>  		case DEV_PATH_BRIDGE:
> -			return -1;
> +			memcpy(info.h_dest, path->dev->dev_addr, ETH_ALEN);
> +			info.xmit_type = FLOW_OFFLOAD_XMIT_DIRECT;
> +			break;
>  		}
>  	}
>
> @@ -91,6 +94,7 @@ static int nft_dev_forward_path(struct nf_flow_route *route,
>  	memcpy(route->tuple[dir].out.h_dest, info.h_source, ETH_ALEN);
>  	memcpy(route->tuple[dir].out.h_source, info.h_dest, ETH_ALEN);
>  	route->tuple[dir].out.ifindex = info.iifindex;
> +	route->tuple[dir].out.xmit_type = info.xmit_type;
>
>  	return 0;
>  }
> --
> 2.20.1

J.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2020-10-19  9:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 16:30 [PATCH net-next,v2 0/9] netfilter: flowtable bridge and vlan enhancements Pablo Neira Ayuso
2020-10-15 16:30 ` [PATCH net-next,v2 1/9] netfilter: flowtable: add xmit path types Pablo Neira Ayuso
2020-10-15 16:30 ` [PATCH net-next,v2 2/9] net: resolve forwarding path from virtual netdevice and HW destination address Pablo Neira Ayuso
2020-10-15 16:30 ` [PATCH net-next,v2 3/9] net: 8021q: resolve forwarding path for vlan devices Pablo Neira Ayuso
2020-10-15 16:30 ` [PATCH net-next,v2 4/9] bridge: resolve forwarding path for bridge devices Pablo Neira Ayuso
2020-10-22 10:24   ` Nikolay Aleksandrov
2020-10-15 16:30 ` [PATCH net-next,v2 5/9] netfilter: flowtable: use dev_fill_forward_path() to obtain ingress device Pablo Neira Ayuso
2020-10-15 16:30 ` [PATCH net-next,v2 6/9] netfilter: flowtable: use dev_fill_forward_path() to obtain egress device Pablo Neira Ayuso
2020-10-19  9:32   ` Jeremy Sowden
2020-10-15 16:30 ` [PATCH net-next,v2 7/9] netfilter: flowtable: add direct xmit path Pablo Neira Ayuso
2020-10-15 16:30 ` [PATCH net-next,v2 8/9] netfilter: flowtable: bridge port support Pablo Neira Ayuso
2020-10-19  9:32   ` Jeremy Sowden [this message]
2020-10-15 16:30 ` [PATCH net-next,v2 9/9] netfilter: flowtable: add vlan support Pablo Neira Ayuso
2020-10-15 19:47 ` [PATCH net-next,v2 0/9] netfilter: flowtable bridge and vlan enhancements Jakub Kicinski
2020-10-15 23:04   ` Pablo Neira Ayuso

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=20201019093225.GF169425@azazel.net \
    --to=jeremy@azazel.net \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).