diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2003-01-28 01:37:53 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2003-01-28 01:37:53 +0000 |
commit | baefabe63a283d94a74bea9dad3dbf113ada3909 (patch) | |
tree | 91372f0752480b246f86c7c2debecf5f72ecdefe /sys/arch | |
parent | 3dcab5460de0a9bdd7d160d7a3ee928abc93cb48 (diff) |
pad < minimal length packets with 0's; based on netbsd; tested by miod
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme68k/dev/if_ie.c | 10 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/netboot/if_ie.c | 9 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_ie.c | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/netboot/if_ie.c | 9 |
4 files changed, 30 insertions, 8 deletions
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index e5e58cd9d9a..b5163656928 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.20 2002/10/12 01:09:43 krw Exp $ */ +/* $OpenBSD: if_ie.c,v 1.21 2003/01/28 01:37:52 jason Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -1319,7 +1319,13 @@ iestart(ifp) printf("%s: tbuf overflow\n", sc->sc_dev.dv_xname); m_freem(m0); - len = max(len, ETHER_MIN_LEN); + + if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) { + bzero(buffer, ETHER_MIN_LEN - ETHER_CRC_LEN - len); + len = ETHER_MIN_LEN - ETHER_CRC_LEN; + buffer += ETHER_MIN_LEN - ETHER_CRC_LEN; + } + sc->xmit_buffs[sc->xchead]->ie_xmit_flags = len; sc->xmit_free--; diff --git a/sys/arch/mvme68k/stand/netboot/if_ie.c b/sys/arch/mvme68k/stand/netboot/if_ie.c index 48c45acb861..db50fb81382 100644 --- a/sys/arch/mvme68k/stand/netboot/if_ie.c +++ b/sys/arch/mvme68k/stand/netboot/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.9 2002/03/14 01:26:38 millert Exp $ */ +/* $OpenBSD: if_ie.c,v 1.10 2003/01/28 01:37:52 jason Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -39,6 +39,7 @@ #define ETHER_MIN_LEN 64 #define ETHER_MAX_LEN 1518 +#define ETHER_CRC_LEN 4 #define NTXBUF 1 #define NRXBUF 16 @@ -381,7 +382,11 @@ ie_put(desc, pkt, len) /* copy data */ bcopy(p, (void *)&iem->im_txbuf[xx], len); - len = MAX(len, ETHER_MIN_LEN); + if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) { + bzero((char *)&iem->im_txbuf[xx] + len, + ETHER_MIN_LEN - ETHER_CRC_LEN - len); + len = ETHER_MIN_LEN - ETHER_CRC_LEN; + } /* build transmit descriptor */ iem->im_xd[xx].ie_xmit_flags = len | IE_XMIT_LAST; diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index efedfb295b2..9f058beb345 100644 --- a/sys/arch/mvme88k/dev/if_ie.c +++ b/sys/arch/mvme88k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.22 2002/03/14 01:26:39 millert Exp $ */ +/* $OpenBSD: if_ie.c,v 1.23 2003/01/28 01:37:52 jason Exp $ */ /*- * Copyright (c) 1998 Steve Murphree, Jr. @@ -1265,7 +1265,13 @@ iestart(ifp) printf("%s: tbuf overflow\n", sc->sc_dev.dv_xname); m_freem(m0); - len = max(len, ETHER_MIN_LEN); + + if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) { + bzero(buffer, ETHER_MIN_LEN - ETHER_CRC_LEN - len); + len = ETHER_MIN_LEN - ETHER_CRC_LEN; + buffer += ETHER_MIN_LEN - ETHER_CRC_LEN; + } + sc->xmit_buffs[sc->xchead]->ie_xmit_flags = len; sc->xmit_free--; diff --git a/sys/arch/mvme88k/stand/netboot/if_ie.c b/sys/arch/mvme88k/stand/netboot/if_ie.c index 5285ee491a4..78bc6c80bf9 100644 --- a/sys/arch/mvme88k/stand/netboot/if_ie.c +++ b/sys/arch/mvme88k/stand/netboot/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.5 2002/03/14 01:26:40 millert Exp $ */ +/* $OpenBSD: if_ie.c,v 1.6 2003/01/28 01:37:52 jason Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -39,6 +39,7 @@ #define ETHER_MIN_LEN 64 #define ETHER_MAX_LEN 1518 +#define ETHER_CRC_LEN 4 #define NTXBUF 1 #define NRXBUF 16 @@ -377,7 +378,11 @@ ie_put(desc, pkt, len) /* copy data */ bcopy(p, (void *)&iem->im_txbuf[xx], len); - len = MAX(len, ETHER_MIN_LEN); + if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) { + bzero((char *)&iem->im_txbuf[xx] + len, + ETHER_MIN_LEN - ETHER_CRC_LEN - len); + len = ETHER_MIN_LEN - ETHER_CRC_LEN; + } /* build transmit descriptor */ iem->im_xd[xx].ie_xmit_flags = len | IE_XMIT_LAST; |