[Click] ToDevice and pkts "too small"

Torquato Bertani torquato at gmail.com
Thu Jul 5 12:43:08 EDT 2007


Hi all,
I found a strange thing in ToDevice element. If I use a configuration
like this one:

FromHost->Classifier(12/806, -)->Queue->ToDevice(eth0); //Send ARP
pkts to ethernet

Click reports the error: ToDevice: too small: len 42 tailroom 4

I know that tailroom is too small to pad the pkt till 60 bytes. In
this case why ToDevice doesn't call the function Packet::put()? This
function will cal Packet::expensive_put() and then everything should
work. I see that ToDevice call tha function skb_put() to pad the pkt
till 60 bytes if tailroom is enough, is right or can be improved
calling Packet::put() ?

I modified the code to use Packet::put() if tailroom isn't enough and
it works but I'd like to know if it's correct or not.

Thanks

Thor

todevice.cc:399
if (!_no_pad && skb1->len < 60) {
        if (skb_tailroom(skb1) < 60 - skb1->len) {
            WritablePacket *q = p->put(60 - skb1->len);
            p = q;       //Is this correct?
//          printk("ToDevice: too small: len %d tailroom %d\n",
//                 skb1->len, skb_tailroom(skb1));
//          kfree_skb(skb1);
//          return -1;
        } else {
                skb_put(skb1, 60 - skb1->len);
        }
    }


More information about the click mailing list