From 9e47d44515279e7040c8aead570cdcdaf118b413 Mon Sep 17 00:00:00 2001 From: cgd Date: Tue, 27 Jan 1998 23:55:18 +0000 Subject: 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. --- sys/dev/ofw/ofnet.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'sys/dev') 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; -- cgit