aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Fleurant <meshnet@protonmail.com>2020-07-23 23:35:18 -0400
committerWilliam Fleurant <meshnet@protonmail.com>2020-07-23 23:35:18 -0400
commit1d78e7dc3157b113f3026ffdacff09a63d18755c (patch)
tree28c56398701b185480ec6787467c14710ac5c3c0
parentec183eedae3200fabc346c422e4284d647284df6 (diff)
yggdrasil: Ygg-over-ygg bugfix
Signed-off-by: William Fleurant <meshnet@protonmail.com>
-rw-r--r--net/yggdrasil/Makefile2
-rw-r--r--net/yggdrasil/patches/100-drop-log-ygg-over-ygg.patch33
2 files changed, 34 insertions, 1 deletions
diff --git a/net/yggdrasil/Makefile b/net/yggdrasil/Makefile
index cad40d785..8fbf7a845 100644
--- a/net/yggdrasil/Makefile
+++ b/net/yggdrasil/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=yggdrasil
PKG_VERSION:=0.3.14
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/yggdrasil-network/yggdrasil-go/tar.gz/v$(PKG_VERSION)?
diff --git a/net/yggdrasil/patches/100-drop-log-ygg-over-ygg.patch b/net/yggdrasil/patches/100-drop-log-ygg-over-ygg.patch
new file mode 100644
index 000000000..682e48526
--- /dev/null
+++ b/net/yggdrasil/patches/100-drop-log-ygg-over-ygg.patch
@@ -0,0 +1,33 @@
+diff --git a/src/yggdrasil/tcp.go b/src/yggdrasil/tcp.go
+index 9cca419..45f93a5 100644
+--- a/src/yggdrasil/tcp.go
++++ b/src/yggdrasil/tcp.go
+@@ -25,6 +25,7 @@ import (
+
+ "golang.org/x/net/proxy"
+
++ "github.com/yggdrasil-network/yggdrasil-go/src/address"
+ "github.com/yggdrasil-network/yggdrasil-go/src/util"
+ )
+
+@@ -386,6 +387,19 @@ func (t *tcp) handler(sock net.Conn, incoming bool, options interface{}, upgrade
+ local, _, _ = net.SplitHostPort(sock.LocalAddr().String())
+ remote, _, _ = net.SplitHostPort(sock.RemoteAddr().String())
+ }
++ localIP := net.ParseIP(local)
++ if localIP = localIP.To16(); localIP != nil {
++ var laddr address.Address
++ var lsubnet address.Subnet
++ copy(laddr[:], localIP)
++ copy(lsubnet[:], localIP)
++ if laddr.IsValid() || lsubnet.IsValid() {
++ // The local address is with the network address/prefix range
++ // This would route ygg over ygg, which we don't want
++ t.link.core.log.Debugln("Dropping ygg-tunneled connection", local, remote)
++ return
++ }
++ }
+ force := net.ParseIP(strings.Split(remote, "%")[0]).IsLinkLocalUnicast()
+ link, err := t.link.core.link.create(&stream, name, proto, local, remote, incoming, force)
+ if err != nil {
+