> > + if (m->m_len < sizeof(struct greip)) {
> > + m = m_pullup(m, sizeof(struct ip));
>
> Shouldn't we pullup sizeof(struct greip) instead of sizeof(struct ip)?
Oops. Cut'n'paste error.
> I also wonder why we should hit that case in the IPPROTO_GRE case.
> The last thing we do in the IPPROTO_GRE case is:
> M_PREPEND(m, sizeof(struct greip), M_DONTWAIT);
> plus
> if (m == NULL) {
> ...
> goto end;
> }
> So I can't see how it is possible to end up with an mbuf that has less
> then sizeof(struct greip) available.
I had not noticed the M_PREPEND while writing this diff. It makes the
added length check redundant indeed, so this diff should be discarded.
Miod