From: Dion Bosschieter <dionbosschieter@gmail.com>
To: netfilter@vger.kernel.org
Cc: jean-louis@dupond.be
Subject: nftable field to field matching, to support garp filtering
Date: Wed, 1 Apr 2026 10:18:46 +0200 [thread overview]
Message-ID: <07431a43-e76b-4a2f-a24d-99dd25a9ef7d@gmail.com> (raw)
Hi
In order to support filtering on garp in the nftables driver of nwfilter
for libvirt:
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/4VYYUJE2MF6IBAO6R6YT2FA456LTKHC7/
I have tried to come up with a solution to support the equivalent of
ebtables --arp-gratuitous:
[!] --arp-gratuitous
Checks for ARP gratuitous packets: checks equality of IPv4
source address and IPv4 destination address inside the ARP
header.
I havee not found an easy solution to field to field matching using nft
For example: arp saddr ip == arp daddr ip
In order to compare "arp saddr ip" against "arp daddr ip" I have now
written the following solution:
// create a concatenation set of identical IP pairs
same-ip-set { 0.0.0.0 . 0.0.0.0, 1.0.0.0 . 1.0.0.0, ...
In order to not list all possible ipv4 ips in the same-ip-set, we will
mask with either 255.0.0.0 0.255.0.0 0.0.255.0 or 0.0.0.255
this ensures that we only have 1024 entries in that same-ip-set.
This results in the following rule:
arp saddr ip & 255.0.0.0 . arp daddr ip & 255.0.0.0 @same-ip-set
arp saddr ip & 0.255.0.0 . arp daddr ip & 0.255.0.0 @same-ip-set
arp saddr ip & 0.0.255.0 . arp daddr ip & 0.0.255.0 @same-ip-set
arp saddr ip & 0.0.0.255 . arp daddr ip & 0.0.0.255 @same-ip-set
accept
This appears to correctly match GARP traffic.
My questions are:
- Is there an easier approach to this?
- Are there plans to support packet data to packet data matching or
otherwise specifically garp filtering?
With regards,
Dion
reply other threads:[~2026-04-01 8:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=07431a43-e76b-4a2f-a24d-99dd25a9ef7d@gmail.com \
--to=dionbosschieter@gmail.com \
--cc=jean-louis@dupond.be \
--cc=netfilter@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