diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | isys/isys.c | 24 | ||||
-rw-r--r-- | isys/isys.py | 8 |
3 files changed, 24 insertions, 12 deletions
@@ -5,6 +5,10 @@ code. * partedUtils.py: Likewise. + * isys/isys.py: If klass is None, set to empty string. Always send + klass to doDhcpNetDevice. + * isys/isys.c: Do not segfault (#240804). + 2007-05-21 Jeremy Katz <katzj@redhat.com> * yuminstall.py (AnacondaCallback.callback): Fix tyop, mark for diff --git a/isys/isys.c b/isys/isys.c index 45e6389c3..7b2c17793 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -623,7 +623,8 @@ static PyObject * doDhcpNetDevice(PyObject * s, PyObject * args) { if (!PyArg_ParseTuple(args, "sisis|s", &device, &useipv4, &ipv4method, &useipv6, &ipv6method, &dhcpclass)) return NULL; - if (dhcpclass == NULL) { + /* if we lack a user-provided dhcpclass, construct the default */ + if ((dhcpclass == NULL) || (strlen(dhcpclass) == 0)) { if (uname(&kv) == -1) dhcpclass = "anaconda"; else { @@ -636,17 +637,24 @@ static PyObject * doDhcpNetDevice(PyObject * s, PyObject * args) { memset(&cfg, '\0', sizeof(cfg)); strcpy(cfg.device, device); - if (!useipv4 || !strncmp(ipv4method, "manual", 6)) { - /* IPv4 disabled entirely -or- manual IPv4 config selected */ + /* disable DHCPv4 is user selected manual IPv4 or didn't select IPv4 */ + if (useipv4 && strlen(ipv4method) > 0) { + if (!strncmp(ipv4method, "manual", 6)) { + /* IPv4 disabled entirely -or- manual IPv4 config selected */ + pref |= DHCPv4_DISABLE; + } + } else if (!useipv4 && strlen(ipv4method) == 0) { pref |= DHCPv4_DISABLE; } - if (useipv6 && !strncmp(ipv6method, "auto", 4)) { - /* IPv6 enabled -and- auto neighbor discovery selected */ + /* set appropriate IPv6 configuration method */ + if (strlen(ipv6method) > 0) { + if ((!useipv6 && !strncmp(ipv6method, "auto", 4)) || + (useipv6 && !strncmp(ipv6method, "manual", 6))) { + pref |= DHCPv6_DISABLE | DHCPv6_DISABLE_ADDRESSES; + } + } else if (strlen(ipv6method) == 0 && !useipv6) { pref |= DHCPv6_DISABLE | DHCPv6_DISABLE_ADDRESSES; - } else if (!useipv6 || !strncmp(ipv6method, "manual", 6)) { - /* IPv6 disabled entirely -or- manual IPv6 config selected */ - pref |= DHCPv6_DISABLE; } pref |= DHCPv6_DISABLE_RESOLVER | DHCPv4_DISABLE_HOSTNAME_SET; diff --git a/isys/isys.py b/isys/isys.py index 892b0e764..4aeea2751 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -679,10 +679,10 @@ def dhcpNetDevice(device): else: v6method = 'manual' - if klass is not None: - return _isys.dhcpnetdevice(devname, v4, v4method, v6, v6method, klass) - else: - return _isys.dhcpnetdevice(devname, v4, v4method, v6, v6method) + if klass is None: + klass = '' + + return _isys.dhcpnetdevice(devname, v4, v4method, v6, v6method, klass) def readXFSLabel_int(device): try: |