Pablo Nftables Osd Userday 2013
Pablo Nftables Osd Userday 2013
nftables: "ntro
New kernel packet filtering framework to replace iptables. No changes in the core infrastr ct re:
Designe& from lessons learnt from iptables. 'ro(i&es backwar& compatibilit$ infrastr ct re. Nftables release& in )arch 200* b$ 'atrick )c+ar&$. C rrentl$ n&er acti(e &e(elopment.
'se &o,state machine in kernel,space -similar to .'/0. 1egisters: 2 general p rpose -123 bits long each0 4 1 (er&ict. 'ro(i&es instr ction set -can be e5ten&e&0:
reg 6 pkt.pa$loa&7offset! len8 reg 6 imme&iate-(al e! len0 reg 6 cmp-reg1! reg2! 9:0 reg 6 b$teor&er-reg1! N#O+0 reg 6 pkt.meta-mark0 reg 6 -reg1 ; mask0 < 5or0 reg 6 look p-set! reg10 reg 6 ct-reg1! state0 reg 6 look p-set! &ata0
New e5tensions are implemente& sing this instr ction set. Netlink interface: kernel = serspace -http:>>1*32.lsi. s.es>?pablo>&ocs>spae.p&f0
1 @in 5 kernel mo& le: 5tAblah.c 1 lib5tAblah.c file n&er ser,space iptables tree.
.inar$ arra$ containing the r le,set. comm nication kernel = serspace: Bse setsockopt-0>getsockopt-0 'oor incremental &$namic r le,set p&ates @imitations:
Step 1: 'arse comman& line Step 2: . il& r le from ser,space sing instr ction set:
1eg1 6 pkt.pa$loa&-offset-ip sa&&r0! 20 1eg2 6 imme&iate-1.1.1.1! 20 1egC 6 cmp-reg1! reg2! 9:0 1eg1 6 pkt.pa$loa&-offset-tcp &port0! 20 1eg2 6 imme&iate-30! 20 1egC 6 imme&iate-D1O'0
Step 3: Con(ert that to netlink an& pass message with co&e to kernel. Step 1: D mp r le,set -to check which one to &elete0 Step 2: Delete b$ r le i&entifier
Deleting r le
Step 1: 'arse comman& line Step 2: . il& r le match an& target: se b ilt,in so rce! tcp match an& stan&ar& target Step 3: Eet r le,set from kernel -binar$0! p&ate it with r le Step 2: 'ass r le,set to kernel space (ia setsockopt-0 Step 1: 'arse comman& line Step 2: Con(ert r le to binar$. Step 3: D mp e5isting r leset -in binar$0. Step 2: /in& r le matching in r leset -binar$ comparisons0 Step F: "f fo n&. %llocate new r le,set! b il& it an& pass it to kernel,space.
Delete r le:
"ptables pro(i&e& no thir& part$ librar$ @ibipt>libiptG probabl$! $o ha(e to work with binar$ blobs Nftables pro(i&es libnftables an& will pro(i&e high le(el librar$ to work in an obHect oriente& fashion.
Backward compatible:
Btilit$ &eri(ate& from iptables>ipGtables with same s$nta5. Io can se all e5isting 5tables mo& les. Io can still a&& new 5tables e5tensions in the same fashion. No nee& to learn new tilities if $o &onJt want to. No nee& for new &oc mentation. No nee& to p&ate $o r scripts. 5tables,e(ent : 1eporting changes in tables>chains>r les .etter incremental r le p&ate s pport: )atches internal state is not lost 9nable>&isable the chains per table that $o want K more impro(ements for 5tables $et to come
New s$nta5! new feat res. tcp &port L 30 6M accept! 22 6M &rop N ip &a&&r L 1*2.1G3.0.0>22 6M H mp chain1! 1*2.1G3.1.0>22 6M H mp chain2! N ip sa&&r . tcp &port L 1.1.1.1 . 30 6M accept! 1.1.1.2 . 22 6M &rop! N
nftables s mmar$
One single kernel framework for packet filtering allowing long term e(ol tion. #wo serspace tools:
Same s$nta5 4 same feat res 4 new feat res New s$nta5 4 more cool new feat res
New tilit$:
Oernel: git:>>1*32.lsi. s.es>nftables @ibrar$: git:>>1*32.lsi. s.es>libnftables Bser,space: git:>>1*32.lsi. s.es>iptables,nftables @ibrar$: git:>>git.netfilter.org>libnl,nft Bser,space: git:>>git.netfilter.org>nftables
New tilit$: