From d3f5fd74bdb903c032eca8ab4e391172d3162c76 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Fri, 13 Sep 2013 20:18:57 +0200 Subject: Merge PyNetlinkIPv4Address and PyNetlinkIPv6Address classes Simplify the overall implementation by reusing code more efficiently. The differences between the IPv4 and IPv6 implementation in libnl is minimal and can more easily be differentiated those few places its needed instead. Signed-off-by: David Sommerseth --- python-ethtool/etherinfo_struct.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'python-ethtool/etherinfo_struct.h') diff --git a/python-ethtool/etherinfo_struct.h b/python-ethtool/etherinfo_struct.h index dff1105..72e4962 100644 --- a/python-ethtool/etherinfo_struct.h +++ b/python-ethtool/etherinfo_struct.h @@ -39,22 +39,16 @@ struct etherinfo { }; /* Python object containing data baked from a (struct rtnl_addr) */ -typedef struct PyNetlinkIPv4Address { +typedef struct PyNetlinkIPaddress { PyObject_HEAD - PyObject *ipv4_address; /**< string: Configured IPv4 address */ - int ipv4_netmask; /**< int: Configured IPv4 netmask */ + int family; /**< int: must be AF_INET or AF_INET6 */ + PyObject *local; /**< string: Configured local IP address */ + PyObject *peer; /**< string: Configured peer IP address */ PyObject *ipv4_broadcast; /**< string: Configured IPv4 broadcast address */ -} PyNetlinkIPv4Address; -extern PyTypeObject ethtool_netlink_ipv4_address_Type; - -/* Python object containing data baked from a (struct rtnl_addr) */ -typedef struct PyNetlinkIPv6Address { - PyObject_HEAD - PyObject *ipv6_address; /**< string: Configured IPv6 address */ - int ipv6_netmask; /**< int: Configured IPv6 prefix */ - PyObject *ipv6_scope; /**< string: IPv6 address scope */ -} PyNetlinkIPv6Address; -extern PyTypeObject ethtool_netlink_ipv6_address_Type; + int prefixlen; /**< int: Configured network prefix (netmask) */ + PyObject *scope; /**< string: IP address scope */ +} PyNetlinkIPaddress; +extern PyTypeObject ethtool_netlink_ip_address_Type; /** * Contains the internal data structure of the -- cgit