netdev
[Top] [All Lists]

Re: skb_pull, etc. panics.

To: Richard Guy Briggs <rgb@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: skb_pull, etc. panics.
From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Wed, 13 Jun 2001 09:15:40 -0700
Cc: Andi Kleen <ak@xxxxxx>, netdev@xxxxxxxxxxx
Organization: Candela Technologies
References: <20010606141145.L31244@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20010613032126.B5323@xxxxxxxxxx> <20010613115848.A19894@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
Richard Guy Briggs wrote:
> 
> On Wed, Jun 13, 2001 at 03:21:26AM +0200, Andi Kleen wrote:
> > On Wed, Jun 06, 2001 at 08:11:45PM +0200, Richard Guy Briggs wrote:
> > > Hi again,
> > >
> > > If this is an FAQ, can someone point me to the reasons that skb_push()
> > > and skb_put() panic rather than dropping the skb and complaining in the
> > > log?
> > >
> > > If not, why does it do that?
> >
> > Because an overflow or underflow is always a bug in the code. If you're
> > not sure if the skb has enough room you have to use *_expand_headroom and
> > friends.
> 
> ...so checking for it is considered debugging code and thus, overhead
> that need not be in a production system?

In certain cases you may have to clone and grow the skb.  But, since that
is inneficient, you should only do that in wierd boundary cases at most,
and in general, you should make sure the skb has enough reserved space
from the beginning.  netdevice.h has some macro magic that figures out
the max-header (ie what to reserve).  If you can determine how much you
need, you can change it there...

Ben

-- 
Ben Greear <greearb@xxxxxxxxxxxxxxx>          <Ben_Greear@xxxxxxxxxx>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

<Prev in Thread] Current Thread [Next in Thread>