[binding] Corrections de bugs dans l'implémentation de l'ipv6

This commit is contained in:
Pierre-Elliott Bécue 2013-02-25 01:55:46 +01:00
parent d8e716f22b
commit 92195b6aa8
3 changed files with 12 additions and 5 deletions

View file

@ -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())))