netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 6/7] netfilter: nft_fwd_netdev: allow to redirect to ifb via ingress
Date: Tue, 24 Mar 2020 23:32:19 +0100	[thread overview]
Message-ID: <20200324223220.12119-7-pablo@netfilter.org> (raw)
In-Reply-To: <20200324223220.12119-1-pablo@netfilter.org>

Set skb->tc_redirected to 1, otherwise the ifb driver drops the packet.
Set skb->tc_from_ingress to 1 to reinject the packet back to the ingress
path after leaving the ifb egress path.

This patch inconditionally sets on these two skb fields that are
meaningful to the ifb driver. The existing forward action is guaranteed
to run from ingress path.

Fixes: 39e6dea28adc ("netfilter: nf_tables: add forward expression to the netdev family")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_fwd_netdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c
index ddd28de810b6..74f050ba6bad 100644
--- a/net/netfilter/nft_fwd_netdev.c
+++ b/net/netfilter/nft_fwd_netdev.c
@@ -28,6 +28,10 @@ static void nft_fwd_netdev_eval(const struct nft_expr *expr,
 	struct nft_fwd_netdev *priv = nft_expr_priv(expr);
 	int oif = regs->data[priv->sreg_dev];
 
+	/* These are used by ifb only. */
+	pkt->skb->tc_redirected = 1;
+	pkt->skb->tc_from_ingress = 1;
+
 	nf_fwd_netdev_egress(pkt, oif);
 	regs->verdict.code = NF_STOLEN;
 }
-- 
2.11.0


  parent reply	other threads:[~2020-03-24 22:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 22:32 [PATCH 0/7] Netfilter fixes for net Pablo Neira Ayuso
2020-03-24 22:32 ` [PATCH 1/7] netfilter: nf_tables: Allow set back-ends to report partial overlaps on insertion Pablo Neira Ayuso
2020-03-24 22:32 ` [PATCH 2/7] netfilter: nft_set_pipapo: Separate partial and complete overlap cases " Pablo Neira Ayuso
2020-03-24 22:32 ` [PATCH 3/7] netfilter: nft_set_rbtree: Introduce and use nft_rbtree_interval_start() Pablo Neira Ayuso
2020-03-24 22:32 ` [PATCH 4/7] netfilter: nft_set_rbtree: Detect partial overlaps on insertion Pablo Neira Ayuso
2020-03-24 22:32 ` [PATCH 5/7] netfilter: nft_fwd_netdev: validate family and chain type Pablo Neira Ayuso
2020-03-24 22:32 ` Pablo Neira Ayuso [this message]
2020-03-24 22:32 ` [PATCH 7/7] selftests: netfilter: add nfqueue test case Pablo Neira Ayuso
2020-03-25  0:31 ` [PATCH 0/7] Netfilter fixes for net David Miller

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=20200324223220.12119-7-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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 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).