3 ms·
After many years of learning the many options to iptables, I can only say it's about time. The iptables command is one of the least ergonomic ones I use regula
by jandrese 9y ago
After many years of learning the many options to iptables, I can only say it's about time. The iptables command is one of the least ergonomic ones I use regularly.
That said, while BPF syntax is great for simple cases, the boolean logic gets pretty messy in a hurry if you want to do something weird.
Simple case comparision:
iptables: iptables -t filter -A FORWARD -p tcp --dport 80 -j ACCEPT
theoretical bpf: allow forward tcp dst port 80
Note that the capitalization in the first command is not arbitrary, it must be there for the command to work, exactly as shown. Also, I didn't switch to the double dash option on dport frivolously, there is no single dash option for this incredibly common feature. Plus the manpages are split into a bunch of different parts and the SEE ALSO section at the bottom is woefully incomplete, making it difficult to track down exactly the page you need.
That said, incorporating all of the features from iptables into a BPF syntax is going to require a considerable expansion over what you get with tcpdump. Things like marked packets, NAT, state tracking, etc... all need to be grafted onto the language somehow. And of course everything needs to be well documented because a lot of sysadmins are going to need to learn this in a hurry and bad documentation will make them hate it and insist on keeping iptables instead, warts and all.
- vbernat 9y agoThere are two man pages: iptables(8) and iptables-extensions(8). What other man pages are you referring to?
- smallbigfish 9y agoI somehow like the iptables syntax better. Not just in the netfilter world but anywhere there are similar ideas. Why? Because it has a well defined structure for me. For example '-j ACCEPT' signals my brain that I jump to a decision. I can also add after or before that a '-m comment', it will not change the jump decision I made already. For the proposed bfp syntax it will take me 5 years to remember that the correct syntax is 'allow forward tcp' but not 'tcp forward allow' or any other combination. (This is also part of the reason I didn't jump to nftables yet)