From fb323134d08c4f3f28a5ff321140513d196ba03b Mon Sep 17 00:00:00 2001 From: titoko Date: Wed, 10 Apr 2013 13:46:41 +0200 Subject: [PATCH] Fix IPV6 problem --- yunohost_firewall.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/yunohost_firewall.py b/yunohost_firewall.py index 2988c82b..311ea592 100644 --- a/yunohost_firewall.py +++ b/yunohost_firewall.py @@ -185,7 +185,11 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None): Return None """ - os.system ("iptables -P INPUT ACCEPT") + if ipv6: + os.system ("ip6tables -P INPUT ACCEPT") + else: + os.system ("iptables -P INPUT ACCEPT") + if upnp: upnp = miniupnpc.UPnP() upnp.discoverdelay = 200 @@ -213,7 +217,10 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None): firewall = yaml.load(f) for i,port in enumerate (firewall[ip][protocol]): - os.system ("iptables -A INPUT -p "+ protocol +" -i eth0 --dport "+ str(port) +" -j ACCEPT") + if ipv6: + os.system ("ip6tables -A INPUT -p "+ protocol +" -i eth0 --dport "+ str(port) +" -j ACCEPT") + else: + os.system ("iptables -A INPUT -p "+ protocol +" -i eth0 --dport "+ str(port) +" -j ACCEPT") if upnp: upnp.addportmapping(port, protocol, upnp.lanaddr, port, 'yunohost firewall : port %u' % port, '')