diff options
author | David Cantrell <dcantrell@redhat.com> | 2006-10-03 20:24:38 +0000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2006-10-03 20:24:38 +0000 |
commit | d24c4410ace27384c7dd0f532f2f271b969f02b8 (patch) | |
tree | bdbf8e4379b9ef775668976b4a0d1dc515279812 /isys/isys.py | |
parent | 1e752ea76185148825ba3984e543246b94a8f545 (diff) | |
download | anaconda-d24c4410ace27384c7dd0f532f2f271b969f02b8.tar.gz anaconda-d24c4410ace27384c7dd0f532f2f271b969f02b8.tar.xz anaconda-d24c4410ace27384c7dd0f532f2f271b969f02b8.zip |
* isys/isys.py (inet_calcNetBroad): Umm, use ntohl() so it works on all
platforms.
* iw/network_gui.py (NetworkWindow.handleBroadCastError): Tell users
the IPv4 information given is invalid, since this error message will
occur when calculating the network and broadcast address using the
IPv4 ip address and netmask.
* textw/network_text.py (handleBroadCastError): Add missing error
handling function for network and broadcast address calculation.
Diffstat (limited to 'isys/isys.py')
-rw-r--r-- | isys/isys.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/isys/isys.py b/isys/isys.py index 62d6026cb..f96d5cefe 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -419,20 +419,16 @@ def mknod(pathname, mode, dev): return os.mknod(pathname, mode, dev) def inet_calcNetBroad (ip, nm): - if isinstance (ip, type ("")): - (ipaddr,) = struct.unpack('I', socket.inet_pton(socket.AF_INET, ip)) - else: - ipaddr = ip + (ipaddr,) = struct.unpack('!I', socket.inet_pton(socket.AF_INET, ip)) + ipaddr = socket.ntohl(ipaddr) - if isinstance (nm, type ("")): - (nmaddr,) = struct.unpack('I', socket.inet_pton(socket.AF_INET, nm)) - else: - nmaddr = nm + (nmaddr,) = struct.unpack('!I', socket.inet_pton(socket.AF_INET, nm)) + nmaddr = socket.ntohl(nmaddr) netaddr = ipaddr & nmaddr bcaddr = netaddr | (~nmaddr) - nw = socket.inet_ntop(socket.AF_INET, struct.pack('i', netaddr)) - bc = socket.inet_ntop(socket.AF_INET, struct.pack('i', bcaddr)) + nw = socket.inet_ntop(socket.AF_INET, struct.pack('I', netaddr)) + bc = socket.inet_ntop(socket.AF_INET, struct.pack('I', bcaddr)) return (nw, bc) |