From 7882a04669dcff7e493a8cd1c13d12eab3adacc0 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 6 Apr 2013 14:51:40 +0200 Subject: [PATCH] =?UTF-8?q?[firewall4]=20On=20modifie=20des=20fonctions=20?= =?UTF-8?q?de=20manipulation=20de=20la=20structure=20interne=20de=20la=20c?= =?UTF-8?q?lasse=20pare=20feu=20pour=20mieux=20correspondre=20=C3=A0=20ipt?= =?UTF-8?q?ables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/gen_confs/firewall4.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/gestion/gen_confs/firewall4.py b/gestion/gen_confs/firewall4.py index 57bf1c61..ace85c46 100755 --- a/gestion/gen_confs/firewall4.py +++ b/gestion/gen_confs/firewall4.py @@ -100,20 +100,7 @@ class firewall_base(object) : if not chain: for chain in self.chain_list[table]: self.delete(table, chain) - self.clear(table, chain) - def flush(self, table=None, chain=None): - if not table: - for table in tables: - self.flush(table, chain) - if not chain: - for chain in self.chain_list[table]: - self.flush(table, chain) - self.clear(table, chain) - self.chain_list[table].append(chain) - self.rules_list[table][chain]=[] - - def clear(self, table, chain): if not chain in self.chain_list[table]: return if not chain in default_chains: @@ -122,7 +109,18 @@ class firewall_base(object) : else: self.rules_list[table][chain]=[] - def restore(self, noflush=False, table=None, chains=[]): + def flush(self, table=None, chain=None): + if not table: + for table in tables: + self.flush(table, chain) + if not chain: + for chain in self.chain_list[table]: + self.flush(table, chain) + if not chain in self.chain_list[table]: + self.chain_list[table].append(chain) + self.rules_list[table][chain]=[] + + def restore(self, table=None, chains=[], noflush=False): str=self.format(chains) f=open('/tmp/ipt_rules', 'w') f.write(str)