summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2007-05-22 20:09:34 +0000
committerDavid Cantrell <dcantrell@redhat.com>2007-05-22 20:09:34 +0000
commit4c71b84432093a8d45df9525f4362c2d63806881 (patch)
treea39a9a8e500028f7d5ee2c58988508bfc3cd546e /isys
parent1380f13f0dad0108b8ed6ac02e249f53fb43156b (diff)
downloadanaconda-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')
-rw-r--r--isys/isys.c24
-rw-r--r--isys/isys.py8
2 files changed, 20 insertions, 12 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;
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: