shithub: riscv

Download patch

ref: 8d271549cdc06d7c1cbc8496261be118e90f5e24
parent: 1f6a402c46d5f95c656b14e4fa9a5de933576f01
author: cinap_lenrek <[email protected]>
date: Mon Feb 11 11:02:16 EST 2013

wifi: filter SNAP ethernet orgcode only

--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -63,9 +63,13 @@
 		default:
 			goto drop;
 		}
-		if(BLEN(b) < SNAPHDRSIZE || b->rp[0] != 0xAA || b->rp[1] != 0xAA || b->rp[2] != 0x03)
+		if(BLEN(b) < SNAPHDRSIZE)
 			break;
 		memmove(&s, b->rp, SNAPHDRSIZE);
+		if(s.dsap != 0xAA || s.ssap != 0xAA || s.control != 3)
+			break;
+		if(s.orgcode[0] != 0 || s.orgcode[1] != 0 || s.orgcode[2] != 0)
+			break;
 		b->rp += SNAPHDRSIZE-ETHERHDRSIZE;
 		e = (Etherpkt*)b->rp;
 		switch(w.fc[1] & 0x03){