| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
To avoid that the NETLINK socket is available to forked children,
set the FD_CLOEXEC flag on the NETLINK socket. This also avoids
SELinux from complaining on Fedora 14.
For more information:
https://bugzilla.redhat.com/show_bug.cgi?id=689843
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Do not open a NETLINK connection when loading the module, but rahter
open it when needed. In a case where multiple users needs the
connection, it will be shared and only closed when the last active
user is done.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Several places python-ethtool leaked memory, mostly due to missing
Py_DECREF() calls on objects being put in to python lists (via
PyList_Append() calls).
This revealed an issue in addition where the IPv6 addresses pointers
in some cases could freed more times. This is fixed as well.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
| |
_ethtool_etherinfo_get_ipv6_addresses() didn't check too well several
Python calls if it would return NULL.
Reported-by: Dave Malcolm <dmalcolm@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From RH BZ#680269:
#define RETURN_STRING(str) (str ? PyString_FromString(str) : Py_None)
This isn't incrementing the reference count on the Py_None singleton when it
should be (the caller assumes that it "owns" a ref on the result of _getter,
and will decref it), it could cause the python process to bail out:
"Fatal Python error: deallocating None"
if run repeatedly.
Reported-by: Dave Malcolm <dmalcolm@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
| |
In commit c52ed2cbdc5b851ebc7bc19d7c682b14a4a16ba4 a free_ipv6addresses()
call was removed, which lead to duplicated IPv6 address information in some
cases. Re-add this freeing, to be sure we don't add existing information to
an already existing pointer chain.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
| |
This is useful to identify the python-ethtool version at runtime.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
| |
There has never really existed a file called
python-ethtool/etherinfo_ipv6_obj.h
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
| |
The callback function for device link information was lacking a simple
check to avoid a SEGV in these situations.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
| |
it is later used when calling sys.exit()
Signed-off-by: Miroslav Suchy <miroslav@suchy.cz>
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
| |
This caused a double free situation, when Python tried to free the object if the
etherinfo::get_ipv6_addresses() method was called several times. In addition
the ethtool::get_interfaces_info() would also free the structures uses by
etherinfo_ipv6addr objects.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
| |
Makes rpmlint happy.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
| |
- David Sommerseth is now taking over the maintenance of python-ethtool
- New URLs for upstream source code
- Added new API: ethtool.get_interfaces_info() - returns list of etherinfo objects
- Added support retrieving for IPv6 address, using etherinfo::get_ipv6_addresses()
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
The struct nl_handle was wrapped inside struct _nlconnection. This
is really not needed if open_netlink() and close_netlink() functions
uses "pointer's pointer" (struct nl_handle **) instead. Removes also
the need to declare a static struct _nlconnection, as the
global nlconnection variable can now be a pointer as well.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
| |
This is more appropriate as it is not a static list of IPv6 address objects
which are returned.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
| |
The new name reflects the contents of the data type better.
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As the IPv6 protocol allows a single device to have more than one IPv6 address,
the previous implementation did not provide all IPv6 information. It would reject
all except the last parsed IPv6 address.
NOTE: This implementation will break the previous API.
This change removes the ethtool.etherinfo.ipv6_address and
ethtool.etherinfo.ipv6_netmask members. A new member is added,
ethtool.etherinfo.ipv6_addresses (in plural). This contains a tupple list
containing of ethtool.etherinfo_ipv6addr objects, one object for each configured
IPv6 address on the device. These objects have the following members available:
.address - The IPv6 address
.netmask - The IPv6 netmask (in bit notation)
.scope - A string with the IPv6 address scope
Example code:
import ethtool
devs = ethtool.get_interfaces_info('eth0')
for ip6 in devs[0].ipv6_addresses:
print "[%s] %s/%i" % (ip6.scope, ip6.address, ip6.netmask)
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
|
|
| |
NLQRY_ADDR
|
|
|
|
|
| |
This is to make it a bit clearer that the result type of this function always will be
a list of ethtool.etherinfo objects.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
It can handle a string with a device name or a list or a tuple list
with more devices.
dev = ethtool.get_interface_info(['lo','eth0','pan0'])
dev = ethtool.get_interface_info(('eth0','virbr0'))
dev = ethtool.get_interface_info('lo')
dev = ethtool.get_interface_info()
|
| |
|
|
|
|
| |
it more Pythonish
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It will return a list of Python etherinfo objects. These objects
have the following properties:
.device - Device name
.mac_address - Hardware address
.ipv4_address
.ipv4_netmask
.ipv4_broadcast
.ipv6_address
.ipv6_netmask
In addition, it will produce a human readable output if these objects
are treated as strings.
It will not be possible to modify any of the properties in these objects.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
for all devices
|
| |
|
|
|
|
| |
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
|
|
| |
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
|
|
|
|
| |
A la pethtool
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
|
|
| |
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
|
|
|
|
| |
Part of the fedora review process.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|