[Click] [click]SetIPChecksum
Pradeep Pradeep
pradeep_addada at yahoo.co.in
Fri Aug 8 17:05:43 EDT 2008
Hello,
In the code for the element SetIPChecksum element there is part which tests if a packet is IP packet or not.
It uses
---------------------
ip=p->ip_header();
if(!ip)
When can a situation arise which satisfies !ip?
-------------------------
I am genarating packets which have the following format
{IP Header}
{QoS Data}
{UDP Header}
The code I used is
_______________________________
void push(Packet* p)
{
WritablePacket *packet = Packet::make(0, 0, data_len+header_room, 0);
if (packet == 0) {
click_chatter( "cannot make packet!");
packet = NULL;
return;
}
// fill IP header
click_ip *iph = (click_ip*) packet->data();
memcpy(iph, p->ip_header(), sizeof(click_ip));
iph->ip_tos |= 0x0c; // 12 for QoS
iph->ip_tos |= 0x01; // Set ECN capability
// fill QoS fields
QoSSignalFormat* format =
(QoSSignalFormat*)(packet->data()+sizeof(click_ip));
// fill UDP header
click_udp *udph =
(click_udp*)(packet->data()+sizeof(click_ip)+sizeof(struct QoSSignalFormat));
memcpy(udph, p->udp_header(), sizeof(click_udp));
p->kill(); // destroy data packet
output(0).push((Packet *)packet);
}
_______________________________
As you can see I am making some changes to IP header. So I want to recompue the checksum by passing the packets through SetIPChecksum element. When I forward the these packets SetIPChecksum (which is slightly modified that it detects the condtion !ip ) the packets are being struck at this !ip condtion. Please help me with this.
Regards,
Pradeep.
Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
More information about the click
mailing list