summaryrefslogtreecommitdiffstats
path: root/isys/isys.c
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-10-03 18:28:18 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-10-03 18:28:18 +0000
commit8d0364df93d72b9dc1497e7044a48c5d01de6009 (patch)
treeb269771240b34e61e97c888743a9986bac5f1a6b /isys/isys.c
parentbc01ad83ca869f7ef6cd2b4eb29e7cca5516e92e (diff)
downloadanaconda-8d0364df93d72b9dc1497e7044a48c5d01de6009.tar.gz
anaconda-8d0364df93d72b9dc1497e7044a48c5d01de6009.tar.xz
anaconda-8d0364df93d72b9dc1497e7044a48c5d01de6009.zip
* iw/network_gui.py (NetworkWindow): Use isys.netmask2prefix() and
isys.prefix2netmask() correctly. * textw/network_text.py (NetworkDeviceWindow): Use isys.prefix2netmask() correctly. * isys/isys.c (doPrefixToNetmask): Renamed to a shorter function name and it somewhat matches what the isys.py passthrough is called. We also take an int as the argument now and return a string. * isys/isys.py (netmask2prefix): Added this function to replace the borken inet_convertNetmaskToPrefix() function.
Diffstat (limited to 'isys/isys.c')
-rw-r--r--isys/isys.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/isys/isys.c b/isys/isys.c
index 378316fdf..741cfbb8c 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -120,7 +120,7 @@ static PyObject * doProbeBiosDisks(PyObject * s, PyObject * args);
static PyObject * doGetBiosDisk(PyObject * s, PyObject * args);
static PyObject * doSegvHandler(PyObject *s, PyObject *args);
static PyObject * doAuditDaemon(PyObject *s);
-static PyObject * doConvertPrefixToNetmask(PyObject *s, PyObject *args);
+static PyObject * doPrefixToNetmask(PyObject *s, PyObject *args);
static PyMethodDef isysModuleMethods[] = {
{ "ejectcdrom", (PyCFunction) doEjectCdrom, METH_VARARGS, NULL },
@@ -176,7 +176,7 @@ static PyMethodDef isysModuleMethods[] = {
{ "getbiosdisk",(PyCFunction) doGetBiosDisk, METH_VARARGS,NULL},
{ "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL },
{ "auditdaemon", (PyCFunction) doAuditDaemon, METH_NOARGS, NULL },
- { "prefix2netmask", (PyCFunction) doConvertPrefixToNetmask, METH_VARARGS, NULL },
+ { "prefix2netmask", (PyCFunction) doPrefixToNetmask, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
} ;
@@ -653,14 +653,14 @@ static PyObject * doDhcpNetDevice(PyObject * s, PyObject * args) {
return rc;
}
-static PyObject * doConvertPrefixToNetmask (PyObject * s, PyObject * args) {
- char *prefix = NULL;
+static PyObject * doPrefixToNetmask (PyObject * s, PyObject * args) {
+ int prefix = 0;
int mask = 0;
char dst[INET_ADDRSTRLEN];
- if (!PyArg_ParseTuple(args, "s", &prefix)) return NULL;
+ if (!PyArg_ParseTuple(args, "i", &prefix)) return NULL;
- mask = htonl(~((1 << (32 - atoi(prefix))) - 1));
+ mask = htonl(~((1 << (32 - prefix)) - 1));
inet_ntop(AF_INET, (struct in_addr *) &mask, dst, INET_ADDRSTRLEN);
return Py_BuildValue("s", dst);