[iptools.py] is_crans est IPv6 compliant
darcs-hash:20110509171644-bd074-058f91149e0d93404b32aefbfeff10a779da73cf.gz
This commit is contained in:
parent
0b78812de7
commit
4dc19211fc
1 changed files with 5 additions and 4 deletions
|
@ -7,8 +7,8 @@ Copyright (C) Frédéric Pauget
|
||||||
Licence : GPLv2
|
Licence : GPLv2
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re, netaddr
|
||||||
from config import NETs_regexp
|
from config import NETs_regexp, prefix
|
||||||
|
|
||||||
# Pour accélérer QuadToDec...
|
# Pour accélérer QuadToDec...
|
||||||
__QuadToDecDone = {}
|
__QuadToDecDone = {}
|
||||||
|
@ -123,9 +123,10 @@ def is_crans(ip):
|
||||||
""" Vérifie que l'ip est dans le réseau CRANS
|
""" Vérifie que l'ip est dans le réseau CRANS
|
||||||
"""
|
"""
|
||||||
# Pour titanic
|
# Pour titanic
|
||||||
if ip == '138.231.136.14' :
|
ip = netaddr.IPAddress(ip)
|
||||||
|
if str(ip) in [ '138.231.136.14', '2a01:240:fe3d:4:a873:65ff:fe63:6f75']:
|
||||||
return False
|
return False
|
||||||
if re.match(NETs_regexp['all'], ip):
|
if re.match(NETs_regexp['all'], str(ip)) or ip in netaddr.IPNetwork(prefix['subnet'][0]):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue