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: kadlec@netfilter.org
Subject: [PATCH nft] doc: statements: fwd supports for sending packets via neighbouring layer
Date: Tue,  6 Dec 2022 23:53:01 +0100	[thread overview]
Message-ID: <20221206225302.61932-1-pablo@netfilter.org> (raw)

Document ability to forward packets through neighbour layer added in
30d45266bf38 ("expr: extend fwd statement to support address and family").

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 doc/statements.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/doc/statements.txt b/doc/statements.txt
index 8076c21cded4..66877eac847b 100644
--- a/doc/statements.txt
+++ b/doc/statements.txt
@@ -683,7 +683,25 @@ The fwd statement is used to redirect a raw packet to another interface. It is
 only available in the netdev family ingress and egress hooks. It is similar to
 the dup statement except that no copy is made.
 
+You can also specify the address of the next hop and the device to forward the
+packet to. This updates the source and destination MAC address of the packet by
+transmitting it through the neighboring Layer 2 layer. This also decrements the
+ttl field of the IP packet. This provides a way to effectively bypass the
+classical forwarding path, thus skipping the fib (forwarding information base)
+lookup.
+
+[verse]
 *fwd to* 'device'
+*fwd* [*ip* | *ip6*] *to* 'address' *device* 'device'
+
+.Using the fwd statement
+------------------------
+# redirect raw packet to device
+netdev ingress fwd to "eth0"
+
+# forward packet to next hop 192.168.200.1 via eth0 device
+netdev ingress ether saddr set fwd ip to 192.168.200.1 device "eth0"
+-----------------------------------
 
 SET STATEMENT
 ~~~~~~~~~~~~~
-- 
2.30.2


             reply	other threads:[~2022-12-06 22:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 22:53 Pablo Neira Ayuso [this message]
2022-12-06 22:53 ` [PATCH nft] scanner: munch full comment lines Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2022-12-06 17:16 [PATCH nft] doc: statements: fwd supports for sending packets via neighbouring layer 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=20221206225302.61932-1-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=kadlec@netfilter.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).