From 8f52a59171ecbae4ad77acd869011df4a56bcdaa Mon Sep 17 00:00:00 2001 From: Hartmut Brandt Date: Sat, 21 Feb 2004 12:55:07 +0000 Subject: Don't remove the first mbuf in the chain if it got empty. This removes the packet header in certain cases which later on will give panic. Clarify what the atm_intr expects in the comment and de-obscurify the code a little bit by replacing the portability macros with the BSD names. The code isn't maintained externally anymore so there's no point in keeping the extra level of obscurity. --- sys/netatm/atm_subr.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'sys') diff --git a/sys/netatm/atm_subr.c b/sys/netatm/atm_subr.c index a2768f3a243d..d816dfd63129 100644 --- a/sys/netatm/atm_subr.c +++ b/sys/netatm/atm_subr.c @@ -542,6 +542,8 @@ atm_stack_drain() * and a token (typically a driver/stack control block) at the front of the * queued buffer. We assume that the function pointer and token values are * both contained (and properly aligned) in the first buffer of the chain. + * The size of these two fields is not accounted for in the packet header + * length field. The packet header itself must be in the first mbuf. * * Arguments: * none @@ -562,16 +564,13 @@ atm_intr(struct mbuf *m) /* * Get function to call and token value */ - KB_DATASTART(m, cp, caddr_t); + cp = mtod(m, caddr_t); func = *(atm_intr_func_t *)cp; cp += sizeof(func); token = *(void **)cp; - KB_HEADADJ(m, -(sizeof(func) + sizeof(token))); - if (KB_LEN(m) == 0) { - KBuffer *m1; - KB_UNLINKHEAD(m, m1); - m = m1; - } + + m->m_len -= sizeof(func) + sizeof(token); + m->m_data += sizeof(func) + sizeof(token); /* * Call processing function -- cgit v1.3