summaryrefslogtreecommitdiffstats
path: root/sys/dev/harp/if_harp.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-02-21 13:01:54 +0000
committerharti <harti@FreeBSD.org>2004-02-21 13:01:54 +0000
commit570158ff71cc1d6da7609d59dffdb5c05b47cfa6 (patch)
tree3b503804ca96113c000979f902ebb211244c9e4c /sys/dev/harp/if_harp.c
parentf5e52d8bdd0a2fb914c5a8081d1e32d0e0cd0ca2 (diff)
downloadFreeBSD-src-570158ff71cc1d6da7609d59dffdb5c05b47cfa6.zip
FreeBSD-src-570158ff71cc1d6da7609d59dffdb5c05b47cfa6.tar.gz
Make sure that the first mbuf in the chain passed to atm_intr
always contains a packet header.
Diffstat (limited to 'sys/dev/harp/if_harp.c')
-rw-r--r--sys/dev/harp/if_harp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/harp/if_harp.c b/sys/dev/harp/if_harp.c
index ac38b02..87711b9 100644
--- a/sys/dev/harp/if_harp.c
+++ b/sys/dev/harp/if_harp.c
@@ -560,23 +560,27 @@ harp_input(struct ifnet *ifp, struct mbuf **mp, struct atm_pseudohdr *ah,
/* fit two pointers into the mbuf - assume, that the the data is
* pointer aligned. If it doesn't fit into the first mbuf, prepend
- * another one, but leave the packet header where it is. atm_intr
- * relies on this. */
+ * another one.
+ * Don't count the new fields in the packet length (XXX)
+ */
mlen = m->m_pkthdr.len;
pfxlen = sizeof(atm_intr_func_t) + sizeof(void *);
if (M_LEADINGSPACE(m) < pfxlen) {
- MGET(m0, 0, MT_DATA);
+ MGETHDR(m0, 0, MT_DATA);
if (m0 == NULL) {
printf("%s: no leading space in buffer\n", __func__);
goto drop;
}
m0->m_len = 0;
m0->m_next = m;
+
+ M_MOVE_PKTHDR(m0, m);
+
m = m0;
}
m->m_len += pfxlen;
m->m_data -= pfxlen;
- KB_DATASTART(m, cp, char *);
+ cp = mtod(m, char *);
*((atm_intr_func_t *)cp) = harp_recv_stack;
cp += sizeof(atm_intr_func_t);
*((void **)cp) = (void *)vcc;
OpenPOWER on IntegriCloud