[Click] uniqueify problem

Beyers Cronje bcronje at gmail.com
Thu Mar 30 15:07:43 EST 2006


Hi Koen,

Your configuration also assumes that the ip header never includes options. A
more correct way of calculating the ip header length is to use the IP Header
Length field in the header which indicates the number of 32bit words of the
ip header, including any ip header options.

ipheaderlen = ip->ip_hl << 2;

Cheers

Beyers

On 3/30/06, Jason Haas <jjhaas at gmail.com> wrote:
>
> 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
> >
> >
> >
> >
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list