It will be easier to manage it using sets:
table inet filter { set myport_tcp { type inet_service elements = { 4848 } } chain input { type filter hook input priority 0; policy drop; # existing rules tcp dport @myport_tcp ct state new,established counter accept # more existing rules }}
You can empty the set by:
nft flush set inet filter myport_tcp
And you can add a new port to the set by:
nft add element inet filter myport_tcp elements = { 4949 }
Or add a multiple ports to the set by:
nft add element inet filter myport_tcp elements = { 14949, 9494 }