diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-03-21 00:09:53 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-03-21 00:09:53 +0000 |
commit | c29f0955045cdd02965a14300ce5e99364db2d1b (patch) | |
tree | d84a948b5288d9b0b9bd28649f608b8df9f18ea0 /network.py | |
parent | 720f69db5a6df4a3d6afe90ea228b5a90fe41333 (diff) | |
download | anaconda-c29f0955045cdd02965a14300ce5e99364db2d1b.tar.gz anaconda-c29f0955045cdd02965a14300ce5e99364db2d1b.tar.xz anaconda-c29f0955045cdd02965a14300ce5e99364db2d1b.zip |
merge taroon branch up until now. tagged as before-taroon-merge before and
will be tagged after-taroon-merge after. taroon at this point is tagged
taroon-merge-point for where to base merges from in the future
Diffstat (limited to 'network.py')
-rw-r--r-- | network.py | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/network.py b/network.py index 53e3e83ca..b59c947f0 100644 --- a/network.py +++ b/network.py @@ -20,6 +20,7 @@ import string import isys import socket import os +import re from rhpl.log import log from rhpl.translate import _, N_ @@ -51,6 +52,44 @@ def networkDeviceCheck(network, dispatch): if not devs: dispatch.skipStep("network") + +# return if the device is of a type that requires a ptpaddr to be specified +def isPtpDev(devname): + if (devname.startswith("ctc") or devname.startswith("escon") or + devname.startswith("iucv")): + return 1 + return 0 + +# determine whether any active at boot devices are using dhcp +def anyUsingDHCP(devices): + for dev in devices.keys(): + bootproto = devices[dev].get("bootproto") + if bootproto and bootproto == "dhcp": + onboot = devices[dev].get("onboot") + if onboot and onboot != "no": + return 1 + return 0 + +# sanity check an IP string. if valid, returns octets, if invalid, return None +def sanityCheckIPString(ip_string): + ip_re = re.compile('^([0-2]?[0-9]?[0-9])\\.([0-2]?[0-9]?[0-9])\\.([0-2]?[0-9]?[0-9])\\.([0-2]?[0-9]?[0-9])$') + + #Sanity check the string + m = ip_re.match (ip_string) + try: + if not m: + return None + octets = m.groups() + if len(octets) != 4: + return None + for octet in octets: + if (int(octet) < 0) or (int(octet) > 255): + return None + except TypeError: + return None + + return octets + class NetworkDevice(SimpleConfigFile): def __str__(self): s = "" @@ -113,7 +152,8 @@ class Network: netinf = string.splitfields(line, '=') info [netinf[0]] = string.strip(netinf[1]) self.netdevices [info["DEVICE"]] = NetworkDevice(info["DEVICE"]) - for key in ("IPADDR", "NETMASK", "BOOTPROTO", "ONBOOT", "MTU"): + for key in ("IPADDR", "NETMASK", "BOOTPROTO", "ONBOOT", "MTU", + "REMIP"): if info.has_key(key): self.netdevices [info["DEVICE"]].set((key, info[key])) if info.has_key("GATEWAY"): |