public inbox for netfilter@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] "ether type ip" forgotten/implied when listing rules for 'netdev' family
@ 2026-02-23 14:57 Michal Soltys
  2026-02-23 19:09 ` Pablo Neira Ayuso
  2026-02-23 19:24 ` Florian Westphal
  0 siblings, 2 replies; 6+ messages in thread
From: Michal Soltys @ 2026-02-23 14:57 UTC (permalink / raw)
  To: netfilter

Hi,

While testing the behavior of early filtering in netdev / ingress, I 
noticed something that possibly looks like a bug.

Consider following and interface with one vlan, e.g.

ip add add 10.0.0.1/24 dev eno1
ip li add li eno1 name v250 type vlan id 250
ip add add 10.10.10.1/24 dev v250
ip li set eno1 up
ip li set v250 up


Now consider following simple nft setup:

nft add table netdev efil
nft add chain netdev efil edev { hook ingress type filter device eno1 
priority filter; }
nft add rule netdev efil edev ether type ip icmp type echo-request counter
nft add rule netdev efil edev ether type vlan icmp type echo-request counter
nft add rule netdev efil edev icmp type echo-request counter

These will be listed by nft ruleset list as such:
table netdev efil {
         chain edev {
                 type filter hook ingress device "eno1" priority filter; 
policy accept;
                 icmp type echo-request counter packets 0 bytes 0
                 ether type 8021q icmp type echo-request counter packets 
0 bytes 0
                 icmp type echo-request counter packets 0 bytes 0
         }
}

Note that the first rule omits the "ether type ip" as if it was 'ip' 
family instead of 'netdev'. So the 1st and the 3rd are listed the same - 
but they work differently.

The first rule will only count plain ip payload, the 2nd rule will count 
only vlan payload, the 3rd will count both. So after 1 ping to 
10.10.10.1 and 1 ping to 10.0.0.1, the effect would be:

table netdev efil {
         chain edev {
                 type filter hook ingress device "eno1" priority filter; 
policy accept;
                 icmp type echo-request counter packets 1 bytes 84
                 ether type 8021q icmp type echo-request counter packets 
1 bytes 84
                 icmp type echo-request counter packets 2 bytes 168
         }
}

Furthermore it seems it's impossible to return to such ruleset via:

- nft list ruleset >rules
- flush tables
- nft -f rules

As this time the 1st and the 3rd rule actually will be identical both 
visually and functionally, omitting 'ether type ip' check completely.

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

end of thread, other threads:[~2026-02-26 12:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 14:57 [BUG] "ether type ip" forgotten/implied when listing rules for 'netdev' family Michal Soltys
2026-02-23 19:09 ` Pablo Neira Ayuso
2026-02-24 11:49   ` Michal Soltys
2026-02-26 12:49   ` Michal Soltys
2026-02-23 19:24 ` Florian Westphal
2026-02-24 16:08   ` Michal Soltys

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox