Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stiletto/d82071e1835f386eebce65a599c12fa2 to your computer and use it in GitHub Desktop.
Save stiletto/d82071e1835f386eebce65a599c12fa2 to your computer and use it in GitHub Desktop.
[PATCH] Fix for MINIUPNPC_API_VERSION >= 18 from https://bugs.gentoo.org/935718
From 5bab1e3ac39ffe3ddaa0aa92fa80857f68219bfb Mon Sep 17 00:00:00 2001
From: Stiletto <blasux@blasux.ru>
Date: Sun, 28 Jul 2024 09:34:27 +0000
Subject: [PATCH] Fix for MINIUPNPC_API_VERSION >= 18 from
https://bugs.gentoo.org/935718
---
PKGBUILD | 8 ++++++--
tinc-1.1_pre18-fix-upnp.patch | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 tinc-1.1_pre18-fix-upnp.patch
diff --git a/PKGBUILD b/PKGBUILD
index 2cd1447..828470c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,12 +12,16 @@ makedepends=('git' 'autoconf')
optdepends=('python2' 'wxpython: gui support')
provides=('tinc-pre' 'tinc-pre-systemd')
conflicts=('tinc' 'tinc-pre-systemd')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/gsliepen/tinc/archive/refs/tags/release-$pkgver.tar.gz")
-sha256sums=('bd2d010a1bdeb1dd767f6fbc769fce2a2169119fb3d177df928c27d1f20b5775')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/gsliepen/tinc/archive/refs/tags/release-$pkgver.tar.gz"
+ "tinc-1.1_pre18-fix-upnp.patch")
+sha256sums=('bd2d010a1bdeb1dd767f6fbc769fce2a2169119fb3d177df928c27d1f20b5775'
+ '3ab0064994f62a649f6736d732e5617deba5cb686e0159ecf8e42f773b1fb9b5')
build() {
cd "$srcdir/tinc-release-$pkgver"
+ patch -p1 < "../tinc-1.1_pre18-fix-upnp.patch"
+
autoreconf -fsi
./configure \
--prefix=/usr \
diff --git a/tinc-1.1_pre18-fix-upnp.patch b/tinc-1.1_pre18-fix-upnp.patch
new file mode 100644
index 0000000..1850540
--- /dev/null
+++ b/tinc-1.1_pre18-fix-upnp.patch
@@ -0,0 +1,18 @@
+diff --git a/src/upnp.c b/src/upnp.c
+index 553630e..fd2b30b 100644
+--- a/src/upnp.c
++++ b/src/upnp.c
+@@ -124,8 +124,12 @@ static void upnp_refresh() {
+ struct IGDdatas data;
+
+ char myaddr[64];
+-
++#if (MINIUPNPC_API_VERSION >= 18)
++ char wnaddr[64];
++ int result = UPNP_GetValidIGD(devices, &urls, &data, myaddr, sizeof(myaddr), wnaddr, sizeof(wnaddr));
++#else
+ int result = UPNP_GetValidIGD(devices, &urls, &data, myaddr, sizeof(myaddr));
++#endif
+
+ if(result <= 0) {
+ logger(DEBUG_PROTOCOL, LOG_WARNING, "[upnp] No IGD found");
--
2.45.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment