I have requirement where am getting parameters to set in iptables as below:
Rate Limit = 1/sec
Source port = 5432
Source IP = 203.0.113.0
Protocol = tcp
TCP flags = &syn!=syn
iptables -A PRIO_IN -p tcp -s 203.0.113.0 --sport 5432 -j ACCEPT --tcp-flags " "
How to pass input parameters of tcp flgas to command line?
What is the meaning of &syn!=syn ?
& syn != synmeans that the syn flag is cleared, as in!= synmeans that "any case but only the syn flag is set". Probably both--tcp-flags SYN NONEand! --tcp-flags SYN SYNare equivalent to& syn != syn.!=synas! --tcp-flags SYN SYN. And&syn!= synas--tcp-flags SYN SYN -m u32 --u32 "!(12 & 0x2C=0x2C)".iptables-extensionsman page and get to know what "bit masking" means. The equivalent oftcp flags != synshould be! --tcp-flags ALL SYN. (I can't guarantee that nftables devs won't get it wrong when they implement it either though. Sometimes they might even choose to stick with bad/wrong stuff since they think correcting it "would violate existing assumption".)