summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* extensions: iprange: remove extra space in translationPablo M. Bermudo Garay2016-06-221-12/+12
| | | | | | | | | | | | | Extra space was printed by iprange_xlate: # iptables-translate -A INPUT -m iprange --src-range \ 192.168.25.149-192.168.25.151 -j ACCEPT nft add rule ip filter INPUT ip saddr 192.168.25.149-192.168.25... ^^ Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables: extensions: libxt_MARK: Fix translation of --set-xmark optionRoberto García2016-06-221-2/+2
| | | | | | | | | | | | | | | | | Fix translation of MARK target's --set-xmark option. Before: #iptables-translate -t mangle -A PREROUTING -j MARK --set-xmark 0x64/0xaf nft add rule ip mangle PREROUTING counter meta mark set mark xor 0x64 and 0xaf After: # iptables-translate -t mangle -A PREROUTING -j MARK --set-xmark 0x64/0xaf nft add rule ip mangle PREROUTING counter meta mark set mark and 0xffffff50 \ xor 0x64 Signed-off-by: Roberto García <rodanber@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_CONNMARK: Add translation to nftRoberto García2016-06-221-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add translation for the CONNMARK target to nftables. The following options have no available translation: --save-mark [--nfmask nfmask] [--ctmask ctmask] --restore-mark [--nfmask nfmask] [--ctmask ctmask] Examples: # iptables-translate -t mangle -A PREROUTING -j CONNMARK --set-mark 0x16 nft add rule ip mangle PREROUTING counter ct mark set 0x16 # iptables-translate -t mangle -A PREROUTING -j CONNMARK --set-xmark 0x16/0x12 nft add rule ip mangle PREROUTING counter ct mark set ct mark xor 0x16 and 0xffffffed # iptables-translate -t mangle -A PREROUTING -j CONNMARK --and-mark 0x16 nft add rule ip mangle PREROUTING counter ct mark set ct mark and 0x16 # iptables-translate -t mangle -A PREROUTING -j CONNMARK --or-mark 0x16 nft add rule ip mangle PREROUTING counter ct mark set ct mark or 0x16 # iptables-translate -t mangle -A PREROUTING -j CONNMARK --save-mark nft add rule ip mangle PREROUTING counter ct mark set mark # iptables-translate -t mangle -A PREROUTING -j CONNMARK --save-mark \ --mask 0x12 nft add rule ip mangle PREROUTING counter ct mark set mark and 0x12 # iptables-translate -t mangle -A PREROUTING -j CONNMARK --restore-mark nft add rule ip mangle PREROUTING counter meta mark set ct mark # iptables-translate -t mangle -A PREROUTING -j CONNMARK --restore-mark \ --mask 0x12 nft add rule ip mangle PREROUTING counter meta mark set ct mark and 0x12 Signed-off-by: Roberto García <rodanber@gmail.com> Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_MARK: Add translation for revision 1 to nftRoberto García2016-06-221-2/+26
| | | | | | | | | | | | | | | | | | | Add translation for revision 1 of the MARK target to nft. Examples: # iptables-translate -t mangle -A PREROUTING -j MARK --set-mark 0x64 nft add rule ip mangle PREROUTING counter meta mark set 0x64 # iptables-translate -t mangle -A PREROUTING -j MARK --and-mark 0x64 nft add rule ip mangle PREROUTING counter meta mark set mark and 0x64 # iptables-translate -t mangle -A PREROUTING -j MARK --or-mark 0x64 nft add rule ip mangle PREROUTING counter meta mark set mark or 0x64 Signed-off-by: Roberto García <rodanber@gmail.com> Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* configure: Remove flex check warningShivani Bhardwaj2016-06-221-15/+0
| | | | | | | | | Remove the warning about outdated version of flex as it is not needed anymore. This check was introduced back in 2008 to skip a broken flex version that doesn't seem to be packaged by any distribution anymore. Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: NETMAP: fix iptables-save outputFlorian Westphal2016-06-172-8/+22
| | | | | | | | | | | | | | | NETMAP_print is also used by its .save hook so this change broke iptables-save output. Revert the patch, rename NETMAP_print to __NETMAP_print and use that as the workhorse for both xtables -L and xtables-save. The addition of the 'to' prefix is done in the .print hook only. Reported-by: Shivani Bhardwaj <shivanib134@gmail.com> Reported-by: Pablo Neira Ayuso <pablo@netfilter.org> Fixes: 90becf12bd5823b6d59d32d ("extensions: NETMAP: add ' to:' prefix when printing NETMAP target") Signed-off-by: Florian Westphal <fw@strlen.de>
* ip6tables: Warn about use of DROP in nat tableThomas Woerner2016-06-151-0/+7
| | | | | | | Clone of 1eada72b with 9bb76094 and e0390bee on top. Signed-off-by: Thomas Woerner <twoerner@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_MARK: Add translation to nftRoberto García2016-06-141-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | Add translation for the MARK target to nftables. Examples: $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --set-mark 64 nft add rule ip mangle OUTPUT counter meta mark set 0x40 $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --set-xmark 0x40/0x32 nft add rule ip mangle OUTPUT counter meta mark set mark xor 0x40 and 0x32 $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --or-mark 64 nft add rule ip mangle OUTPUT counter meta mark set mark or 0x40 $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --and-mark 64 nft add rule ip mangle OUTPUT counter meta mark set mark and 0x40 $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --xor-mark 64 nft add rule ip mangle OUTPUT counter meta mark set mark xor 0x40 Signed-off-by: Roberto García <rodanber@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_cgroup: Add translation to nftLaura Garcia Liebana2016-06-141-0/+28
| | | | | | | | | | | | | | | | Add translation for cgroup to nft. Path parameter not supported in nft yet. Examples: $ sudo iptables-translate -t filter -A INPUT -m cgroup --cgroup 0 -j ACCEPT nft add rule ip filter INPUT meta cgroup 0 counter accept $ sudo iptables-translate -t filter -A INPUT -m cgroup ! --cgroup 0 -j ACCEPT nft add rule ip filter INPUT meta cgroup != 0 counter accept Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_frag: Add translation to nftLaura Garcia Liebana2016-06-141-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add translation for frag to nftables. According to the --fraglen code: case O_FRAGLEN: /* * As of Linux 3.0, the kernel does not check for * fraglen at all. */ In addition, the kernel code doesn't show any reference to the flag IP6T_FRAG_LEN, so this option is deprecated and won't be translated to nft. Examples: $ sudo iptables-translate -t filter -A INPUT -m frag --fragid 100:200 -j ACCEPT nft add rule ip6 filter INPUT frag id 100-200 counter accept $ sudo iptables-translate -t filter -A INPUT -m frag --fragid 100 --fragres --fragmore -j ACCEPT nft add rule ip6 filter INPUT frag id 100 frag reserved 1 frag more-fragments 1 counter accept $ sudo iptables-translate -t filter -A INPUT -m frag ! --fragid 100:200 -j ACCEPT nft add rule ip6 filter INPUT frag id != 100-200 counter accept $ sudo iptables-translate -t filter -A INPUT -m frag --fragid 100:200 --fraglast -j ACCEPT nft add rule ip6 filter INPUT frag id 100-200 frag more-fragments 0 counter accept $ sudo iptables-translate -t filter -A INPUT -m frag --fragid 100:200 --fragfirst -j ACCEPT nft add rule ip6 filter INPUT frag id 100-200 frag frag-off 0 counter accept $ sudo iptables-translate -t filter -A INPUT -m frag --fraglast -j ACCEPT nft add rule ip6 filter INPUT frag more-fragments 0 counter accept Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_TRACE: Add translation to nftLiping Zhang2016-06-081-0/+8
| | | | | | | | | | For example: # iptables-translate -t raw -A PREROUTING -j TRACE nft add rule ip raw PREROUTING counter nftrace set 1 Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_dscp: Add translation to nftLaura Garcia Liebana2016-06-071-13/+58
| | | | | | | | | | | | | | | Add translation for dscp to nftables, for both ipv4 and ipv6. Examples: $ sudo iptables-translate -t filter -A INPUT -m dscp --dscp 0x32 -j ACCEPT nft add rule ip filter INPUT ip dscp 0x32 counter accept $ sudo ip6tables-translate -t filter -A INPUT -m dscp ! --dscp 0x32 -j ACCEPT nft add rule ip6 filter INPUT ip6 dscp != 0x32 counter accept Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_multiport: Add translation to nftLaura Garcia Liebana2016-06-061-0/+115
| | | | | | | | | | | | | | | | | | Add translation for multiport to nftables, which it's supported natively. Examples: $ sudo iptables-translate -t filter -A INPUT -p tcp -m multiport --dports 80,81 -j ACCEPT nft add rule ip filter INPUT ip protocol tcp tcp dport { 80,81} counter accept $ sudo iptables-translate -t filter -A INPUT -p tcp -m multiport --dports 80:88 -j ACCEPT nft add rule ip filter INPUT ip protocol tcp tcp dport 80-88 counter accept $ sudo iptables-translate -t filter -A INPUT -p tcp -m multiport ! --dports 80:88 -j ACCEPT nft add rule ip filter INPUT ip protocol tcp tcp dport != 80-88 counter accept Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_devgroup: Fix order of mask and idShivani Bhardwaj2016-06-021-2/+2
| | | | | | | | | The order of mask and id in the translated code is not apt so fix it. This patch follows commit 8548dd by Liping Zhang. Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_hbh: Add translation to nftLaura Garcia Liebana2016-06-021-0/+17
| | | | | | | | | | | | | | Add translation for Hop-By-Hop header to nftables. Hbh options are not supported yet in nft. $ sudo ip6tables-translate -t filter -A INPUT -m hbh --hbh-len 22 nft add rule ip6 filter INPUT hbh hdrlength 22 counter $ sudo ip6tables-translate -t filter -A INPUT -m hbh ! --hbh-len 22 nft add rule ip6 filter INPUT hbh hdrlength != 22 counter Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_connmark: Fix order of mask and markShivani Bhardwaj2016-06-021-2/+2
| | | | | | | | | | The order of mask and mark in the output is wrong. This has been pointed out: http://git.netfilter.org/iptables/commit/?id=8548dd253833027c68ac6400c3118ef788fabe5d by Liping Zhang <liping.zhang@spreadtrum.com>. This patch fixes the same issue with connmark. Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_ipcomp: Add translation to nftLaura Garcia Liebana2016-06-011-0/+13
| | | | | | | | | | | | | | | | | | Add translation of ipcomp to nftables. First value of the parameter 'ipcompspi' will be translated to 'cpi' parameter in nftables. Parameter 'compres' is not supported in nftables. Examples: $ sudo iptables-translate -t filter -A INPUT -m ipcomp --ipcompspi 0x12 -j ACCEPT nft add rule ip filter INPUT comp cpi 18 counter accept $ sudo iptables-translate -t filter -A INPUT -m ipcomp ! --ipcompspi 0x12 -j ACCEPT nft add rule ip filter INPUT comp cpi != 18 counter accept Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_mark: fix a wrong translation to nft when mask is specifiedLiping Zhang2016-06-011-2/+2
| | | | | | | | | | | | | | | The mask and mark's order is reversed, so when we specify the mask, we will get the wrong translation result: # iptables-translate -A INPUT -m mark --mark 0x1/0xff nft add rule ip filter INPUT mark and 0x1 == 0xff counter Apply this patch, translation will become: # iptables-translate -A INPUT -m mark --mark 0x1/0xff nft add rule ip filter INPUT mark and 0xff == 0x1 counter Cc: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: NETMAP: add ' to:' prefix when printing NETMAP targetFlorian Westphal2016-06-012-2/+2
| | | | | | | | | | | | | | | | NETMAP .print function doesn't insert the ' ' character needed to seperate earlier output from the target network, i.e. iptables -L prints something like 2.2.2.5-2.2.2.103.3.3.64/28 instead of 2.2.2.5-2.2.2.10 3.3.3.64/28 Add a ' to:' prefix just like we do for S/DNAT targets. Closes https://bugzilla.netfilter.org/show_bug.cgi?id=1070. Signed-off-by: Florian Westphal <fw@strlen.de>
* extensions: libxt_limit: fix a wrong translation to nft ruleLiping Zhang2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The default burst value is 5 in iptables limit extension while it is 0 in nft limit expression, if the burst value is default, it will not be displayed when we dump the rules. But when we do translation from iptables rules to nft rules, we should keep the limit burst value unchanged, even if it is not displayed in iptables rules. And now, if the limit-burst value in the iptables rule is 5 or 0, they are all translated to nft rule without burst, this is wrong: $ sudo iptables-translate -A INPUT -m limit --limit 10/s --limit-burst 5 nft add rule ip filter INPUT limit rate 10/second counter $ sudo iptables-translate -A INPUT -m limit --limit 10/s --limit-burst 0 nft add rule ip filter INPUT limit rate 10/second burst 0 packets counter Apply this patch, translation will become: $ sudo iptables-translate -A INPUT -m limit --limit 10/s --limit-burst 5 nft add rule ip filter INPUT limit rate 10/second burst 5 packets counter $ sudo iptables-translate -A INPUT -m limit --limit 10/s --limit-burst 0 nft add rule ip filter INPUT limit rate 10/second counter Fixes: a8dfbe3a3acb ("extensions: libxt_limit: Add translation to nft") Cc: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables: update pf.osXose Vazquez Perez2016-05-051-9/+28
| | | | | | | | | | | | Sync with latest *BSD release: https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/etc/pf.os Changelog: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/pf.os Cc: Evgeniy Polyakov <johnpol@2ka.mxt.ru> Cc: Jan Engelhardt <jengelh@medozas.de> Cc: Pablo Neira Ayuso <pablo@netfilter.org> Cc: netfilter-devel <netfilter-devel@vger.kernel.org> Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_NFQUEUE: Add missing testsShivani Bhardwaj2016-04-291-0/+4
| | | | | | | Add missing tests for NFQUEUE. Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de>
* configure: make libmnl and libnftnl hard requirementsGiuseppe Longo2016-04-271-0/+18
| | | | | | | | | | | Iptables building is broken if either libmnl or libnftnl is not installed on the system. Configure script actually checks if libmnl and libnftnl are installed, but doesn't exit if they are not. Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_NFQUEUE: Unstack different versionsShivani Bhardwaj2016-04-271-12/+92
| | | | | | | | | Remove the stacking of older version into the newer one by adding the appropriate code corresponding to each version. Suggested-by: Florian Westphal <fw@strlen.de> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_NFQUEUE: Fix bug with order of fanout and bypassShivani Bhardwaj2016-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | NFQUEUE had a bug with the ordering of fanout and bypass options which was arising due to same and odd values for flags and bypass when used together. Because of this, during bitwise ANDing of flags and NFQ_FLAG_CPU_FANOUT, the value always evaluated to false (since NFQ_FLAG_CPU_FANOUT=0x02) and led to skipping of fanout option whenever it was used before bypass because then flags would be 1. Before this patch, $ sudo iptables -A FORWARD -j NFQUEUE -p TCP --sport 80 --queue-balance 0:3 --queue-cpu-fanout --queue-bypass Chain FORWARD (policy ACCEPT) target prot opt source destination NFQUEUE tcp -- anywhere anywhere tcp spt:http NFQUEUE balance 0:3 bypass After this patch, Chain FORWARD (policy ACCEPT) target prot opt source destination NFQUEUE tcp -- anywhere anywhere tcp spt:http NFQUEUE balance 0:3 bypass cpu-fanout Closes bugzilla entry: http://bugzilla.netfilter.org/show_bug.cgi?id=939 Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables-translate: Don't print "nft" in iptables-restore-translate commandGuruswamy Basavaiah2016-04-271-1/+3
| | | | | | | | No need to print "nft" in function do_command_xlate, if the function is called from iptables-restore-translate command. Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables-translate: Printing the table name before chain name.Guruswamy Basavaiah2016-04-271-1/+1
| | | | | | | | | | | | | | | Command ./iptables-restore-translate, was printing table name before the chain name for user added chains. This is breaking ./nft -f command. Before fix, output of "./iptables-restore-translate" add chain ip OUTPUT_direct raw After fix: add chain ip raw OUTPUT_direct Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables.8: nat table has four builtin chainsFlorian Westphal2016-04-261-2/+3
| | | | | | | | SNAT section in iptables-extensions(8) already mentions this but the main section did not. Reported-by: Lion Yang <lion@aosc.io> Signed-off-by: Florian Westphal <fw@strlen.de>
* extensions/libxt_tcp: fix nftables translate flags value, 'none' vs '0x0'Arturo Borrero2016-04-071-1/+1
| | | | | | | | | | | | | | | | The iptables command: -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE should translate to: tcp flags & fin|syn|rst|psh|ack|urg == 0x0 instead of: tcp flags & fin|syn|rst|psh|ack|urg == none Reported-by: Vadim A. Misbakh-Soloviov <netfilter@mva.name> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Tested-by: Vadim A. Misbakh-Soloviov <netfilter@mva.name> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables: extensions: libxt_TEE: Add translation to nftRoberto García2016-03-281-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add translation for TEE target to nft. However, there is a problem with the output when using ip6tables-translate. I couldn't find a fix for that. Examples: $ iptables-translate -t mangle -A PREROUTING \ -j TEE --gateway 192.168.0.2 --oif eth0 nft add rule ip mangle PREROUTING counter dup to 192.168.0.2 device eth0 $ iptables-translate -t mangle -A PREROUTING \ -j TEE --gateway 192.168.0.2 nft add rule ip mangle PREROUTING counter dup to 192.168.0.2 $ ip6tables-translate -t mangle -A PREROUTING \ -j TEE --gateway ab12:00a1:1112:acba:: nft add rule ip6 mangle PREROUTING counter dup to ab12:a1:1112:acba:: $ ip6tables-translate -t mangle -A PREROUTING \ -j TEE --gateway ab12:00a1:1112:acba:: --oif eth0 nft add rule ip6 mangle PREROUTING counter dup to ab12:a1:1112:acba:: device eth0 Signed-off-by: Roberto García <rodanber@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* libxtables: missing comment initialization in xt_xlate_alloc()Pablo Neira Ayuso2016-03-251-0/+1
| | | | | | Initialize comment buffer when allocation the xt translation structure. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* configure: Show support for connlabelShivani Bhardwaj2016-03-221-9/+22
| | | | | | | | | | | | | | | | | | | | | Add the --disable-connlabel option and the appropriate functionality associated with it. After this patch, iptables configuration shows up as: Iptables Configuration: IPv4 support: yes IPv6 support: yes Devel support: yes IPQ support: no Large file support: yes BPF utils support: no nfsynproxy util support: no nftables support: yes connlabel support: yes Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables-translate: translate iptables --flushGuruswamy Basavaiah2016-03-221-0/+8
| | | | | | | | | | | | | translation for iptables --flush Examples: $ sudo iptables-translate -F INPUT nft flush chain ip filter INPUT $ sudo iptables-translate -F -t nat nft flush table ip nat Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_REJECT: Avoid to print the default reject with value in ↵Laura Garcia Liebana2016-03-171-1/+4
| | | | | | | | | | | | | | | | | | | | the translation Avoid to print the reject with value in the translation when the value is the default. Before this patch: $ sudo ip6tables-translate -A FORWARD -p TCP --dport 22 -j REJECT nft add rule ip6 filter FORWARD tcp dport 22 counter reject with icmpv6 type port-unreachable After this patch: $ sudo ip6tables-translate -A FORWARD -p TCP --dport 22 -j REJECT nft add rule ip6 filter FORWARD tcp dport 22 counter reject Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libipt_REJECT: Avoid to print the default reject with value in ↵Laura Garcia Liebana2016-03-171-1/+3
| | | | | | | | | | | | | | | | | | | the translation Avoid to print the reject with value in the translation when the value is the default. Before this patch: $ sudo iptables-translate -A FORWARD -p TCP --dport 22 -j REJECT nft add rule ip filter FORWARD tcp dport 22 counter reject with icmp type port-unreachable After this patch: $ sudo iptables-translate -A FORWARD -p TCP --dport 22 -j REJECT nft add rule ip filter FORWARD tcp dport 22 counter reject Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libipt_icmp: Add translation to nftLaura Garcia Liebana2016-03-171-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | Add translation for icmp to nftables. Not supported icmp codes in nftables are: network-unreachable, host-unreachable, protocol-unreachable, port-unreachable, fragmentation-needed, source-route-failed, network-unknown, host-unknown, network-prohibited, host-prohibited, TOS-network-unreachable, TOS-host-unreachable, communication-prohibited, host-precedence-violation, precedence-cutoff, network-redirect, host-redirect, TOS-network-redirect, TOS-host-redirect, ttl-zero-during-transit, ttl-zero-during-reassembly, ip-header-bad and required-option-missing. Examples: $ sudo iptables-translate -t filter -A INPUT -m icmp --icmp-type echo-reply -j ACCEPT nft add rule ip filter INPUT icmp type echo-reply counter accept $ sudo iptables-translate -t filter -A INPUT -m icmp --icmp-type 3 -j ACCEPT nft add rule ip filter INPUT icmp type destination-unreachable counter accept $ sudo iptables-translate -t filter -A INPUT -m icmp ! --icmp-type 3 -j ACCEPT nft add rule ip filter INPUT icmp type != destination-unreachable counter accept Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_LOG: Avoid to print the default log level in the translationRoberto García2016-03-121-1/+2
| | | | | | | | | | | | | | | Remove the log level when default is used Before: $ sudo iptables-translate -I INPUT -j LOG nft add rule filter INPUT log level warning After: $ sudo iptables-translate -I INPUT -j LOG nft add rule filter INPUT counter log Signed-off-by: Roberto García <rodanber@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libipt_LOG: Avoid to print the default log level in the translationLaura Garcia Liebana2016-03-101-1/+2
| | | | | | | | | | | | Avoid to print the log level in the translation when the level is the default value. Example: $ sudo iptables-translate -t filter -A INPUT -m icmp ! --icmp-type 10 -j LOG nft add rule ip filter INPUT icmp type != router-solicitation counter log Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
* iptables/xtables-arp.c: fix typo, wierd vs weirdArturo Borrero2016-03-101-1/+1
| | | | | | | Reported by Debian lintian tool. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de>
* extensions/libxt_rpfilter.man: fix typo, specifiy vs specifyArturo Borrero2016-03-101-1/+1
| | | | | | | Reported by Debian lintian tool. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de>
* iptables-translate: pass ipt_entry and ip6t_entry to ->xlate()Pablo Neira Ayuso2016-03-0942-62/+67
| | | | | | | The multiport match needs it, this basically leaves ->xlate() indirection with almost the same interface as ->print(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_icmp6: Add translation to nftLaura Garcia Liebana2016-03-081-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | Add translation for icmpv6 to nftables. Not supported icmp codes in nftables are: no-route, communication-prohibited, beyond-scope, address-unreachable, port-unreachable, failed-policy, reject-route, ttl-zero-during-transit, ttl-zero-during-reassembly, bad-header, unknown-header-type and unknown-option. Examples: $ ip6tables-translate -t filter -A INPUT -m icmp6 --icmpv6-type 1 -j LOG nft add rule ip6 filter INPUT icmpv6 type destination-unreachable counter log level warn $ ip6tables-translate -t filter -A INPUT -m icmp6 --icmpv6-type neighbour-advertisement -j LOG nft add rule ip6 filter INPUT icmpv6 type nd-neighbor-advert counter log level warn $ ip6tables-translate -t filter -A INPUT -m icmp6 ! --icmpv6-type packet-too-big -j LOG nft add rule ip6 filter INPUT icmpv6 type != packet-too-big counter log level warn Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_rt.c: Add translation to nftJanani Ravichandran2016-03-071-0/+35
| | | | | | | | | | | | | | | | | | | | Add translation for rt for options --rt-type, --rt-segsleft and --rt-len. Examples: $ sudo ip6tables-translate -A INPUT -m rt --rt-type 0 -j DROP nft add rule ip6 filter INPUT rt type 0 counter drop $ sudo ip6tables-translate -A INPUT -m rt ! --rt-len 22 -j DROP nft add rule ip6 filter INPUT rt hdrlength != 22 counter drop $ sudo ip6tables-translate -A INPUT -m rt --rt-segsleft 26 -j ACCEPT nft add rule ip6 filter INPUT rt seg-left 26 counter accept The xlate function returns 0 for other options. Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_dccp: Add translation to nftShivani Bhardwaj2016-03-071-0/+92
| | | | | | | | | | | | | | | | | | | | | | | Add translation for dccp to nftables. Full translation of this match awaits the support for --dccp-option. Examples: $ sudo iptables-translate -A INPUT -p dccp -m dccp --sport 100 nft add rule ip filter INPUT dccp sport 100 counter $ sudo iptables-translate -A INPUT -p dccp -m dccp --dport 100:200 nft add rule ip filter INPUT dccp dport 100-200 counter $ sudo iptables-translate -A INPUT -p dccp -m dccp ! --dport 100 nft add rule ip filter INPUT dccp dport != 100 counter $ sudo iptables-translate -A INPUT -p dccp -m dccp --dport 100 --dccp-types REQUEST,RESPONSE,DATA,ACK,DATAACK,CLOSEREQ,CLOSE,SYNC,SYNCACK nft add rule ip filter INPUT dccp dport 100 dccp type {request, response, data, ack, dataack, closereq, close, sync, syncack} counter Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_sctp: Add translation to nftShivani Bhardwaj2016-03-031-0/+37
| | | | | | | | | | | | | | | | | Add translation for sctp to nftables. Full translation of this match awaits the support for --chunk-types option. Examples: $ sudo iptables-translate -A INPUT -p sctp --dport 80 -j DROP nft add rule ip filter INPUT sctp dport 80 counter drop $ sudo iptables-translate -A INPUT -p sctp ! --sport 80:100 -j ACCEPT nft add rule ip filter INPUT sctp sport != 80-100 counter accept Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libxt_owner: Add translation to nftShivani Bhardwaj2016-03-031-0/+51
| | | | | | | | | | | | | | | | | | | | Add translation for module owner to nftables. Full translation of this match awaits the support for --socket-exists option. Examples: $ sudo iptables-translate -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner root -j ACCEPT nft add rule ip nat OUTPUT tcp dport 80 skuid 0 counter accept $ sudo iptables-translate -t nat -A OUTPUT -p tcp --dport 80 -m owner --gid-owner 0-10 -j ACCEPT nft add rule ip nat OUTPUT tcp dport 80 skgid 0-10 counter accept $ sudo iptables-translate -t nat -A OUTPUT -p tcp --dport 80 -m owner ! --uid-owner shivani -j ACCEPT nft add rule ip nat OUTPUT tcp dport 80 skuid != 1000 counter accept Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_mh: Add translation to nftShivani Bhardwaj2016-03-021-0/+21
| | | | | | | | | | | | | | | Add translation for mobility header to nftables. Examples: $ sudo ip6tables-translate -A INPUT -p mh --mh-type 1 -j ACCEPT nft add rule ip6 filter INPUT meta l4proto mobility-header mh type 1 counter accept $ sudo ip6tables-translate -A INPUT -p mh --mh-type 1:3 -j ACCEPT nft add rule ip6 filter INPUT meta l4proto mobility-header mh type 1-3 counter accept Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* iptables: nft-ipv6: Use meta l4proto instead of nexthdrShivani Bhardwaj2016-03-021-1/+1
| | | | | | | | Use meta l4proto in place of nexthdr for ipv6 protocols as it is not necessary that all protocols be next header. Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libip6t_MASQUERADE: Add translation to nftShivani Bhardwaj2016-03-021-0/+22
| | | | | | | | | | | | | | | | | | Add translation for masquerade to nftables. Examples: $ sudo ip6tables-translate -t nat -A POSTROUTING -j MASQUERADE nft add rule ip6 nat POSTROUTING counter masquerade $ sudo ip6tables-translate -t nat -A POSTROUTING -p tcp -j MASQUERADE --to-ports 10 nft add rule ip6 nat POSTROUTING ip6 nexthdr tcp counter masquerade to :10 $ sudo ip6tables-translate -t nat -A POSTROUTING -p tcp -j MASQUERADE --to-ports 10-20 --random nft add rule ip6 nat POSTROUTING ip6 nexthdr tcp counter masquerade to :10-20 random Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extensions: libipt_MASQUERADE: Add translation to nftShivani Bhardwaj2016-03-021-0/+24
| | | | | | | | | | | | | | | | | | Add translation for masquerade to nftables. Examples: $ sudo iptables-translate -t nat -A POSTROUTING -j MASQUERADE nft add rule ip nat POSTROUTING counter masquerade $ sudo iptables-translate -t nat -A POSTROUTING -p tcp -j MASQUERADE --to-ports 10 nft add rule ip nat POSTROUTING ip protocol tcp counter masquerade to :10 $ sudo iptables-translate -t nat -A POSTROUTING -p tcp -j MASQUERADE --to-ports 10-20 --random nft add rule ip nat POSTROUTING ip protocol tcp counter masquerade to :10-20 random Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>