All of lore.kernel.org
 help / color / mirror / Atom feed
* Mask as part of element in set
@ 2024-03-27  8:36 Vlad Tsisyk
  2024-03-27  9:16 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Tsisyk @ 2024-03-27  8:36 UTC (permalink / raw)
  To: netfilter

Hello,

I have a set of pairs of MAC address and mask:

aa:bb:cc:dd:ee:ff 00:ff:ff:ff:ff:ff
aa:bb:cc:dd:ee:ff 00:ff:ff:ff:ff:00
...

I want to apply a mask to source MAC from the packet, and then compare
the result with the MAC from the pair. I can do it like so:

nft add table t
nft add chain t c
nft --debug=netlink add rule ip t c ether saddr and aa:bb:cc:dd:ee:ff
00:ff:ff:ff:ff:00

ip t c
  [ meta load iiftype => reg 1 ]
  [ cmp eq reg 1 0x00000001 ]
  [ payload load 6b @ link header + 6 => reg 1 ]
  [ bitwise reg 1 = (reg=1 & 0xddccbbaa 0x0000ffee ) ^ 0x00000000
0x00000000 ]
  [ cmp eq reg 1 0xffffff00 0x000000ff ]
...

But I have to create a new rule for each pair. Is there any
workarounds to use sets?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-28  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-27  8:36 Mask as part of element in set Vlad Tsisyk
2024-03-27  9:16 ` Pablo Neira Ayuso
2024-03-28  8:20   ` Vlad Tsisyk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.