Bug 569793 - [RFE] support for IPv6 in python-ethtool
Summary: [RFE] support for IPv6 in python-ethtool
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-ethtool
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: David Sommerseth
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 569790 655310
TreeView+ depends on / blocked
 
Reported: 2010-03-02 12:53 UTC by Miroslav Suchý
Modified: 2016-05-22 23:30 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-02-02 14:19:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch implementing basic IPv6 support (30.74 KB, text/plain)
2010-03-04 16:09 UTC, David Sommerseth
no flags Details

Description Miroslav Suchý 2010-03-02 12:53:10 UTC
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.

Comment 1 David Sommerseth 2010-03-03 14:50:12 UTC
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?

Comment 2 Miroslav Suchý 2010-03-03 15:00:26 UTC
Yes, it is enough for me. Although I will prefer waiting on stable API.

Comment 3 David Sommerseth 2010-03-04 14:58:19 UTC
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.

Comment 4 David Sommerseth 2010-03-04 16:09:25 UTC
Created attachment 397843 [details]
Patch implementing basic IPv6 support

Comment 5 David Sommerseth 2010-08-03 12:07:46 UTC
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
----------------------------------------------------------------------------

Comment 7 David Sommerseth 2010-08-06 06:17:28 UTC
Packages for Fedora {12,13,14} should be on the way into updates-testing.  Also available in Rawhide.

Comment 8 Milan Zázrivec 2010-08-19 08:24:34 UTC
Spacewalk 1.1 has been released.

Comment 9 Milan Zázrivec 2010-08-19 08:48:42 UTC
Mistakenly closed, sorry.

Comment 10 David Sommerseth 2011-02-02 14:19:14 UTC
python-ethtool-0.5-1 was released for Fedora 13 and newer, which includes IPv6 support.

https://admin.fedoraproject.org/updates/search/python-ethtool


Note You need to log in before you can comment on or make changes to this bug.