Commit 5e8c54a0 authored by Valentin Samir's avatar Valentin Samir
Browse files

[firewall4] Methode pour recharger une "chaine"

parent c5e45fea
......@@ -178,6 +178,25 @@ class firewall_base(object) :
str += 'COMMIT\n'
return str
def reload(self, func_name):
if squeeze and self.reloadable[func_name] in self.use_ipset:
anim('\tVidage de %s' % self.reloadable[func_name]())
for table in ['raw', 'mangle', 'filter', 'nat']:
self.flush(table, self.reloadable[func_name]())
self.restore(noflush=True)
print OK
for table in ['raw', 'mangle', 'filter', 'nat']:
self.reloadable[func_name](table)
if self.reloadable[func_name] in self.use_ipset:
self.reloadable[func_name](fill_ipset=True)
if self.reloadable[func_name] in self.use_tc:
self.reloadable[func_name](run_tc=True)
anim('\tRestoration d\'iptables')
self.restore(noflush=True)
print OK
def __init__(self):
global conn
#initialisation des structures communes : récupération des ipset
......@@ -237,7 +256,7 @@ class firewall_base(object) :
if squeeze:
anim('\tVidage du pare-feu')
fw.restore()
self.restore()
print OK
self.raw_table()
......@@ -246,14 +265,14 @@ class firewall_base(object) :
self.nat_table()
anim('\tRestoration d\'iptables')
fw.restore()
self.restore()
print OK
return
def stop(self):
"""Vide les règles du pare-feu"""
fw.delete()
fw.restore()
self.delete()
self.restore()
return
def restart(self):
......@@ -1199,21 +1218,4 @@ Pour reconfiguration d'IPs particulières, utiliser generate. """ % \
elif arg == 'restart':
fw.restart()
else:
if squeeze:
anim('\tVidage de %s' % fw.reloadable[arg]())
for table in ['raw', 'mangle', 'filter', 'nat']:
fw.flush(table, fw.reloadable[arg]())
fw.restore(noflush=True)
print OK
for table in ['raw', 'mangle', 'filter', 'nat']:
fw.reloadable[arg](table)
if fw.reloadable[arg] in fw.use_ipset:
fw.reloadable[arg](fill_ipset=True)
if fw.reloadable[arg] in fw.use_tc:
fw.reloadable[arg](run_tc=True)
anim('\tRestoration d\'iptables')
fw.restore(noflush=True)
print OK
fw.reload(arg)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment