From 4bffa3ece1ae906303a7d323e6151faa7b9805b4 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Wed, 10 Dec 2014 22:58:09 +0100 Subject: [PATCH] fw6: adaptation au cas sans rid --- gestion/gen_confs/firewall6.py | 2 ++ gestion/ipt.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/gestion/gen_confs/firewall6.py b/gestion/gen_confs/firewall6.py index f862bbbe..823b9c26 100755 --- a/gestion/gen_confs/firewall6.py +++ b/gestion/gen_confs/firewall6.py @@ -44,6 +44,8 @@ Usage: def ports(dev_ip6, dev_list): ''' Ouvre les ports ''' for machine in machines : + if not machine.rid(): + continue for type_machine in ['fil', 'adherents-v6', 'wifi', 'wifi-adh-v6', 'serveurs']: for plage in rid[type_machine]: if int(machine.rid()) in range(plage[0], plage[1]): diff --git a/gestion/ipt.py b/gestion/ipt.py index 2b729318..d463bccd 100644 --- a/gestion/ipt.py +++ b/gestion/ipt.py @@ -175,6 +175,8 @@ ACCEPT' % (dev, proto, ip, port)) def blacklist(self, machine): ''' Met des règles empêchant toute communication vers et à partir de la machine considérée ''' + if not machine.rid(): + return ident = int(machine.rid()) ip = "" for type_m, plages in rid_primaires.iteritems(): @@ -216,6 +218,8 @@ class Update(object): dev_ext = iface6('sixxs2') net = "" for r in rids: + if not r: + continue net, _ = find_rid_plage(r) if net == "Inconnu": raise RidError("Il n'y a pas de réseau associé au rid %i" % m) @@ -826,6 +830,8 @@ def macips(ipt, machines, types_machines): tab = {'serveurs' : 'fil' } for machine in machines: + if not machine.rid(): + continue for type_m in types_machines: for plage in rid[type_m]: if int(machine.rid()) in range(plage[0], plage[1]):