Description of problem: Currently ethtool can only return IPv4 addresses using ethtool.get_ipaddr(interface), I would like to obtain IPv6 addresses too. Probably using new method ethtool.get_ipv6addr(interface). But I can imagine that get_ipaddr return both ipv4 and ipv6 addresses.
I've been working on such an implementation. It's not completely done, but I believe the API should be mostly settled (even though, some changes *might* come). You can get it from our internal git repo: git://git.engineering.redhat.com/users/dsommers/python-ethtool.git http://git.engineering.redhat.com/?p=users/dsommers/python-ethtool.git A little demo: ---------------------------------------------------------------------- import ethtool # Get selected devices (using list or tuples) devs = ethtool.get_interface_info(['eth0','lo']) devs = ethtool.get_interface_info(('eth0','lo')) # Get only one device (using string) devs = ethtool.get_interface_info('eth0') # Get all devs = ethtool.get_interface_info() # Retrieve and print info for d in devs: print "** Device: %s" % d.device print "MAC addr: %s" % d.mac_address print "IPv4: %s/%s Brd: %s" % (d.ipv4_address, d.ipv4_netmask, d.ipv4_broadcast) print "IPv6: %s/%s" % (d.ipv6_address, d.ipv6_netmask) print ---------------------------------------------------------------------- Can this satisfy your need?
Yes, it is enough for me. Although I will prefer waiting on stable API.
I've been reviewing what changes will come to the API. The current API will not be changed (99.99% sure) in a non-backwards compatible manner. The current API will on the other hand be extended to give more device information. The current members should in that regards not need to be changed at all. One behavioural change will most likely change though. Now the list of objects which is returned by ethtool.get_interface_info() will have static values. That means, if you change the IP address after this function has been called, the contents will not change. You'll need to call ethtool.get_interface_info() again to get the new information.
Created attachment 397843 [details] Patch implementing basic IPv6 support
I've completed the IPv6 support now. There are some needed API changes now compared to the earlier proposal, due to the fact that a single Ethernet interface may have more IPv6 addresses assigned. This detail was missing in the previous implementation. The latest changes can be found here: http://fedorapeople.org/gitweb?p=dsommers/public_git/python-ethtool.git;a=summary I've begun packaging this and are going through the process of releasing python-ethtool-0.4, with complete IPv6 support. At the moment only the tarball is available: http://dsommers.fedorapeople.org/python-ethtool/python-ethtool-0.4.tar.bz2 Will complete packages for Fedora and RHEL-6.1. For RHEL-5, it will need approvals. Test program: ---------------------------------------------------------------------------- import ethtool # Get info about all devices devices = ethtool.get_interfaces_info(ethtool.get_devices()) # Retrieve and print info for dev in devices: print "** Device: %s" % dev.device print "MAC addr: %s" % dev.mac_address print "IPv4: %s/%s Brd: %s" % (dev.ipv4_address, dev.ipv4_netmask, dev.ipv4_broadcast) for ip6 in dev.get_ipv6_addresses(): print "IPv6: [%s] %s/%i" % (ip6.scope, ip6.address, ip6.netmask) print ----------------------------------------------------------------------------
Packages for Fedora {12,13,14} should be on the way into updates-testing. Also available in Rawhide.
Spacewalk 1.1 has been released.
Mistakenly closed, sorry.
python-ethtool-0.5-1 was released for Fedora 13 and newer, which includes IPv6 support. https://admin.fedoraproject.org/updates/search/python-ethtool