Date: Wednesday, November 3, 2021 @ 18:38:31 Author: foxxx0 Revision: 1035647
upgpkg: python-pyroute2 0.5.19-4 | backport wireguard key parsing fix Reported via email. Upstream commit: https://github.com/svinota/pyroute2/commit/1fba06684062a298b22801c71a1ae091d313cc11 I have not been able to get a working pyroute2 0.6.x PKGBUILD together, therefore I backported the above patch. Added: python-pyroute2/trunk/fix-wireguard-key-parsing.patch Modified: python-pyroute2/trunk/PKGBUILD ---------------------------------+ PKGBUILD | 10 +++++---- fix-wireguard-key-parsing.patch | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2021-11-03 17:07:10 UTC (rev 1035646) +++ PKGBUILD 2021-11-03 18:38:31 UTC (rev 1035647) @@ -7,20 +7,22 @@ pkgname=("python-${_pkgbase}") pkgdesc="A pure Python netlink and Linux network configuration library" pkgver=0.5.19 -pkgrel=3 +pkgrel=4 arch=('any') url="https://docs.pyroute2.org/" license=('GPL2' 'Apache') depends=('python') makedepends=('python' 'python-setuptools' 'python-setuptools-scm' 'python-sphinx' 'git' 'python-aafigure' 'twine') -source=("https://files.pythonhosted.org/packages/source/${_pkgbase:0:1}/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz") +source=("https://files.pythonhosted.org/packages/source/${_pkgbase:0:1}/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz" + 'fix-wireguard-key-parsing.patch') # source=("${_pkgbase}-${pkgver}.tar.gz::https://github.com/svinota/${_pkgbase}/archive/${pkgver}.tar.gz" # 'fix_sphinx_css.patch') -sha512sums=('bd60e2adf59b8438ff4f6abf2d41cf18eb60dcef3072577648488db45ffe89bd9c7207c4eccc38eb9256533ea2950e7f20b82ae4940b1207ba71d0f261e83f6d') +sha512sums=('bd60e2adf59b8438ff4f6abf2d41cf18eb60dcef3072577648488db45ffe89bd9c7207c4eccc38eb9256533ea2950e7f20b82ae4940b1207ba71d0f261e83f6d' + '612e81058337e4e9d08fb083cfaf0efae180fbdc6c4150fa122160aa91b71b005bacef6cd3f171091ee1cb7e79523470db156448368f183b87f6474eb984691a') prepare() { cd "${srcdir}/${_pkgbase}-${pkgver}" - : + patch -p1 -N -i "${srcdir}/fix-wireguard-key-parsing.patch" } build() { Added: fix-wireguard-key-parsing.patch =================================================================== --- fix-wireguard-key-parsing.patch (rev 0) +++ fix-wireguard-key-parsing.patch 2021-11-03 18:38:31 UTC (rev 1035647) @@ -0,0 +1,42 @@ +From 1fba06684062a298b22801c71a1ae091d313cc11 Mon Sep 17 00:00:00 2001 +From: K900 <[email protected]> +Date: Mon, 24 May 2021 09:57:11 +0300 +Subject: [PATCH] wireguard: fix parsing keys + +Load the keys from the correct place in the message, and load them as the right length as well. +--- + pyroute2/netlink/generic/wireguard.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/pyroute2/netlink/generic/wireguard.py b/pyroute2/netlink/generic/wireguard.py +index 17b510d2..74f448e0 100644 +--- a/pyroute2/netlink/generic/wireguard.py ++++ b/pyroute2/netlink/generic/wireguard.py +@@ -151,11 +151,11 @@ class wgdevice_peer(nla): + ('WGPEER_A_PROTOCOL_VERSION', 'uint32')) + + class parse_peer_key(nla): +- fields = (('key', 's'), ) ++ fields = (('key', '32s'), ) + + def decode(self): + nla.decode(self) +- self['value'] = b64encode(self['value']) ++ self['value'] = b64encode(self['key']) + + def encode(self): + self['key'] = b64decode(self['value']) +@@ -220,11 +220,11 @@ def decode(self): + self['addr'] = '{0}/{1}'.format(self['addr'], wgaddr) + + class parse_wg_key(nla): +- fields = (('key', 's'), ) ++ fields = (('key', '32s'), ) + + def decode(self): + nla.decode(self) +- self['value'] = b64encode(self['value']) ++ self['value'] = b64encode(self['key']) + + def encode(self): + self['key'] = b64decode(self['value'])
