diff options
author | David Cantrell <dcantrell@redhat.com> | 2007-05-22 20:09:34 +0000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2007-05-22 20:09:34 +0000 |
commit | 4c71b84432093a8d45df9525f4362c2d63806881 (patch) | |
tree | a39a9a8e500028f7d5ee2c58988508bfc3cd546e /isys/isys.c | |
parent | 1380f13f0dad0108b8ed6ac02e249f53fb43156b (diff) | |
download | anaconda-4c71b84432093a8d45df9525f4362c2d63806881.tar.gz anaconda-4c71b84432093a8d45df9525f4362c2d63806881.tar.xz anaconda-4c71b84432093a8d45df9525f4362c2d63806881.zip |
* isys/isys.py: If klass is None, set to empty string. Always send
klass to doDhcpNetDevice.
* isys/isys.c: Do not segfault (#240804).
Diffstat (limited to 'isys/isys.c')
-rw-r--r-- | isys/isys.c | 24 |
1 files changed, 16 insertions, 8 deletions
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; |