From 5a451966adcddf9e95536ad169b21537e876a6a5 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 8 May 2014 15:41:44 +0200 Subject: [PATCH] Update to latest upstream release - v0.11 Signed-off-by: David Sommerseth --- .gitignore | 1 + ...-extra-error-checks-with-libnl-calls.patch | 55 ---- 0001-Improve-error-handling-even-more.patch | 134 ---------- ...rease-reference-counter-on-non-exist.patch | 29 --- 0002-fix-get_module-errno-setting.patch | 69 ----- ...ify-errno-derived-exception-handling.patch | 243 ------------------ ...valid-non-existing-devices-as-ENODEV.patch | 61 ----- python-ethtool.spec | 32 +-- sources | 2 +- 9 files changed, 19 insertions(+), 607 deletions(-) delete mode 100644 0001-Added-some-extra-error-checks-with-libnl-calls.patch delete mode 100644 0001-Improve-error-handling-even-more.patch delete mode 100644 0002-Don-t-try-to-increase-reference-counter-on-non-exist.patch delete mode 100644 0002-fix-get_module-errno-setting.patch delete mode 100644 0004-exceptions-Simplify-errno-derived-exception-handling.patch delete mode 100644 0005-Report-invalid-non-existing-devices-as-ENODEV.patch diff --git a/.gitignore b/.gitignore index 35e13eb..b7a50ef 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ python-ethtool-0.5.tar.bz2 /python-ethtool-0.8.tar.bz2 /python-ethtool-0.9.tar.bz2 /python-ethtool-0.10.tar.bz2 +/python-ethtool-0.11.tar.bz2 diff --git a/0001-Added-some-extra-error-checks-with-libnl-calls.patch b/0001-Added-some-extra-error-checks-with-libnl-calls.patch deleted file mode 100644 index 7ba2b16..0000000 --- a/0001-Added-some-extra-error-checks-with-libnl-calls.patch +++ /dev/null @@ -1,55 +0,0 @@ -From b15cd540acf49a283d30c28e1424230e51440772 Mon Sep 17 00:00:00 2001 -From: David Sommerseth -Date: Fri, 10 Jan 2014 17:57:05 +0100 -Subject: [PATCH 1/5] Added some extra error checks with libnl calls - -Signed-off-by: David Sommerseth ---- - python-ethtool/etherinfo.c | 8 ++++++-- - python-ethtool/netlink.c | 4 ++-- - 2 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c -index bac0fe7..c5e6798 100644 ---- a/python-ethtool/etherinfo.c -+++ b/python-ethtool/etherinfo.c -@@ -185,7 +185,9 @@ int get_etherinfo_link(PyEtherInfo *self) - return 0; - } - link = rtnl_link_alloc(); -- /* FIXME: Error handling? */ -+ if( !link ) { -+ return 0; -+ } - rtnl_link_set_ifindex(link, self->index); - nl_cache_foreach_filter(link_cache, OBJ_CAST(link), callback_nl_link, self); - rtnl_link_put(link); -@@ -236,7 +238,9 @@ PyObject * get_etherinfo_address(PyEtherInfo *self, nlQuery query) - return NULL; - } - addr = rtnl_addr_alloc(); -- /* FIXME: Error handling? */ -+ if( !addr ) { -+ return NULL; -+ } - rtnl_addr_set_ifindex(addr, self->index); - - switch( query ) { -diff --git a/python-ethtool/netlink.c b/python-ethtool/netlink.c -index 9ba8338..d311405 100644 ---- a/python-ethtool/netlink.c -+++ b/python-ethtool/netlink.c -@@ -57,8 +57,8 @@ int open_netlink(PyEtherInfo *ethi) - - /* No earlier connections exists, establish a new one */ - nlconnection = nl_socket_alloc(); -- nl_connect(nlconnection, NETLINK_ROUTE); -- if( (nlconnection != NULL) ) { -+ if( nlconnection != NULL ) { -+ nl_connect(nlconnection, NETLINK_ROUTE); - /* Force O_CLOEXEC flag on the NETLINK socket */ - if( fcntl(nl_socket_get_fd(nlconnection), F_SETFD, FD_CLOEXEC) == -1 ) { - fprintf(stderr, --- -1.8.3.1 - diff --git a/0001-Improve-error-handling-even-more.patch b/0001-Improve-error-handling-even-more.patch deleted file mode 100644 index 47aef7f..0000000 --- a/0001-Improve-error-handling-even-more.patch +++ /dev/null @@ -1,134 +0,0 @@ -From cb29a4277b2aa5b5c211979c1dd3cdb098e1fcb9 Mon Sep 17 00:00:00 2001 -From: David Sommerseth -Date: Tue, 1 Apr 2014 21:25:15 +0200 -Subject: [PATCH 1/2] Improve error handling even more - -Ensure that a Python exception is set on more places errors can occur. - -Signed-off-by: David Sommerseth ---- - python-ethtool/etherinfo.c | 32 ++++++++++++++++++-------------- - 1 file changed, 18 insertions(+), 14 deletions(-) - -diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c -index 24147bc..14b4796 100644 ---- a/python-ethtool/etherinfo.c -+++ b/python-ethtool/etherinfo.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -111,34 +112,35 @@ static void callback_nl_address(struct nl_object *obj, void *arg) - * @param self A pointer the current PyEtherInfo Python object which contains the device name - * and the place where to save the corresponding index value. - * -- * @return Returns 1 on success, otherwise 0. -+ * @return Returns 1 on success, otherwise 0. On error, a Python error exception is set. - */ - static int _set_device_index(PyEtherInfo *self) - { - struct nl_cache *link_cache; - struct rtnl_link *link; - -- /* Reset errno, as we will use it to report errors further on */ -- errno = 0; -- - /* Find the interface index we're looking up. - * As we don't expect it to change, we're reusing a "cached" - * interface index if we have that - */ - if( self->index < 0 ) { -- if( rtnl_link_alloc_cache(get_nlc(), AF_UNSPEC, &link_cache) < 0) { -+ if( (errno = rtnl_link_alloc_cache(get_nlc(), AF_UNSPEC, &link_cache)) < 0) { -+ PyErr_SetString(PyExc_OSError, nl_geterror(errno)); - return 0; - } - - link = rtnl_link_get_by_name(link_cache, PyString_AsString(self->device)); - if( !link ) { - errno = ENODEV; -+ PyErr_SetFromErrno(PyExc_IOError); - nl_cache_free(link_cache); - return 0; - } - - self->index = rtnl_link_get_ifindex(link); -- if( self->index < 0 ) { -+ if( self->index <= 0 ) { -+ errno = ENODEV; -+ PyErr_SetFromErrno(PyExc_IOError); - rtnl_link_put(link); - nl_cache_free(link_cache); - return 0; -@@ -167,6 +169,7 @@ int get_etherinfo_link(PyEtherInfo *self) - { - struct nl_cache *link_cache; - struct rtnl_link *link; -+ int err = 0; - - if( !self ) { - return 0; -@@ -181,18 +184,18 @@ int get_etherinfo_link(PyEtherInfo *self) - } - - if( _set_device_index(self) != 1) { -- if( errno != 0 ) { -- PyErr_SetString(PyExc_IOError, strerror(errno)); -- } - return 0; - } - - /* Extract MAC/hardware address of the interface */ -- if( rtnl_link_alloc_cache(get_nlc(), AF_UNSPEC, &link_cache) < 0) { -+ if( (err = rtnl_link_alloc_cache(get_nlc(), AF_UNSPEC, &link_cache)) < 0) { -+ PyErr_SetString(PyExc_OSError, nl_geterror(err)); - return 0; - } - link = rtnl_link_alloc(); - if( !link ) { -+ errno = ENOMEM; -+ PyErr_SetFromErrno(PyExc_OSError); - return 0; - } - rtnl_link_set_ifindex(link, self->index); -@@ -220,6 +223,7 @@ PyObject * get_etherinfo_address(PyEtherInfo *self, nlQuery query) - struct nl_cache *addr_cache; - struct rtnl_addr *addr; - PyObject *addrlist = NULL; -+ int err = 0; - - if( !self ) { - return NULL; -@@ -234,21 +238,21 @@ PyObject * get_etherinfo_address(PyEtherInfo *self, nlQuery query) - } - - if( _set_device_index(self) != 1) { -- if( errno != 0 ) { -- return PyErr_SetFromErrno(PyExc_IOError); -- } - return NULL; - } - - /* Query the for requested info via NETLINK */ - - /* Extract IP address information */ -- if( rtnl_addr_alloc_cache(get_nlc(), &addr_cache) < 0) { -+ if( (err = rtnl_addr_alloc_cache(get_nlc(), &addr_cache)) < 0) { -+ PyErr_SetString(PyExc_OSError, nl_geterror(err)); - nl_cache_free(addr_cache); - return NULL; - } - addr = rtnl_addr_alloc(); - if( !addr ) { -+ errno = ENOMEM; -+ PyErr_SetFromErrno(PyExc_OSError); - return NULL; - } - rtnl_addr_set_ifindex(addr, self->index); --- -1.8.3.1 - diff --git a/0002-Don-t-try-to-increase-reference-counter-on-non-exist.patch b/0002-Don-t-try-to-increase-reference-counter-on-non-exist.patch deleted file mode 100644 index 66b3e30..0000000 --- a/0002-Don-t-try-to-increase-reference-counter-on-non-exist.patch +++ /dev/null @@ -1,29 +0,0 @@ -From c49e4c1a9d36c28acc886793490794e86a955a04 Mon Sep 17 00:00:00 2001 -From: David Sommerseth -Date: Tue, 1 Apr 2014 21:26:40 +0200 -Subject: [PATCH 2/2] Don't try to increase reference counter on non-existing - hwaddress - -Signed-off-by: David Sommerseth ---- - python-ethtool/etherinfo_obj.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/python-ethtool/etherinfo_obj.c b/python-ethtool/etherinfo_obj.c -index f620157..cd7f2e3 100644 ---- a/python-ethtool/etherinfo_obj.c -+++ b/python-ethtool/etherinfo_obj.c -@@ -104,7 +104,9 @@ PyObject *_ethtool_etherinfo_getter(PyEtherInfo *self, PyObject *attr_o) - } - } else if( strcmp(attr, "mac_address") == 0 ) { - get_etherinfo_link(self); -- Py_INCREF(self->hwaddress); -+ if( self->hwaddress ) { -+ Py_INCREF(self->hwaddress); -+ } - return self->hwaddress; - } else if( strcmp(attr, "ipv4_address") == 0 ) { - addrlist = get_etherinfo_address(self, NLQRY_ADDR4); --- -1.8.3.1 - diff --git a/0002-fix-get_module-errno-setting.patch b/0002-fix-get_module-errno-setting.patch deleted file mode 100644 index 2b40278..0000000 --- a/0002-fix-get_module-errno-setting.patch +++ /dev/null @@ -1,69 +0,0 @@ -From a6f163fafaccd9bea4b2807961ef8ed8776a629a Mon Sep 17 00:00:00 2001 -From: "Antoni S. Puimedon" -Date: Mon, 11 Nov 2013 15:21:26 +0000 -Subject: [PATCH 2/5] fix get_module errno setting. - -The current code is only setting the errno string but doesn't set -the first argument to the IOError exception, i.e., errno. -This patch builds a tuple (errno, strerror(errno)) so that the -Exception has the errno properly set. - -Signed-off-by: Antoni S. Puimedon -Signed-off-by: David Sommerseth ---- - python-ethtool/ethtool.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/python-ethtool/ethtool.c b/python-ethtool/ethtool.c -index 65abb21..453f08b 100644 ---- a/python-ethtool/ethtool.c -+++ b/python-ethtool/ethtool.c -@@ -450,6 +450,7 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args) - - if (err < 0) { /* failed? */ - int eno = errno; -+ PyObject *err_obj; - FILE *file; - int found = 0; - char driver[101], dev[101]; -@@ -458,8 +459,11 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args) - /* Before bailing, maybe it is a PCMCIA/PC Card? */ - file = fopen("/var/lib/pcmcia/stab", "r"); - if (file == NULL) { -- sprintf(buf, "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ err_obj = Py_BuildValue("(is)", eno, strerror(eno)); -+ if (err_obj != NULL) { -+ PyErr_SetObject(PyExc_IOError, err_obj); -+ Py_DECREF(err_obj); -+ } - return NULL; - } - -@@ -480,8 +484,11 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args) - } - fclose(file); - if (!found) { -- sprintf(buf, "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ err_obj = Py_BuildValue("(is)", eno, strerror(eno)); -+ if (err_obj != NULL) { -+ PyErr_SetObject(PyExc_IOError, err_obj); -+ Py_DECREF(err_obj); -+ } - return NULL; - } else - return PyString_FromString(driver); -@@ -514,8 +521,7 @@ static PyObject *get_businfo(PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - /* Get current settings. */ --- -1.8.3.1 - diff --git a/0004-exceptions-Simplify-errno-derived-exception-handling.patch b/0004-exceptions-Simplify-errno-derived-exception-handling.patch deleted file mode 100644 index a5723bd..0000000 --- a/0004-exceptions-Simplify-errno-derived-exception-handling.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 505bca305c4c0e2d3a29e24b27bf03c358db11cf Mon Sep 17 00:00:00 2001 -From: "Antoni S. Puimedon" -Date: Fri, 17 Jan 2014 23:27:42 +0100 -Subject: [PATCH 4/5] exceptions: Simplify errno derived exception handling - -Errnos are missing from some exceptions and in others the code could -be simplified by just using the convenience method PyErr_FromErrno. - -Signed-off-by: Antoni S. Puimedon -Acked-by: David Sommerseth -Message-Id: 1389997662-8460-1-git-send-email-asegurap@redhat.com -Signed-off-by: David Sommerseth ---- - python-ethtool/ethtool.c | 86 +++++++++++++----------------------------------- - 1 file changed, 23 insertions(+), 63 deletions(-) - -diff --git a/python-ethtool/ethtool.c b/python-ethtool/ethtool.c -index 453f08b..0f9cdbb 100644 ---- a/python-ethtool/ethtool.c -+++ b/python-ethtool/ethtool.c -@@ -55,10 +55,8 @@ static PyObject *get_active_devices(PyObject *self __unused, PyObject *args __un - PyObject *list; - struct ifaddrs *ifaddr, *ifa; - -- if (getifaddrs(&ifaddr) == -1) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -- } -+ if (getifaddrs(&ifaddr) == -1) -+ return PyErr_SetFromErrno(PyExc_OSError); - - list = PyList_New(0); - for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { -@@ -83,15 +81,13 @@ static PyObject *get_devices(PyObject *self __unused, PyObject *args __unused) - FILE *fd = fopen(_PATH_PROCNET_DEV, "r"); - - if (fd == NULL) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - /* skip over first two lines */ - ret = fgets(buffer, 256, fd); - ret = fgets(buffer, 256, fd); - if( !ret ) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - while (!feof(fd)) { -@@ -134,18 +130,13 @@ static PyObject *get_hwaddress(PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - /* Get current settings. */ - err = ioctl(fd, SIOCGIFHWADDR, &ifr); - if (err < 0) { -- char buf[2048]; -- int eno = errno; -- -- snprintf(buf, sizeof(buf), "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ PyErr_SetFromErrno(PyExc_IOError); - close(fd); - return NULL; - } -@@ -181,17 +172,13 @@ static PyObject *get_ipaddress(PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - /* Get current settings. */ - err = ioctl(fd, SIOCGIFADDR, &ifr); - if (err < 0) { -- char buf[2048]; -- int eno = errno; -- snprintf(buf, sizeof(buf), "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ PyErr_SetFromErrno(PyExc_IOError); - close(fd); - return NULL; - } -@@ -276,7 +263,7 @@ static PyObject *get_interfaces_info(PyObject *self __unused, PyObject *args) { - - dev = PyObject_New(PyEtherInfo, &PyEtherInfo_Type); - if( !dev ) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -+ PyErr_SetFromErrno(PyExc_OSError); - free(fetch_devs); - return NULL; - } -@@ -311,15 +298,11 @@ static PyObject *get_flags (PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - err = ioctl(fd, SIOCGIFFLAGS, &ifr); - if(err < 0) { -- char buf[2048]; -- int eno = errno; -- snprintf(buf, sizeof(buf), "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ PyErr_SetFromErrno(PyExc_IOError); - close(fd); - return NULL; - } -@@ -348,17 +331,13 @@ static PyObject *get_netmask (PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - /* Get current settings. */ - err = ioctl(fd, SIOCGIFNETMASK, &ifr); - if (err < 0) { -- char buf[2048]; -- int eno = errno; -- snprintf(buf, sizeof(buf), "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ PyErr_SetFromErrno(PyExc_IOError); - close(fd); - return NULL; - } -@@ -392,17 +371,13 @@ static PyObject *get_broadcast(PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - /* Get current settings. */ - err = ioctl(fd, SIOCGIFBRDADDR, &ifr); - if (err < 0) { -- char buf[2048]; -- int eno = errno; -- snprintf(buf, sizeof(buf), "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); -+ PyErr_SetFromErrno(PyExc_IOError); - close(fd); - return NULL; - } -@@ -441,16 +416,14 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -- return NULL; -+ return PyErr_SetFromErrno(PyExc_OSError); - } - - /* Get current settings. */ - err = ioctl(fd, SIOCETHTOOL, &ifr); - - if (err < 0) { /* failed? */ -- int eno = errno; -- PyObject *err_obj; -+ PyErr_SetFromErrno(PyExc_IOError); - FILE *file; - int found = 0; - char driver[101], dev[101]; -@@ -459,11 +432,6 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args) - /* Before bailing, maybe it is a PCMCIA/PC Card? */ - file = fopen("/var/lib/pcmcia/stab", "r"); - if (file == NULL) { -- err_obj = Py_BuildValue("(is)", eno, strerror(eno)); -- if (err_obj != NULL) { -- PyErr_SetObject(PyExc_IOError, err_obj); -- Py_DECREF(err_obj); -- } - return NULL; - } - -@@ -484,14 +452,11 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args) - } - fclose(file); - if (!found) { -- err_obj = Py_BuildValue("(is)", eno, strerror(eno)); -- if (err_obj != NULL) { -- PyErr_SetObject(PyExc_IOError, err_obj); -- Py_DECREF(err_obj); -- } - return NULL; -- } else -+ } else { -+ PyErr_Clear(); - return PyString_FromString(driver); -+ } - } - - close(fd); -@@ -528,11 +493,8 @@ static PyObject *get_businfo(PyObject *self __unused, PyObject *args) - err = ioctl(fd, SIOCETHTOOL, &ifr); - - if (err < 0) { /* failed? */ -- int eno = errno; -+ PyErr_SetFromErrno(PyExc_IOError); - close(fd); -- -- sprintf(buf, "[Errno %d] %s", eno, strerror(eno)); -- PyErr_SetString(PyExc_IOError, buf); - return NULL; - } - -@@ -556,16 +518,14 @@ static int send_command(int cmd, const char *devname, void *value) - /* Open control socket. */ - fd = socket(AF_INET, SOCK_DGRAM, 0), err; - if (fd < 0) { -- PyErr_SetString(PyExc_OSError, strerror(errno)); -+ PyErr_SetFromErrno(PyExc_OSError); - return -1; - } - - /* Get current settings. */ - err = ioctl(fd, SIOCETHTOOL, &ifr); - if (err < 0) { -- char buf[2048]; -- sprintf(buf, "[Errno %d] %s", errno, strerror(errno)); -- PyErr_SetString(PyExc_IOError, buf); -+ PyErr_SetFromErrno(PyExc_IOError); - } - - close(fd); --- -1.8.3.1 - diff --git a/0005-Report-invalid-non-existing-devices-as-ENODEV.patch b/0005-Report-invalid-non-existing-devices-as-ENODEV.patch deleted file mode 100644 index 043cc34..0000000 --- a/0005-Report-invalid-non-existing-devices-as-ENODEV.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 3463fc5556f731aa2e29981bdb27cb50364770dd Mon Sep 17 00:00:00 2001 -From: David Sommerseth -Date: Fri, 7 Feb 2014 13:53:36 +0100 -Subject: [PATCH 5/5] Report invalid/non-existing devices as ENODEV - -Without this patch py-ethtool will just report with a very -generic system error exception if trying to query a non-existing -network interface. This patch will change this to report the -error using ENODEV instead. - -Signed-off-by: David Sommerseth -Reviewed-by: Antoni S. Puimedon ---- - python-ethtool/etherinfo.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c -index c5e6798..24147bc 100644 ---- a/python-ethtool/etherinfo.c -+++ b/python-ethtool/etherinfo.c -@@ -118,6 +118,9 @@ static int _set_device_index(PyEtherInfo *self) - struct nl_cache *link_cache; - struct rtnl_link *link; - -+ /* Reset errno, as we will use it to report errors further on */ -+ errno = 0; -+ - /* Find the interface index we're looking up. - * As we don't expect it to change, we're reusing a "cached" - * interface index if we have that -@@ -129,6 +132,7 @@ static int _set_device_index(PyEtherInfo *self) - - link = rtnl_link_get_by_name(link_cache, PyString_AsString(self->device)); - if( !link ) { -+ errno = ENODEV; - nl_cache_free(link_cache); - return 0; - } -@@ -177,6 +181,9 @@ int get_etherinfo_link(PyEtherInfo *self) - } - - if( _set_device_index(self) != 1) { -+ if( errno != 0 ) { -+ PyErr_SetString(PyExc_IOError, strerror(errno)); -+ } - return 0; - } - -@@ -227,6 +234,9 @@ PyObject * get_etherinfo_address(PyEtherInfo *self, nlQuery query) - } - - if( _set_device_index(self) != 1) { -+ if( errno != 0 ) { -+ return PyErr_SetFromErrno(PyExc_IOError); -+ } - return NULL; - } - --- -1.8.3.1 - diff --git a/python-ethtool.spec b/python-ethtool.spec index 1bc564b..91e3207 100644 --- a/python-ethtool.spec +++ b/python-ethtool.spec @@ -3,8 +3,8 @@ Summary: Ethernet settings python bindings Name: python-ethtool -Version: 0.10 -Release: 3%{?dist} +Version: 0.11 +Release: 1%{?dist} URL: https://fedorahosted.org/python-ethtool/ Source: https://fedorahosted.org/releases/p/y/python-ethtool/python-ethtool-%{version}.tar.bz2 License: GPLv2 @@ -12,13 +12,6 @@ Group: System Environment/Libraries BuildRequires: python-devel libnl3-devel asciidoc BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Patch1: 0001-Added-some-extra-error-checks-with-libnl-calls.patch -Patch2: 0002-fix-get_module-errno-setting.patch -Patch4: 0004-exceptions-Simplify-errno-derived-exception-handling.patch -Patch5: 0005-Report-invalid-non-existing-devices-as-ENODEV.patch -Patch6: 0001-Improve-error-handling-even-more.patch -Patch7: 0002-Don-t-try-to-increase-reference-counter-on-non-exist.patch - %description Python bindings for the ethtool kernel interface, that allows querying and changing of Ethernet card settings, such as speed, port, auto-negotiation, and @@ -26,12 +19,6 @@ PCI locations. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 %build %{__python} setup.py build @@ -62,6 +49,21 @@ rm -rf %{buildroot} %endif %changelog +* Thu May 8 2014 David Sommerseth - 0.11-1 +- Updated to the lastest python-ethtool-0.11 release, which + incorporates all these additional patches and improves + libnl3 connection error checking. + +* Mon Apr 7 2014 David Sommerseth - 0.10-6 +- Removed the never close netlink patch +- Added a patch which will ensure it will open a valid socket in open_netlink() + +* Wed Apr 2 2014 David Sommerseth - 0.10-5 +- Update patch 8 - to also never close the netlink socket + +* Wed Apr 2 2014 David Sommerseth - 0.10-4 +- Added patch 8 - to see of FD_CLOEXEC impacts vdsm + * Tue Apr 1 2014 David Sommerseth - 0.10-3 - Added patch 6 and 7, to improve error handling. Will be removed when released upstream diff --git a/sources b/sources index c887a7d..df93027 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c021d7d4fe0a5a0d105f259c8f764739 python-ethtool-0.10.tar.bz2 +b505501d928debf69664b72fafa9d0c3 python-ethtool-0.11.tar.bz2