From 79745470096810d3bec853ecb9bf173e14fc5462 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 25 Sep 2023 10:25:01 +0200 Subject: Including debian version 2.2.2-2. Signed-off-by: Daniel Baumann --- debian/changelog | 9 +++ .../Fix-byte-ordering-in-iputil-operations.patch | 76 ++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 86 insertions(+) create mode 100644 debian/patches/Fix-byte-ordering-in-iputil-operations.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index d6c97be..5df2cbb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -49,6 +49,15 @@ nvme-stas (2.3~rc1-1) experimental; urgency=medium -- Daniel Baumann Fri, 16 Jun 2023 13:04:11 +0200 +nvme-stas (2.2.2-2) unstable; urgency=medium + + [ Mateus Rodrigues de Morais ] + * d/p/Fix-byte-ordering-in-iputil-operations.patch: make byteorder + architecture-aware in order to fix s390x autopkgtest failures. + (LP: #2026878) + + -- Benjamin Drung Tue, 05 Sep 2023 13:45:22 +0200 + nvme-stas (2.2.2-1) sid; urgency=medium * Uploading to sid. diff --git a/debian/patches/Fix-byte-ordering-in-iputil-operations.patch b/debian/patches/Fix-byte-ordering-in-iputil-operations.patch new file mode 100644 index 0000000..ac793e1 --- /dev/null +++ b/debian/patches/Fix-byte-ordering-in-iputil-operations.patch @@ -0,0 +1,76 @@ +From: Mateus Rodrigues de Morais +Date: Tue, 5 Sep 2023 13:41:50 +0200 +Subject: Fix byte ordering in iputil operations + +Previously, the byte ordering on all byte array operations in iputil were +hard-coded to 'little'. This patch makes the byteorder parameter arch-aware +by using sys.byteorder instead. + +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nvme-stas/+bug/2026878 +Last-Update: 2023-09-04 +Forwarded: not-needed +--- + staslib/iputil.py | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/staslib/iputil.py b/staslib/iputil.py +index 9199a49..57f3100 100644 +--- a/staslib/iputil.py ++++ b/staslib/iputil.py +@@ -8,6 +8,7 @@ + + '''A collection of IP address and network interface utilities''' + ++import sys + import socket + import logging + import ipaddress +@@ -27,14 +28,14 @@ RTATTR_SZ = 4 + GETADDRCMD = ( + # BEGIN: struct nlmsghdr + b'\0' * 4 # nlmsg_len (placeholder - actual length calculated below) +- + (RTM_GETADDR).to_bytes(2, byteorder='little', signed=False) # nlmsg_type +- + (NLM_F_REQUEST | NLM_F_ROOT).to_bytes(2, byteorder='little', signed=False) # nlmsg_flags ++ + (RTM_GETADDR).to_bytes(2, byteorder=sys.byteorder, signed=False) # nlmsg_type ++ + (NLM_F_REQUEST | NLM_F_ROOT).to_bytes(2, byteorder=sys.byteorder, signed=False) # nlmsg_flags + + b'\0' * 2 # nlmsg_seq + + b'\0' * 2 # nlmsg_pid + # END: struct nlmsghdr + + b'\0' * 8 # struct ifaddrmsg + ) +-GETADDRCMD = len(GETADDRCMD).to_bytes(4, byteorder='little') + GETADDRCMD[4:] # nlmsg_len ++GETADDRCMD = len(GETADDRCMD).to_bytes(4, byteorder=sys.byteorder) + GETADDRCMD[4:] # nlmsg_len + + + # ****************************************************************************** +@@ -85,25 +86,25 @@ def iface_of(src_addr): + if nlmsg_idx >= len(nlmsg): + nlmsg += sock.recv(8192) + +- nlmsg_type = int.from_bytes(nlmsg[nlmsg_idx + 4 : nlmsg_idx + 6], byteorder='little', signed=False) ++ nlmsg_type = int.from_bytes(nlmsg[nlmsg_idx + 4 : nlmsg_idx + 6], byteorder=sys.byteorder, signed=False) + if nlmsg_type == NLMSG_DONE: + break + + if nlmsg_type != RTM_NEWADDR: + break + +- nlmsg_len = int.from_bytes(nlmsg[nlmsg_idx : nlmsg_idx + 4], byteorder='little', signed=False) ++ nlmsg_len = int.from_bytes(nlmsg[nlmsg_idx : nlmsg_idx + 4], byteorder=sys.byteorder, signed=False) + if nlmsg_len % 4: # Is msg length not a multiple of 4? + break + + ifaddrmsg_indx = nlmsg_idx + NLMSGHDR_SZ + ifa_family = nlmsg[ifaddrmsg_indx] +- ifa_index = int.from_bytes(nlmsg[ifaddrmsg_indx + 4 : ifaddrmsg_indx + 8], byteorder='little', signed=False) ++ ifa_index = int.from_bytes(nlmsg[ifaddrmsg_indx + 4 : ifaddrmsg_indx + 8], byteorder=sys.byteorder, signed=False) + + rtattr_indx = ifaddrmsg_indx + IFADDRMSG_SZ + while rtattr_indx < (nlmsg_idx + nlmsg_len): +- rta_len = int.from_bytes(nlmsg[rtattr_indx : rtattr_indx + 2], byteorder='little', signed=False) +- rta_type = int.from_bytes(nlmsg[rtattr_indx + 2 : rtattr_indx + 4], byteorder='little', signed=False) ++ rta_len = int.from_bytes(nlmsg[rtattr_indx : rtattr_indx + 2], byteorder=sys.byteorder, signed=False) ++ rta_type = int.from_bytes(nlmsg[rtattr_indx + 2 : rtattr_indx + 4], byteorder=sys.byteorder, signed=False) + if rta_type == IFLA_ADDRESS: + data = nlmsg[rtattr_indx + RTATTR_SZ : rtattr_indx + rta_len] + if _data_matches_ip(ifa_family, data, src_addr): diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..830191e --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +Fix-byte-ordering-in-iputil-operations.patch -- cgit v1.2.3