git: 9front

Download patch

ref: 929c19612a8949913dd283ae35270119d3979845
parent: aa4b0ebd3eec4ac96990f6fb7f29479609bbce80
author: cinap_lenrek <cinap_lenrek@gmx.de>
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();
--