summaryrefslogtreecommitdiffstats
path: root/isys/isys.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-10-02 19:29:21 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-10-02 19:29:21 +0000
commitc605886cce2f117cd3b74bbd32746737962b06e1 (patch)
treed3816e82f3378ad55b1b434c6eed031d6b0df593 /isys/isys.py
parent287138b5f91b3061df3f4bb629e264eab0553799 (diff)
downloadanaconda-c605886cce2f117cd3b74bbd32746737962b06e1.tar.gz
anaconda-c605886cce2f117cd3b74bbd32746737962b06e1.tar.xz
anaconda-c605886cce2f117cd3b74bbd32746737962b06e1.zip
* isys/isys.py (inet_doConvertPrefixToNetmask): Removed since it does
not work right. Added prefix2netmask() passthrough to _isys. * isys/isys.c (doConvertPrefixToNetmask): When Python fails, use C. Added isys.prefix2netmask() for use in Python code to convert a CIDR prefix to a dotted-quad format netmask (#207845). * iw/network_gui.py (NetworkWindow): Use isys.prefix2netmask() * textw/network_text.py (NetworkDeviceWindow): Use isys.prefix2netmask()
Diffstat (limited to 'isys/isys.py')
-rw-r--r--isys/isys.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/isys/isys.py b/isys/isys.py
index e62713ad0..f62148e85 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -449,13 +449,6 @@ def inet_convertNetmaskToPrefix (netmask):
return prefix
-# Converts IPv4 CIDR prefix to a dotted-quad netmask
-def inet_convertPrefixToNetmask (prefix):
- (m,) = struct.unpack('I',socket.inet_pton(socket.AF_INET,'255.255.255.255'))
- tmp = m >> (32 - int(prefix))
- ret = socket.inet_ntop(socket.AF_INET, struct.pack('i', tmp))
- return ret
-
def getopt(*args):
warnings.warn("isys.getopt is deprecated. Use optparse instead.",
DeprecationWarning, stacklevel=2)
@@ -886,6 +879,9 @@ def getIPAddress(dev):
def resetFileContext(fn, instroot = '/'):
return _isys.resetFileContext(fn, instroot)
+def prefix2netmask(prefix):
+ return _isys.prefix2netmask(prefix)
+
auditDaemon = _isys.auditdaemon
handleSegv = _isys.handleSegv