[Click] uniqueify problem

Koen Segers KoenSegers at scarlet.be
Mon Mar 27 18:06:25 EST 2006


Hi,

I need to change only 1 field of a packet. I read that packet->uniqueify casts 
the packet to a writeable packet. I can write to the packet now, but 
according to ethereal the bits are 28 bytes placed to far. I believe it has 
to do with the length of an ip/udp, but I can't find out how to solve it.

Can somebody help me?


Usual way to get the PDHCPMessage:
PDHCPMessage *pdhcp_message = (PDHCPMessage*)(((char *) 
p->ip_header())+sizeof(click_ip)+sizeof(click_udp)); with p the packet* from 
push.

When changing a value of PDHCPMessage:
WritablePacket *writeable = p->uniqueify();
PDHCPMessage *newmessage = (PDHCPMessage*)(((char*) 
writeable->ip_header())+sizeof(click_ip)+sizeof(click_udp));

...write to newmessage...

output(0).push(writeable);
-- 

Koen Segers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : https://amsterdam.lcs.mit.edu/pipermail/click/attachments/20060327/cbf13fe6/attachment.pgp


More information about the click mailing list