shithub: riscv

Download patch

ref: 58a0db935ce609533d121a5158a3a9fc65d03f65
parent: d41ca0d32cac02ee12733b0710d8eae3f34c6a4c
author: cinap_lenrek <[email protected]>
date: Sun Aug 14 19:07:10 EDT 2016

ip/il: dont attept to connect over IPv6, IL only supports IPv4 packets

--- a/sys/src/9/ip/il.c
+++ b/sys/src/9/ip/il.c
@@ -251,6 +251,9 @@
 	e = Fsstdconnect(c, argv, argc);
 	if(e != nil)
 		return e;
+	if(c->ipversion != V4)
+		return "only IP version 4 supported";
+		
 	return ilstart(c, IL_CONNECT, fast);
 }
 
@@ -548,6 +551,9 @@
 
 	ih = (Ilhdr *)bp->rp;
 	plen = blocklen(bp);
+	if(plen > 0 && (ih->vihl&0xF0)!=IP_VER4)
+		goto raise;	/* ignore non V4 packets */
+
 	if(plen < IL_IPSIZE+IL_HDRSIZE){
 		netlog(il->f, Logil, "il: hlenerr\n");
 		ipriv->stats[HlenErrs]++;