shithub: plan9front

Download patch

ref: 6b5de9ee6738c0f52122978130d4a8a508d75739
parent: f8ddcb23b9dd969875dd4e961591700c79b7d5f7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Dec 30 10:09:07 EST 2022

icmp: only forward EchoRequest, Timestamp(request), InfoRequest and AddrMaskRequest

--- a/sys/src/9/ip/icmp.c
+++ b/sys/src/9/ip/icmp.c
@@ -564,6 +564,17 @@
 	Translation *q;
 
 	p = (Icmp*)(bp->rp);
+	switch(p->type){
+	case EchoRequest:
+	case Timestamp:
+	case InfoRequest:
+	case AddrMaskRequest:
+		break;
+	default:
+		/* no icmpid, can't translate back */
+		freeblist(bp);
+		return nil;
+	}
 	v4tov6(sa, p->src);
 	v4tov6(da, p->dst);
 	id = nhgets(p->icmpid);