[Click] uniqueify problem

Eddie Kohler kohler at cs.ucla.edu
Thu Mar 30 16:34:47 EST 2006


Koen,

Does the IP header have options?

If you've set up the IP header annotation correctly, then you would  
say something like

PDHCPMessage *phdcp_message = (PDHCPMessage *)(p->transport_header()  
+ sizeof(click_udp));

The IP header annotation takes care of any possible IP header options.

28 is a highly suspicious number, though.... Maybe later in the  
configuration, you are RE-ENCAPSULATING this DHCP message in ANTOHER  
IP/UDP header pair?


Eddie


On Mar 27, 2006, at 3:06 PM, Koen Segers 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