mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
netfilter: nft_fwd_netdev: Support egress hook
Allow packet redirection to another interface upon egress. [lukas: set skb_iif, add commit message, original patch from Pablo. ] Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
632cb151ca
commit
f87b9464d1
@ -27,9 +27,11 @@ 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];
|
||||
struct sk_buff *skb = pkt->skb;
|
||||
|
||||
/* This is used by ifb only. */
|
||||
skb_set_redirected(pkt->skb, true);
|
||||
skb->skb_iif = skb->dev->ifindex;
|
||||
skb_set_redirected(skb, nft_hook(pkt) == NF_NETDEV_INGRESS);
|
||||
|
||||
nf_fwd_netdev_egress(pkt, oif);
|
||||
regs->verdict.code = NF_STOLEN;
|
||||
@ -198,7 +200,8 @@ static int nft_fwd_validate(const struct nft_ctx *ctx,
|
||||
const struct nft_expr *expr,
|
||||
const struct nft_data **data)
|
||||
{
|
||||
return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS));
|
||||
return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS) |
|
||||
(1 << NF_NETDEV_EGRESS));
|
||||
}
|
||||
|
||||
static struct nft_expr_type nft_fwd_netdev_type;
|
||||
|
Loading…
Reference in New Issue
Block a user