From 92195b6aa8d3875dabb8dd7567caac3f6f9c50a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Mon, 25 Feb 2013 01:55:46 +0100 Subject: [PATCH] =?UTF-8?q?[binding]=20Corrections=20de=20bugs=20dans=20l'?= =?UTF-8?q?impl=C3=A9mentation=20de=20l'ipv6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/config.py | 7 +++++++ gestion/ldap_crans.py | 8 ++++---- gestion/whos.py | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gestion/config.py b/gestion/config.py index 501615c3..119313c7 100644 --- a/gestion/config.py +++ b/gestion/config.py @@ -609,6 +609,13 @@ rid_machines_speciales = { 4097: '91.121.84.138', } +ipv6_machines_speciales = { + # freebox + 4096: 'fe80::210:5aff:feaf:a979', + # ovh + 4097: 'fe80::219:d1ff:fea2:b611', +} + # Les préfixes ipv6 prefix = { 'subnet' : [ '2a01:240:fe3d::/48' ], 'serveurs' : [ '2a01:240:fe3d:4::/64'], diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 51b83f7f..2d0e648a 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -2863,7 +2863,7 @@ Contactez nounou si la MAC est bien celle d'une carte.""", 3) net = self.netv6() try: self._set('macAddress', [mac]) - if self.netv6() != 'special': + if net.size > 1: self.ipv6(ip6tools.mac_to_ipv6(net, netaddr.EUI(mac))) else: self.ipv6(config.ipv6_machines_speciales[int(self.rid())]) @@ -3357,18 +3357,18 @@ Contactez nounou si la MAC est bien celle d'une carte.""", 3) if nettype != 'special': return netaddr.IPNetwork(config.prefix[nettype][0]) else: - return 'special' + return netaddr.IPNetwork(config.ipv6_machines_speciales[int(self.rid())]) def ipv6(self, ipv6=None): """Retourne l'adresse IPv6 correspondant à la machine""" if ipv6 == None: - return unicode(self._data.get('ip6HostNumber', [''])[0]) + return netaddr.IPAddress(self._data.get('ip6HostNumber', [''])[0]) ipv6 = str(ipv6) net = self.netv6() - if net == 'special': + if net.size == 1: ipv6_t = config.ipv6_machines_speciales[int(self.rid())] else: ipv6_t = str(ip6tools.mac_to_ipv6(net, netaddr.EUI(self.mac()))) diff --git a/gestion/whos.py b/gestion/whos.py index 2e03379f..0ddb8a30 100755 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -342,7 +342,7 @@ def list_machines(machines) : return tableau(data, titre = [u'mid', u'rid', u'Type', u'Nom de machine', u'Adresse IP', u'Adresse IPv6', u'Adresse MAC', u'Limitation'], - largeur = [5, 5, 4, '*', 24, 17, 19, 10], + largeur = [5, 5, 4, '*', 15, 22, 17, 10], alignement = ['d', 'd', 'c', 'c', 'c', 'c', 'c', 'c']) def list_bornes(bornes) :