Skip to contentSkip to conversation

nftables matching gratuitous arp

DISCUSSION michael-dev 2 participants 2 messages Aug 21, 2019 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to match gratuitous arp with nftables. I've tried

Quoted 1 line

nft add rule bridge filter somechain arp saddr ip == arp daddr ip

but nft (some commits before 0.9.2) says:

Quoted 2 lines

Error: syntax error, unexpected daddr, expecting end of file or newline or semicolon add rule bridge filter FORWARD arp saddr ip == arp daddr ip

                                                   ^^^^^

Looking at the description of the netlink protocol, it looks like two loads and a cmp of both registers would do it.

Am I'm correct that this is currently not possible with nft, so a patch to nft would be needed?

Thanks,
M. Braun

maintainer
#1 lore raw
Quoted 10 lines · michael-dev

I'm trying to match gratuitous arp with nftables. I've tried

Quoted 1 line

nft add rule bridge filter somechain arp saddr ip == arp daddr ip

but nft (some commits before 0.9.2) says:

Quoted 3 lines

Error: syntax error, unexpected daddr, expecting end of file or newline or semicolon
add rule bridge filter FORWARD arp saddr ip == arp daddr ip

                                                   ^^^^^

Looking at the description of the netlink protocol, it looks like two loads and a cmp of both registers would do it.

Yes, but cmp doesn't support this, see nft_cmp_eval() in net/netfilter/nft_cmp.c .

The compare occurs between a register and a immediate value.

Having cmp (and also binops) involving a second sreg would be good to have.