diff options
author | harti <harti@FreeBSD.org> | 2004-02-21 12:55:07 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2004-02-21 12:55:07 +0000 |
commit | a2c86ff9f2c313e81667a1b60883e7c9c6b248de (patch) | |
tree | 1adec56b8d416c89363ee45eb38b4270acc7b6a1 /sys | |
parent | 3325da8ccdc7f58de4150a0632cfb3907766a3f9 (diff) | |
download | FreeBSD-src-a2c86ff9f2c313e81667a1b60883e7c9c6b248de.zip FreeBSD-src-a2c86ff9f2c313e81667a1b60883e7c9c6b248de.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netatm/atm_subr.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/netatm/atm_subr.c b/sys/netatm/atm_subr.c index a2768f3..d816dfd 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 |