tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: question about mbuf intialization

In article <>,
Beverly Schwartz  <> wrote:

>Finally, using rump as a way to test kernel code in user space is really
>powerful.  I did a lot of exercising of mbuf code, and initially, I did
>a lot of crashing and burning because I didn't realize that m_len wasn't
>initialized.  This became a pain to deal with - everytime I got an mbuf
>I had to remember to initialize m_len and m_pkthdr.len.  So I just went
>and changed the source code, and this discussion has resulted.

I've been looking at the code and it seems to me that not only m_get()
needs to be changed, but also m_getcl() and MCLGET(). In essence, none
of the allocators currently set m_len or m_pkthdr.len, and they leave
it to the packet formation routines to do so. I am not against setting
the length to 0 by default on construction to make things more robust
(I don't think it makes any performance difference these days); I am
just mentioning that if we do that we should fix it consistently (if
anyone can call the mbuf API consistent...)


Home | Main Index | Thread Index | Old Index