[Click] Problems Modifying Data Poritons of Packets

betamaz betamaz at gmail.com
Thu Aug 11 01:02:30 EDT 2005


Hi,

I worte a new element called RatedPacketGenerator which is based on 
RatedSource. My element basically changes the data portion of a packet based 
on a specific set of rules.
I have a bunch of question. First, in RatedSource the only place the data 
portion is set is in RatedSource::setup_packet(). Also, I noticed that when 
the size of data meets minimum requirement then the element does not use 
pull. So, my only option was to change the data in RatedSource::run_task() 
which is a BIG!!!! waste, since run_task is called way more than the number 
of packets created. Is there any way to imporve this??

Second, when I do change the data portion, I do not see the packet changing 
(when looking at the output of Print) of my configuration:

RatedPacketGenerator(LIMIT 1000, STOP true)
// -> Queue(200)
-> Strip(14)
-> Align(4, 0) // in case we're not on x86
// -> CheckIPHeader(BADSRC 18.26.4.255 <http://18.26.4.255>
2.255.255.255<http://2.255.255.255>
1.255.255.255 <http://1.255.255.255>)
-> Print(PACKET, NBYTES 88, TIMESTAMP true)
-> Counter
-> Discard;


Finally, setting the data portion of the packet in the .cc file (of both 
RatedSource.cc and RatedPacketGenerator.cc) rather than in the configuration 
gives me the following error (after setup_packet finishes): 
[conf]%click packetgen.click
IP header check failed: bad IP version

Which is why is commented out CheckIPHeader from the configuration. I cant 
figure out why its fine when the data is set in the configuration:

RatedSource(DATA \<00 00 c0 ae 67 ef 00 00 00 00 00 00 08 00
45 00 00 28 00 00 00 00 40 11 77 c3 01 00 00 01
02 00 00 02 13 69 13 69 00 14 d6 41 55 44 50 20
70 61 63 6b 65 74 21 0a>, LIMIT 50, STOP true)
// -> Queue(200)
-> Strip(14)
-> Align(4, 0) // in case we're not on x86
-> CheckIPHeader(BADSRC 18.26.4.255 <http://18.26.4.255>
2.255.255.255<http://2.255.255.255>
1.255.255.255 <http://1.255.255.255>)
-> Print(PACKET, NBYTES 88, TIMESTAMP true)
-> Counter
-> Discard;


More information about the click mailing list