diff options
author | 2016-01-08 11:23:30 +0000 | |
---|---|---|
committer | 2016-01-08 11:23:30 +0000 | |
commit | 5efa9773d89e0f99b4ac3595b69c8af49265b0a1 (patch) | |
tree | 6bda4e11128519edcb05f6c8d4ab17f22487b515 /sys | |
parent | Add "vmm" pledge to allow restricted ioctl access to /dev/vmm. (diff) | |
download | wireguard-openbsd-5efa9773d89e0f99b4ac3595b69c8af49265b0a1.tar.xz wireguard-openbsd-5efa9773d89e0f99b4ac3595b69c8af49265b0a1.zip |
Work around buggy zero-length packets produced by the DP83816A.
From Nathanael Rensen, ok dlg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_sis.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/if_sisreg.h | 5 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 140f6642dba..4a00ab322b2 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.132 2015/11/25 03:09:59 dlg Exp $ */ +/* $OpenBSD: if_sis.c,v 1.133 2016/01/08 11:23:30 mpi Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1389,6 +1389,18 @@ sis_rxeof(struct sis_softc *sc) if_rxr_put(&sc->sis_cdata.sis_rx_ring, 1); /* + * DP83816A sometimes produces zero-length packets + * shortly after initialisation. + */ + if (total_len == 0) { + m_freem(m); + continue; + } + + /* The ethernet CRC is always included */ + total_len -= ETHER_CRC_LEN; + + /* * If an error occurs, update stats, clear the * status word and leave the mbuf cluster in place: * it should simply get re-used next time this descriptor diff --git a/sys/dev/pci/if_sisreg.h b/sys/dev/pci/if_sisreg.h index 9d9074e28fe..61510f0c9bd 100644 --- a/sys/dev/pci/if_sisreg.h +++ b/sys/dev/pci/if_sisreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sisreg.h,v 1.34 2015/02/11 21:36:02 brad Exp $ */ +/* $OpenBSD: if_sisreg.h,v 1.35 2016/01/08 11:23:30 mpi Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -343,8 +343,7 @@ struct sis_desc { #define SIS_LASTDESC(x) (!(letoh32((x)->sis_ctl) & SIS_CMDSTS_MORE))) #define SIS_OWNDESC(x) (letoh32((x)->sis_ctl) & SIS_CMDSTS_OWN) #define SIS_INC(x, y) (x) = ((x) == ((y)-1)) ? 0 : (x)+1 -#define SIS_RXBYTES(x) \ - ((letoh32((x)->sis_ctl) & SIS_CMDSTS_BUFLEN) - ETHER_CRC_LEN) +#define SIS_RXBYTES(x) (letoh32((x)->sis_ctl) & SIS_CMDSTS_BUFLEN) #define SIS_RXSTAT_COLL 0x00010000 #define SIS_RXSTAT_LOOPBK 0x00020000 |