Linux Netfilter discussions
 help / color / mirror / Atom feed
* ip6 dscp fails map lookup
@ 2023-11-03 16:18 Brian Davidson
  2023-11-03 19:37 ` Florian Westphal
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Davidson @ 2023-11-03 16:18 UTC (permalink / raw)
  To: netfilter

Using 'ip6 dscp' in a map lookup does not give expected results. It
seems to always match the zero value (cs0). It appears in the first
rule that the byteorder is not being converted between the two bitwise
operations, which is what happens when using ip6 dscp directly in the
second rule.

# nft -f - <<EOF
add table ip6 t
add chain ip6 t c
add map ip6 t mapv6 { typeof ip6 dscp : meta mark; }
EOF

# nft -d netlink add rule ip6 t c meta mark set ip6 dscp map @mapv6
ip6 t c
  [ payload load 2b @ network header + 0 => reg 1 ]
  [ bitwise reg 1 = ( reg 1 & 0x0000c00f ) ^ 0x00000000 ]
  [ bitwise reg 1 = ( reg 1 >> 0x00000006 ) ]
  [ lookup reg 1 set mapv6 dreg 1 ]
  [ meta set mark with reg 1 ]

# nft -d netlink add rule ip6 t c meta mark set ip6 dscp
ip6 t c
  [ payload load 2b @ network header + 0 => reg 1 ]
  [ bitwise reg 1 = ( reg 1 & 0x0000c00f ) ^ 0x00000000 ]
  [ byteorder reg 1 = ntoh(reg 1, 2, 2) ]
  [ bitwise reg 1 = ( reg 1 >> 0x00000006 ) ]
  [ meta set mark with reg 1 ]

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

end of thread, other threads:[~2023-11-05 21:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-03 16:18 ip6 dscp fails map lookup Brian Davidson
2023-11-03 19:37 ` Florian Westphal
2023-11-03 21:59   ` Florian Westphal
2023-11-05 17:15     ` Pablo Neira Ayuso
2023-11-05 17:41       ` Florian Westphal
2023-11-05 17:58         ` Pablo Neira Ayuso
2023-11-05 21:33         ` Pablo Neira Ayuso

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