Fix IPV6 problem

This commit is contained in:
titoko 2013-04-10 13:46:41 +02:00
parent c750706b37
commit fb323134d0

View file

@ -185,7 +185,11 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None):
Return
None
"""
if ipv6:
os.system ("ip6tables -P INPUT ACCEPT")
else:
os.system ("iptables -P INPUT ACCEPT")
if upnp:
upnp = miniupnpc.UPnP()
upnp.discoverdelay = 200
@ -213,6 +217,9 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None):
firewall = yaml.load(f)
for i,port in enumerate (firewall[ip][protocol]):
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, '')