shithub: riscv

Download patch

ref: 94f6f89ac1e8731a27c38b54b54348bc063fb6c3
parent: d497eb2d2f88e3ae7fd7b2a4594aededed75468e
author: cinap_lenrek <[email protected]>
date: Sun Jun 10 23:14:28 EDT 2018

devip: do not icmp reply on multicast destination

--- a/sys/src/9/ip/icmp6.c
+++ b/sys/src/9/ip/icmp6.c
@@ -430,7 +430,7 @@
 	uchar ia[IPaddrlen];
 
 	p = (Ip6hdr *)bp->rp;
-	if(isv6mcast(p->src) || !ipv6local(ifc, ia, p->src))
+	if(isv6mcast(p->dst) || isv6mcast(p->src) || !ipv6local(ifc, ia, p->src))
 		return;
 
 	netlog(f, Logicmp, "send icmphostunr %I -> src %I dst %I\n",
@@ -467,7 +467,7 @@
 	uchar ia[IPaddrlen];
 
 	p = (Ip6hdr *)bp->rp;
-	if(isv6mcast(p->src) || !ipv6local(ifc, ia, p->src))
+	if(isv6mcast(p->dst) || isv6mcast(p->src) || !ipv6local(ifc, ia, p->src))
 		return;
 
 	netlog(f, Logicmp, "send icmpttlexceeded6 %I -> src %I dst %I\n",
@@ -500,7 +500,7 @@
 	uchar ia[IPaddrlen];
 
 	p = (Ip6hdr *)bp->rp;
-	if(isv6mcast(p->src) || !ipv6local(ifc, ia, p->src))
+	if(isv6mcast(p->dst) || isv6mcast(p->src) || !ipv6local(ifc, ia, p->src))
 		return;
 
 	netlog(f, Logicmp, "send icmppkttoobig6 %I -> src %I dst %I\n",