code: plan9front

Download patch

ref: 63f10d4c945e3e692b589175508b95ce8dd9b50d
parent: efc7be7bdc01cb6bf079111d2e202991577ed125
author: qwx <qwx@sciops.net>
date: Fri Sep 9 21:02:11 EDT 2022

ip/tinc: fix ping pong racing causing recalcs and deleting nodes

--- a/sys/src/cmd/ip/tinc.c
+++ b/sys/src/cmd/ip/tinc.c
@@ -1301,7 +1301,10 @@
 	while((n = conrecv(c, f, nelem(f))) > 0){
 		switch(atoi(f[0])){
 		case PING:
-			if(consend(c, "%d %x", PONG, rand()) < 0)
+			netlock(c);
+			n = consend(c, "%d %x", PONG, rand());
+			netunlock(c);
+			if(n < 0)
 				return;
 			continue;
 		case PONG: