diff options
| author | David Sommerseth <davids@redhat.com> | 2013-12-16 21:02:31 +0100 |
|---|---|---|
| committer | David Sommerseth <davids@redhat.com> | 2013-12-16 21:02:31 +0100 |
| commit | e9784985e3f7b72cc5f3210d60a88014625b2660 (patch) | |
| tree | a8a812dd0e3781709883c48d534d9c1731e3801a /python-ethtool/etherinfo_obj.c | |
| parent | 44838a858671264cfb2085a3b1dbe6e01ca48feb (diff) | |
| download | python-ethtool-e9784985e3f7b72cc5f3210d60a88014625b2660.tar.gz python-ethtool-e9784985e3f7b72cc5f3210d60a88014625b2660.tar.xz python-ethtool-e9784985e3f7b72cc5f3210d60a88014625b2660.zip | |
Splitting up get_etherinfo() calls
Make the calls to retrieve IPv4 and IPv6 addresses individual. This
is the the beginning of the rewrite of the whole etherinfo main class.
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'python-ethtool/etherinfo_obj.c')
| -rw-r--r-- | python-ethtool/etherinfo_obj.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/python-ethtool/etherinfo_obj.c b/python-ethtool/etherinfo_obj.c index 56d88e7..55a42db 100644 --- a/python-ethtool/etherinfo_obj.c +++ b/python-ethtool/etherinfo_obj.c @@ -155,7 +155,7 @@ PyObject *_ethtool_etherinfo_getter(etherinfo_py *self, PyObject *attr_o) Py_INCREF(self->data->ethinfo->hwaddress); return self->data->ethinfo->hwaddress; } else if( strcmp(attr, "ipv4_address") == 0 ) { - get_etherinfo(self->data, NLQRY_ADDR); + get_etherinfo(self->data, NLQRY_ADDR4); /* For compatiblity with old approach, return last IPv4 address: */ py_addr = get_last_ipv4_address(self); if (py_addr) { @@ -166,14 +166,14 @@ PyObject *_ethtool_etherinfo_getter(etherinfo_py *self, PyObject *attr_o) } Py_RETURN_NONE; } else if( strcmp(attr, "ipv4_netmask") == 0 ) { - get_etherinfo(self->data, NLQRY_ADDR); + get_etherinfo(self->data, NLQRY_ADDR4); py_addr = get_last_ipv4_address(self); if (py_addr) { return PyInt_FromLong(py_addr->prefixlen); } return PyInt_FromLong(0); } else if( strcmp(attr, "ipv4_broadcast") == 0 ) { - get_etherinfo(self->data, NLQRY_ADDR); + get_etherinfo(self->data, NLQRY_ADDR4); py_addr = get_last_ipv4_address(self); if (py_addr) { if (py_addr->ipv4_broadcast) { @@ -221,7 +221,8 @@ PyObject *_ethtool_etherinfo_str(etherinfo_py *self) } get_etherinfo(self->data, NLQRY_LINK); - get_etherinfo(self->data, NLQRY_ADDR); + get_etherinfo(self->data, NLQRY_ADDR4); + get_etherinfo(self->data, NLQRY_ADDR6); ret = PyString_FromFormat("Device %s:\n", self->data->ethinfo->device); if( self->data->ethinfo->hwaddress ) { @@ -280,7 +281,7 @@ static PyObject *_ethtool_etherinfo_get_ipv4_addresses(etherinfo_py *self, PyObj return NULL; } - get_etherinfo(self->data, NLQRY_ADDR); + get_etherinfo(self->data, NLQRY_ADDR4); /* Transfer ownership of reference: */ ret = self->data->ethinfo->ipv4_addresses; @@ -306,7 +307,7 @@ static PyObject *_ethtool_etherinfo_get_ipv6_addresses(etherinfo_py *self, PyObj return NULL; } - get_etherinfo(self->data, NLQRY_ADDR); + get_etherinfo(self->data, NLQRY_ADDR6); /* Transfer ownership of reference: */ ret = self->data->ethinfo->ipv6_addresses; |
