ref: cb2982f1599253d2521be04dce254db1914bb7bf
parent: 35ad7a7da54b7059b1f8cce32b3037ca9e68e46e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Oct 26 13:05:35 EDT 2024
devip: allow (NAT) hole punching for ICMP and UDP When establishing an translation for ICMP or UDP, allow the reply to be matched from ANY source ip/port.
--- a/sys/src/9/ip/ipaux.c
+++ b/sys/src/9/ip/ipaux.c
@@ -520,7 +520,8 @@
q->backward.trans = 2;
q->backward.lport = lport;
ipmove(q->backward.laddr, ia);
- if(p->ipproto == 1 || ipismulticast(da)){
+ if(p->ipproto == 1 || p->ipproto == 17){
+ /* ICMP and UDP allow reply from anyone (for hole punching) */
q->backward.rport = 0;
ipmove(q->backward.raddr, IPnoaddr);
} else {
--
⑨