e1000: Also discard oversized packets if LPE is enabled.

ok sthen@
This commit is contained in:
brad 2012-12-20 23:12:20 +00:00
parent cf9663fb00
commit 1e1449b98c
2 changed files with 29 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.93 2012/12/12 18:01:08 brad Exp $
# $OpenBSD: Makefile,v 1.94 2012/12/20 23:12:20 brad Exp $
ONLY_FOR_ARCHS= amd64 arm i386 mips64 mips64el powerpc sparc sparc64
COMMENT= multi system emulator
DISTNAME= qemu-1.2.2
REVISION= 0
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/
EXTRACT_SUFX= .tar.bz2

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-hw_e1000_c,v 1.6 2012/12/20 23:12:20 brad Exp $
Discard oversized packets based on SBP|LPE.
--- hw/e1000.c.orig Wed Dec 19 23:14:16 2012
+++ hw/e1000.c Wed Dec 19 23:15:08 2012
@@ -61,6 +61,8 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL
/* this is the size past which hardware will drop packets when setting LPE=0 */
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
+/* this is the size past which hardware will drop packets when setting LPE=1 */
+#define MAXIMUM_ETHERNET_LPE_SIZE 16384
/*
* HW models:
@@ -799,8 +801,9 @@ e1000_receive(NetClientState *nc, const uint8_t *buf,
}
/* Discard oversized packets if !LPE and !SBP. */
- if (size > MAXIMUM_ETHERNET_VLAN_SIZE
- && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
+ if ((size > MAXIMUM_ETHERNET_LPE_SIZE ||
+ (size > MAXIMUM_ETHERNET_VLAN_SIZE
+ && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
&& !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
return size;
}