From 87c15d9649dee3abd7b377cbdef5c2b88397da9f Mon Sep 17 00:00:00 2001 From: David Greenman Date: Mon, 22 May 1995 13:32:24 +0000 Subject: [PATCH] There are two serious bugs in if_de.c. The first should not matter to most users (the wrong length is passed to ether_input). The second is more serious. The multicast hash algorithm uses the wrong (low) bits instead of the right (high) bits. This is only an issue if you use >12 multicast addresses but if you are using IP multicast then it might affect you... Submitted by: Matt Thomas --- sys/dev/de/if_de.c | 7 ++++--- sys/pci/if_de.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index b2d72c19725..8b708f07a69 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_de.c,v 1.24 1995/05/05 20:09:51 davidg Exp $ + * $Id: if_de.c,v 1.25 1995/05/22 05:51:41 davidg Exp $ * */ @@ -674,7 +674,8 @@ tulip_rx_intr( if (m0 != NULL) { m->m_pkthdr.rcvif = ifp; m->m_data += sizeof(struct ether_header); - m->m_len = m->m_pkthdr.len = total_len; + m->m_len = m->m_pkthdr.len = total_len - + sizeof(struct ether_header); #if defined(__bsdi__) eh.ether_type = ntohs(eh.ether_type); #endif @@ -1042,7 +1043,7 @@ tulip_read_srom( } } -#define tulip_mchash(mca) (tulip_crc32(mca, 6) & 0x1FF) +#define tulip_mchash(mca) ((tulip_crc32(mca, 6) >> 23) & 0x1FF) #define tulip_srom_crcok(databuf) ( \ (tulip_crc32(databuf, 126) & 0xFFFF) == \ ((databuf)[126] | ((databuf)[127] << 8))) diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index b2d72c19725..8b708f07a69 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_de.c,v 1.24 1995/05/05 20:09:51 davidg Exp $ + * $Id: if_de.c,v 1.25 1995/05/22 05:51:41 davidg Exp $ * */ @@ -674,7 +674,8 @@ tulip_rx_intr( if (m0 != NULL) { m->m_pkthdr.rcvif = ifp; m->m_data += sizeof(struct ether_header); - m->m_len = m->m_pkthdr.len = total_len; + m->m_len = m->m_pkthdr.len = total_len - + sizeof(struct ether_header); #if defined(__bsdi__) eh.ether_type = ntohs(eh.ether_type); #endif @@ -1042,7 +1043,7 @@ tulip_read_srom( } } -#define tulip_mchash(mca) (tulip_crc32(mca, 6) & 0x1FF) +#define tulip_mchash(mca) ((tulip_crc32(mca, 6) >> 23) & 0x1FF) #define tulip_srom_crcok(databuf) ( \ (tulip_crc32(databuf, 126) & 0xFFFF) == \ ((databuf)[126] | ((databuf)[127] << 8)))