Iptables convert to nftables help

Can someone please help convert this command to nftables :confused:

iptables -t mangle -N dscp_mark
iptables -t mangle -A FORWARD -j dscp_mark
iptables -t mangle -A PREROUTING -p udp -d 192.168.1.127 -j DSCP --set-dscp 46
iptables -t mangle -A POSTROUTING -p udp -s 192.168.1.127 -j DSCP --set-dscp 46
iptables -t mangle -A dscp_mark -p udp --match multiport --sport 3074 -j DSCP --set-dscp-class EF
iptables -t mangle -A dscp_mark -p udp --match multiport --dport 3074 -j DSCP --set-dscp-class EF

If you have access to a linux box you can use the command iptables-translate to do this. Just replace the command "iptables" with "iptables-translate".

However, nftables doesn't have a fixed set of chains like PREROUTING etc it can have multiple tables and multiple chains per table with whatever organization you want. You'd have to know a bit more about OpenWrt's fw4 to figure out where to put these commands.

# /etc/config/firewall
config include
        option type 'nftables'
        option path '/etc/mangle_prerouting.nft'
        option position 'chain-pre'
        option chain 'mangle_prerouting'

config include
        option type 'nftables'
        option path '/etc/mangle_postrouting.nft'
        option position 'chain-pre'
        option chain 'mangle_postrouting'

config include
        option type 'nftables'
        option path '/etc/mangle_forward.nft'
        option position 'chain-pre'
        option chain 'mangle_forward'

# /etc/mangle_prerouting.nft
ip protocol udp ip daddr 192.168.1.127 counter ip dscp set 0x2e

# /etc/mangle_postrouting.nft
ip protocol udp ip saddr 192.168.1.127 counter ip dscp set 0x2e

# /etc/mangle_forward.nft
ip protocol udp udp sport 3074 counter ip dscp set 0x2e
ip protocol udp udp dport 3074 counter ip dscp set 0x2e