diff options
| author | cgd <cgd@NetBSD.org> | 1998-01-27 23:55:18 +0000 |
|---|---|---|
| committer | cgd <cgd@NetBSD.org> | 1998-01-27 23:55:18 +0000 |
| commit | 9e47d44515279e7040c8aead570cdcdaf118b413 (patch) | |
| tree | 06e74aa807d0032dd41527657603e7e2e2f19543 /sys/dev | |
| parent | cdec42b6a0e04b6be112c285d204a9df900869cb (diff) | |
Make sure the data after the Ethernet header is aligned. (It's been
in the Shark source tree for a while, but Jason's recent commit to
dp8390.c spurred me to check it in here.)
XXX Assumes the device is an ethernet, but then so does other code in
this driver.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ofw/ofnet.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c index d5b0c3fdbf3..3424a2b1888 100644 --- a/sys/dev/ofw/ofnet.c +++ b/sys/dev/ofw/ofnet.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofnet.c,v 1.11 1998/01/22 01:47:43 cgd Exp $ */ +/* $NetBSD: ofnet.c,v 1.12 1998/01/27 23:55:18 cgd Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -226,6 +226,22 @@ ofnread(of) } l = MCLBYTES; } + + /* + * Make sure the data after the Ethernet header + * is aligned. + * + * XXX Assumes the device is an ethernet, but + * XXX then so does other code in this driver. + */ + if (head == NULL) { + caddr_t newdata = (caddr_t)ALIGN(m->m_data + + sizeof(struct ether_header)) - + sizeof(struct ether_header); + l -= newdata - m->m_data; + m->m_data = newdata; + } + m->m_len = l = min(len, l); bcopy(bufp, mtod(m, char *), l); bufp += l; |
