pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-rns: Fix AutoInterface on NetBSD



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Tue Feb 28 10:30:30 2023 -0500
Changeset:	afb525a3c4224d29c37975c5c75105175e72f3b2

Modified Files:
	py-rns/Makefile
	py-rns/distinfo
Added Files:
	py-rns/patches/patch-RNS_Interfaces_AutoInterface.py

Log Message:
py-rns: Fix AutoInterface on NetBSD

Add patch, already filed upstream.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=afb525a3c4224d29c37975c5c75105175e72f3b2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-rns/Makefile                                    |  1 +
 py-rns/distinfo                                    |  1 +
 .../patches/patch-RNS_Interfaces_AutoInterface.py  | 50 ++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diffs:
diff --git a/py-rns/Makefile b/py-rns/Makefile
index f112b530b9..ab7d79b50c 100644
--- a/py-rns/Makefile
+++ b/py-rns/Makefile
@@ -2,6 +2,7 @@
 
 DISTNAME=	rns-0.4.9
 PKGNAME=	${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=	1
 CATEGORIES=	comms python
 MASTER_SITES=	${MASTER_SITE_PYPI:=r/rns/}
 
diff --git a/py-rns/distinfo b/py-rns/distinfo
index 55733e2103..5e97715d20 100644
--- a/py-rns/distinfo
+++ b/py-rns/distinfo
@@ -3,3 +3,4 @@ $NetBSD$
 BLAKE2s (rns-0.4.9.tar.gz) = 002a7e2c2bfc0b4b3f50be07df0759411a85fae7f190986fd1e74061d785d5d4
 SHA512 (rns-0.4.9.tar.gz) = 240100857d5613870b60427f6d12a1a48568177109e43eaea404d4ddde32724cd84ca1146af8621b0b0487c2b06535d3593c5b01f5def09bbde138a33a79e264
 Size (rns-0.4.9.tar.gz) = 276828 bytes
+SHA1 (patch-RNS_Interfaces_AutoInterface.py) = 13881b2957a52e6b10cfb0c9b81a4ce07565f1ff
diff --git a/py-rns/patches/patch-RNS_Interfaces_AutoInterface.py b/py-rns/patches/patch-RNS_Interfaces_AutoInterface.py
new file mode 100644
index 0000000000..298a63880a
--- /dev/null
+++ b/py-rns/patches/patch-RNS_Interfaces_AutoInterface.py
@@ -0,0 +1,50 @@
+$NetBSD$
+
+https://github.com/gdt/Reticulum/commits/fix-transmit-hash
+
+--- RNS/Interfaces/AutoInterface.py.orig	2023-02-03 16:36:43.000000000 +0000
++++ RNS/Interfaces/AutoInterface.py
+@@ -23,6 +23,7 @@
+ from .Interface import Interface
+ import socketserver
+ import threading
++import re
+ import socket
+ import struct
+ import time
+@@ -53,6 +54,13 @@ class AutoInterface(Interface):
+             return AutoInterfaceHandler(callback, *args, **keys)
+         return create_handler
+ 
++    def descope_linklocal(self, link_local_addr):
++        # Drop scope specifier expressd as %ifname (macOS)
++        link_local_addr = link_local_addr.split("%")[0]
++        # Drop embedded scope specifier (NetBSD, OpenBSD)
++        link_local_addr = re.sub(r"fe80:[0-9a-f]*::","fe80::", link_local_addr)
++        return link_local_addr
++
+     def __init__(self, owner, name, group_id=None, discovery_scope=None, discovery_port=None, data_port=None, allowed_interfaces=None, ignored_interfaces=None, configured_bitrate=None):
+         import importlib
+         if importlib.util.find_spec('netifaces') != None:
+@@ -158,9 +166,9 @@ class AutoInterface(Interface):
+                         for address in addresses[self.netifaces.AF_INET6]:
+                             if "addr" in address:
+                                 if address["addr"].startswith("fe80:"):
+-                                    link_local_addr = address["addr"]
+-                                    self.link_local_addresses.append(link_local_addr.split("%")[0])
+-                                    self.adopted_interfaces[ifname] = link_local_addr.split("%")[0]
++                                    link_local_addr = self.descope_linklocal(address["addr"])
++                                    self.link_local_addresses.append(link_local_addr)
++                                    self.adopted_interfaces[ifname] = link_local_addr
+                                     self.multicast_echoes[ifname] = time.time()
+                                     RNS.log(str(self)+" Selecting link-local address "+str(link_local_addr)+" for interface "+str(ifname), RNS.LOG_EXTREME)
+ 
+@@ -278,7 +286,7 @@ class AutoInterface(Interface):
+                         for address in addresses[self.netifaces.AF_INET6]:
+                             if "addr" in address:
+                                 if address["addr"].startswith("fe80:"):
+-                                    link_local_addr = address["addr"].split("%")[0]
++                                    link_local_addr = self.descope_linklocal(address["addr"])
+                                     if link_local_addr != self.adopted_interfaces[ifname]:
+                                         old_link_local_address = self.adopted_interfaces[ifname]
+                                         RNS.log("Replacing link-local address "+str(old_link_local_address)+" for "+str(ifname)+" with "+str(link_local_addr), RNS.LOG_DEBUG)


Home | Main Index | Thread Index | Old Index