diff options
author | Matt Wilson <msw@redhat.com> | 1999-08-03 21:48:42 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-08-03 21:48:42 +0000 |
commit | 21abab5d91eb6e15bc5cf66522bb597be181a0f0 (patch) | |
tree | 8eeece43113be79aa25123f5c14d32a0757c569e /text.py | |
parent | 87497f4f7bff41e380630de58c785aafad724e18 (diff) | |
download | anaconda-21abab5d91eb6e15bc5cf66522bb597be181a0f0.tar.gz anaconda-21abab5d91eb6e15bc5cf66522bb597be181a0f0.tar.xz anaconda-21abab5d91eb6e15bc5cf66522bb597be181a0f0.zip |
use new isys ip calcs
Diffstat (limited to 'text.py')
-rw-r--r-- | text.py | 44 |
1 files changed, 14 insertions, 30 deletions
@@ -100,18 +100,6 @@ class WelcomeWindow: return INSTALL_OK class NetworkWindow: - def calculateIPs (self): - ip = self.ip.value () - nm = self.nm.value () - if ip and nm: - ipaddr = isys.inet_aton (ip) - nmaddr = isys.inet_aton (nm) - - netaddr = ipaddr & nmaddr - bcaddr = netaddr | (~nmaddr); - - self.network = isys.inet_ntoa (netaddr) - self.broadcast = isys.inet_ntoa (bcaddr) def run(self, screen, todo): def setsensitive (self): @@ -125,33 +113,29 @@ class NetworkWindow: def calcNM (self): ip = self.ip.value () - if ip: - ipaddr = isys.inet_aton (ip) - if (ipaddr >> 24 & 0x000000ff) <= 127: - mask = "255.0.0.0"; - elif (ipaddr >> 24 & 0x000000ff) <= 191: - mask = "255.255.0.0"; - else: - mask = "255.255.255.0"; - + if ip and not self.nm.value (): + try: + mask = isys.inet_calcNetmask (ip) + except ValueError: + return + self.nm.set (mask) def calcGW (self): ip = self.ip.value () nm = self.nm.value () if ip and nm: - ipaddr = isys.inet_aton (ip) - nmaddr = isys.inet_aton (nm) - - self.calculateIPs () - - netaddr = ipaddr & nmaddr - bcaddr = netaddr | (~nmaddr); + try: + (net, bcast) = isys.inet_calcNetBroad (ip, nm) + except ValueError: + return if not self.gw.value (): - self.gw.set (isys.inet_ntoa (bcaddr - 1)) + gw = isys.inet_calcGateway (bcast) + self.gw.set (gw) if not self.ns.value (): - self.ns.set (isys.inet_ntoa (netaddr + 1)) + ns = isys.inet_calcNS (net) + self.ns.set (ns) devices = todo.network.available () dev = devices[devices.keys ()[0]] |