shithub: riscv

Download patch

ref: 1159f1e54f376cbd8db7ea9387818c2c10f79627
parent: 49714325777f203a5632a378e0386c234985cc57
author: cinap_lenrek <[email protected]>
date: Wed Aug 1 22:02:10 EDT 2012

ip: fix assert panic on fragmented icmp echo request (see eriks icmp-frag patch)

--- a/sys/src/9/ip/icmp.c
+++ b/sys/src/9/ip/icmp.c
@@ -366,7 +366,7 @@
 	case EchoRequest:
 		if (iplen < n)
 			bp = trimblock(bp, 0, iplen);
-		r = mkechoreply(bp);
+		r = mkechoreply(concatblock(bp));
 		ipriv->out[EchoReply]++;
 		ipoput4(icmp->f, r, 0, MAXTTL, DFLTTOS, nil);
 		break;
--- a/sys/src/9/ip/icmp6.c
+++ b/sys/src/9/ip/icmp6.c
@@ -734,7 +734,7 @@
 
 	switch(p->type) {
 	case EchoRequestV6:
-		r = mkechoreply6(bp, ipifc);
+		r = mkechoreply6(concatblock(bp), ipifc);
 		if(r == nil)
 			goto raise;
 		ipriv->out[EchoReply]++;
--- a/sys/src/9/ip/ip.c
+++ b/sys/src/9/ip/ip.c
@@ -208,7 +208,6 @@
 		eh->cksum[0] = 0;
 		eh->cksum[1] = 0;
 		hnputs(eh->cksum, ipcsum(&eh->vihl));
-		assert(bp->next == nil);
 		ifc->m->bwrite(ifc, bp, V4, gate);
 		runlock(ifc);
 		poperror();