Make sure that the first mbuf in the chain passed to atm_intr
always contains a packet header.
This commit is contained in:
parent
962956583e
commit
bf30351bdc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user