[Click] uniqueify problem

Jason Haas jjhaas at gmail.com
Thu Mar 30 14:00:53 EST 2006


Hi Koen,

You can try adding Print elements before your element to verify where the
mismatch is.  Also, you can try adding debug statements to your code and
print out the pointers to verify they point to where you think they should.
You could also save your cast to char* by using ->network_header() instead
of ->ip_header().  If the network header annotation isn't set to be an IP
header for some reason, that switch could help.

Jason Haas

On 3/27/06, Koen Segers <KoenSegers at scarlet.be> wrote:
>
> 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
>
>
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
>
>
>


More information about the click mailing list