diff --git a/SOURCES/0001-iproute-linux-try-to-improve-flags-when-sending-del-.patch b/SOURCES/0001-iproute-linux-try-to-improve-flags-when-sending-del-.patch new file mode 100644 index 0000000..53e5a85 --- /dev/null +++ b/SOURCES/0001-iproute-linux-try-to-improve-flags-when-sending-del-.patch @@ -0,0 +1,150 @@ +From a674208832c217aba3d5e18ab312b1d80e63f133 Mon Sep 17 00:00:00 2001 +From: Florent Fourcot +Date: Fri, 22 Apr 2022 19:01:12 +0200 +Subject: [PATCH] iproute/linux: try to improve flags when sending del messages + +Flags are not the same between NEW and DELETE request. In file netlink.h +we can see: + + /* Modifiers to NEW request */ + #define NLM_F_REPLACE 0x100 /* Override existing */ + #define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ + #define NLM_F_CREATE 0x400 /* Create, if it does not exist */ + #define NLM_F_APPEND 0x800 /* Add to end of list */ + + /* Modifiers to DELETE request */ + #define NLM_F_NONREC 0x100 /* Do not delete recursively */ + #define NLM_F_BULK 0x200 /* Delete multiple objects */ + +So NLM_F_BULK is the same value than NLM_F_EXCL. NLM_F_BULK has been +added in this kernel commit: + +https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=a6cec0bcd34264be8887791594be793b3f12719f + +When this flag is set, pyroute now get a lot of error everywhere when +trying to delete objects. + +Note that kernel commit is not yet mainline, and still in developpment +branch. But it can have a huge impact on pyroute2 library + +(cherry picked from commit 1eb08312de30a083bcfddfaa9c1d5e124b6368df) +Conflicts: + pyroute2.core/pr2modules/iproute/linux.py +--- + pyroute2.core/pr2modules/iproute/linux.py | 44 +++++++++++------------ + 1 file changed, 22 insertions(+), 22 deletions(-) + +diff --git a/pyroute2.core/pr2modules/iproute/linux.py b/pyroute2.core/pr2modules/iproute/linux.py +index 725cdb18..68665685 100644 +--- a/pyroute2.core/pr2modules/iproute/linux.py ++++ b/pyroute2.core/pr2modules/iproute/linux.py +@@ -625,7 +625,7 @@ class RTNL_API(object): + # flush all addresses with IFA_LABEL='eth0': + ipr.flush_addr(label='eth0') + ''' +- flags = NLM_F_CREATE | NLM_F_EXCL | NLM_F_REQUEST ++ flags = NLM_F_CREATE | NLM_F_REQUEST + ret = [] + for addr in self.get_addr(*argv, **kwarg): + self.put(addr, msg_type=RTM_DELADDR, msg_flags=flags) +@@ -646,7 +646,7 @@ class RTNL_API(object): + # flush all IPv6 rules that point to table 250: + ipr.flush_rules(family=socket.AF_INET6, table=250) + ''' +- flags = NLM_F_CREATE | NLM_F_EXCL | NLM_F_REQUEST ++ flags = NLM_F_CREATE | NLM_F_REQUEST + ret = [] + for rule in self.get_rules(*argv, **kwarg): + self.put(rule, msg_type=RTM_DELRULE, msg_flags=flags) +@@ -1010,9 +1010,9 @@ class RTNL_API(object): + 'set': (RTM_NEWNEIGH, flags_replace), + 'replace': (RTM_NEWNEIGH, flags_replace), + 'change': (RTM_NEWNEIGH, flags_change), +- 'del': (RTM_DELNEIGH, flags_make), +- 'remove': (RTM_DELNEIGH, flags_make), +- 'delete': (RTM_DELNEIGH, flags_make), ++ 'del': (RTM_DELNEIGH, flags_base), ++ 'remove': (RTM_DELNEIGH, flags_base), ++ 'delete': (RTM_DELNEIGH, flags_base), + 'dump': (RTM_GETNEIGH, flags_dump), + 'get': (RTM_GETNEIGH, flags_base), + 'append': (RTM_NEWNEIGH, flags_append)} +@@ -1391,11 +1391,11 @@ class RTNL_API(object): + commands = {'set': (RTM_NEWLINK, flags_req), + 'update': (RTM_SETLINK, flags_create), + 'add': (RTM_NEWLINK, flags_create), +- 'del': (RTM_DELLINK, flags_create), ++ 'del': (RTM_DELLINK, flags_req), + 'property_add': (RTM_NEWLINKPROP, flag_append), + 'property_del': (RTM_DELLINKPROP, flags_req), +- 'remove': (RTM_DELLINK, flags_create), +- 'delete': (RTM_DELLINK, flags_create), ++ 'remove': (RTM_DELLINK, flags_req), ++ 'delete': (RTM_DELLINK, flags_req), + 'dump': (RTM_GETLINK, flags_dump), + 'get': (RTM_GETLINK, NLM_F_REQUEST)} + +@@ -1525,9 +1525,9 @@ class RTNL_API(object): + flags_create = flags_base | NLM_F_CREATE | NLM_F_EXCL + flags_replace = flags_base | NLM_F_REPLACE | NLM_F_CREATE + commands = {'add': (RTM_NEWADDR, flags_create), +- 'del': (RTM_DELADDR, flags_create), +- 'remove': (RTM_DELADDR, flags_create), +- 'delete': (RTM_DELADDR, flags_create), ++ 'del': (RTM_DELADDR, flags_base), ++ 'remove': (RTM_DELADDR, flags_base), ++ 'delete': (RTM_DELADDR, flags_base), + 'replace': (RTM_NEWADDR, flags_replace), + 'dump': (RTM_GETADDR, flags_dump)} + (command, flags) = commands.get(command, command) +@@ -1674,17 +1674,17 @@ class RTNL_API(object): + flags_replace = flags_change | NLM_F_CREATE + + commands = {'add': (RTM_NEWQDISC, flags_make), +- 'del': (RTM_DELQDISC, flags_make), +- 'remove': (RTM_DELQDISC, flags_make), +- 'delete': (RTM_DELQDISC, flags_make), ++ 'del': (RTM_DELQDISC, flags_base), ++ 'remove': (RTM_DELQDISC, flags_base), ++ 'delete': (RTM_DELQDISC, flags_base), + 'change': (RTM_NEWQDISC, flags_change), + 'replace': (RTM_NEWQDISC, flags_replace), + 'add-class': (RTM_NEWTCLASS, flags_make), +- 'del-class': (RTM_DELTCLASS, flags_make), ++ 'del-class': (RTM_DELTCLASS, flags_base), + 'change-class': (RTM_NEWTCLASS, flags_change), + 'replace-class': (RTM_NEWTCLASS, flags_replace), + 'add-filter': (RTM_NEWTFILTER, flags_make), +- 'del-filter': (RTM_DELTFILTER, flags_make), ++ 'del-filter': (RTM_DELTFILTER, flags_base), + 'change-filter': (RTM_NEWTFILTER, flags_change), + 'replace-filter': (RTM_NEWTFILTER, flags_replace)} + if isinstance(command, int): +@@ -1984,9 +1984,9 @@ class RTNL_API(object): + 'replace': (RTM_NEWROUTE, flags_replace), + 'change': (RTM_NEWROUTE, flags_change), + 'append': (RTM_NEWROUTE, flags_append), +- 'del': (RTM_DELROUTE, flags_make), +- 'remove': (RTM_DELROUTE, flags_make), +- 'delete': (RTM_DELROUTE, flags_make), ++ 'del': (RTM_DELROUTE, flags_base), ++ 'remove': (RTM_DELROUTE, flags_base), ++ 'delete': (RTM_DELROUTE, flags_base), + 'get': (RTM_GETROUTE, NLM_F_REQUEST), + 'show': (RTM_GETROUTE, flags_dump), + 'dump': (RTM_GETROUTE, flags_dump)} +@@ -2126,9 +2126,9 @@ class RTNL_API(object): + flags_dump = NLM_F_REQUEST | NLM_F_ROOT | NLM_F_ATOMIC + + commands = {'add': (RTM_NEWRULE, flags_make), +- 'del': (RTM_DELRULE, flags_make), +- 'remove': (RTM_DELRULE, flags_make), +- 'delete': (RTM_DELRULE, flags_make), ++ 'del': (RTM_DELRULE, flags_base), ++ 'remove': (RTM_DELRULE, flags_base), ++ 'delete': (RTM_DELRULE, flags_base), + 'dump': (RTM_GETRULE, flags_dump)} + if isinstance(command, int): + command = (command, flags_make) +-- +2.40.0 diff --git a/SPECS/python-pyroute2.spec b/SPECS/python-pyroute2.spec index 65ee60e..c15b201 100644 --- a/SPECS/python-pyroute2.spec +++ b/SPECS/python-pyroute2.spec @@ -9,7 +9,7 @@ Name: python-%{srcname} Version: 0.6.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Pure Python netlink library License: GPLv2+ URL: https://github.com/svinota/%{srcname} @@ -24,6 +24,8 @@ Source5: https://pypi.io/packages/source/p/pyroute2.ipset/pyroute2.ipset-%{versi Source6: https://pypi.io/packages/source/p/pyroute2.ipdb/pyroute2.ipdb-%{version}.tar.gz Source7: https://pypi.io/packages/source/p/pyroute2.ndb/pyroute2.ndb-%{version}.tar.gz +# Required for https://bugs.launchpad.net/tripleo/+bug/2023764 +Patch: 0001-iproute-linux-try-to-improve-flags-when-sending-del-.patch %description PyRoute2 provides several levels of API to work with Netlink @@ -56,6 +58,9 @@ tar xzvf %SOURCE4 tar xzvf %SOURCE5 tar xzvf %SOURCE6 tar xzvf %SOURCE7 +cd pyroute2.core-%{version} +%patch -p2 +cd .. %build %py3_build @@ -99,6 +104,10 @@ cd ../pyroute2.ndb-%{version} %{python3_sitelib}/pr2modules %changelog +* Thu Jun 15 2023 Alfredo Moralejo - 0.6.6-2 +- Backport https://github.com/svinota/pyroute2/commit/1eb08312 required for kernel-5.14.0-324 +- Resolves: https://bugs.launchpad.net/tripleo/+bug/2023764 + * Tue Jun 07 2022 Alfredo Moralejo - 0.6.6-1 - Update to 0.6.6