[Click] ToDevice(ath0) send: Massage too long

Becholey Alexandre alexandre.becholey at epfl.ch
Thu Dec 9 08:32:05 EST 2010


Hi,

I'm trying to create a click element that add a custom header between the mac header and the ip header. My element has 1 input (ethernet frames) and 1 output (frames with the custom header).
Here is the script:
RatedSource
    -> UDPIPEncap(my_ip, 254, dst_ip, 254)
    -> EtherEncap(...) // I do this just to create some random ethernet frames
    -> Print(1)
    -> MyElement
    -> Print(2)
    -> EtherEncap(0x0800, my_mac, dst_mac)
    -> Print(3)
    -> Queue(2000)
    -> ToDevice(ath0)

Here is what my element does in his push function:
struct my_custom_header my_header;
my_header.n = 1; //an unsigned int
my_header.addr = some_addr; //a struct in_addr
WriteablePacket * encaped_pkt = p->uniqueify();
encaped_pkt->pull(sizeof(click_ether));
encaped_pkt = encaped_pkt->push(sizeof(my_custom_header_t));
memcpy(p->data(), &my_header, sizeof(my_custom_header_t));
output(0).push(p);

With the Prints I can see that my header is correctly written in the packet:
1:    106 | ffffffff ffff0002 6fffff04 08004500 005c0113 0000fa11
2:    100 | 01000000 0a0a0a07 4500005c 01130000 fa11985b 0a0a0a04
3:    114 | ffffffff ffff0002 6fffff04 08000100 00000a0a 0a074500
But then I get the "ToDevice(ath0) send: Message too long"

I'm using click (userlevel) on an assus router running OpenWRT (8.09) with an atheros wifi card (madwifi driver).
When I remove MyElement and the Following EtherEncap in the script, there is no problem (I can sniff the sent frames from another router with tcpdump for example).

Any idee why? It's the first time I encounter this problem. I can without any problem create some packets (Packet::make(...)) and send them.

Alexandre Becholey


More information about the click mailing list