The prepend function did not handle non-pkthdr's correctly.
It always called MH_ALIGN for small lengths being prepended (less than MHLEN). This meant that if you did a prepend on a non M_PKTHDR the system would panic with the KASSERT in MH_ALIGN. Instead we are not aware of this and do a MH_ALIGN or M_ALIGN as appropriate. Reviewed by: andre Approved by: gnn
This commit is contained in:
parent
af0673c204
commit
5288989fac
@ -496,8 +496,13 @@ m_prepend(struct mbuf *m, int len, int how)
|
||||
M_MOVE_PKTHDR(mn, m);
|
||||
mn->m_next = m;
|
||||
m = mn;
|
||||
if (len < MHLEN)
|
||||
MH_ALIGN(m, len);
|
||||
if(m->m_flags & M_PKTHDR) {
|
||||
if (len < MHLEN)
|
||||
MH_ALIGN(m, len);
|
||||
} else {
|
||||
if (len < MLEN)
|
||||
M_ALIGN(m, len);
|
||||
}
|
||||
m->m_len = len;
|
||||
return (m);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user