SCCS-vsn: sys/kern/uipc_mbuf.c 8.4
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)uipc_mbuf.c 8.3 (Berkeley) %G%
+ * @(#)uipc_mbuf.c 8.4 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
struct mbuf *mbutl;
char *mclrefcnt;
struct mbuf *mbutl;
char *mclrefcnt;
-#if CLBYTES < 4096
-#define NCL_INIT (4096/CLBYTES)
-#else
-#define NCL_INIT 1
-#endif
- if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0)
+ if (m_clalloc(max(4096/CLBYTES, 1), M_DONTWAIT) == 0)
goto bad;
splx(s);
return;
goto bad;
splx(s);
return;
* Must be called at splimp.
*/
/* ARGSUSED */
* Must be called at splimp.
*/
/* ARGSUSED */
m_clalloc(ncl, nowait)
register int ncl;
int nowait;
m_clalloc(ncl, nowait)
register int ncl;
int nowait;
m_reclaim()
{
register struct domain *dp;
m_reclaim()
{
register struct domain *dp;
* Copy data from an mbuf chain starting "off" bytes from the beginning,
* continuing for "len" bytes, into the indicated buffer.
*/
* Copy data from an mbuf chain starting "off" bytes from the beginning,
* continuing for "len" bytes, into the indicated buffer.
*/
m_copydata(m, off, len, cp)
register struct mbuf *m;
register int off;
m_copydata(m, off, len, cp)
register struct mbuf *m;
register int off;
* Both chains must be of the same type (e.g. MT_DATA).
* Any m_pkthdr is not updated.
*/
* Both chains must be of the same type (e.g. MT_DATA).
* Any m_pkthdr is not updated.
*/
m_cat(m, n)
register struct mbuf *m, *n;
{
m_cat(m, n)
register struct mbuf *m, *n;
{
cp = buf;
epkt = cp + totlen;
if (off) {
cp = buf;
epkt = cp + totlen;
if (off) {
- cp += off + 2 * sizeof(u_short);
- totlen -= 2 * sizeof(u_short);
+ /*
+ * If 'off' is non-zero, packet is trailer-encapsulated,
+ * so we have to skip the type and length fields.
+ */
+ cp += off + 2 * sizeof(u_int16_t);
+ totlen -= 2 * sizeof(u_int16_t);
}
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
}
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)