shithub: riscv

Download patch

ref: 81918373d23c36bf94dab76d24859a6316afadae
parent: a8e4b50cb21072c4699291cbeb243e074ff000f1
parent: a54804ed24165e4d9e3d433149f8535f6ce01058
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 23 19:32:24 EDT 2020

merge

--- a/sys/src/cmd/ip/tinc.c
+++ b/sys/src/cmd/ip/tinc.c
@@ -1440,12 +1440,16 @@
 {
 	uchar ip[IPaddrlen];
 	char dir[128];
+	int port;
 	Host *h;
 
-	h = findhost(ip, dir2ipport(fd2dir(fd, dir, sizeof(dir)), ip));
+	port = dir2ipport(fd2dir(fd, dir, sizeof(dir)), ip);
+	h = findhost(ip, port);
+	if(h == nil && incoming)
+		h = findhost(ip, -1);	/* might be behind NAT */
 	if(h != nil && h != myhost){
 		procsetname("udpclient %s %s %s %I!%d %s", myhost->name,
-			incoming ? "in": "out", dir, h->ip, h->port, h->name);
+			incoming ? "in": "out", dir, ip, port, h->name);
 
 		if(!incoming){
 			lock(h->cin);