[net2-wg] Good result (very slow test)
Rodrigo Fonseca
rfonseca at cs.berkeley.edu
Thu Jun 15 08:58:17 PDT 2006
Hi,
I think the two fixes to the code are :
1. From Phil's second email:
(in Send.send()):
call Packet.setPayloadLength(msg, len + sizeof(network_header_t));
should become
call Packet.setPayloadLength(msg, len);
This seems to be correct, since setPayloadLength already adds the header size.
2. From Phil's first email re: code in ForwardingEngineP.forward()
The code is currently
uint8_t len = call SubPacket.payloadLength(m);
qe->msg = m;
qe->client = 0xff;
call Packet.setPayloadLength(m, len + sizeof(network_header_t));
I don't see the reason for this. Maybe I'm missing something.
len is read from SubPacket. It's the entire length.
The length of Packet is supposed to be that *minus* the network header.
Calling Packet.setPayloadLength has no effect other than setting the
length of the SubPacket to be the argument *plus* the header size.
If the SubPacket length was L, this code has the effect of making it
L+2*sizeof(network_header_t).
It should be only
...
qe->msg = m;
qe->client = 0xff;
...
This code assumes that SubPacket.payload is correct, and that
assumption is enough for everything else to work.
I will test this after the conference call.
Cheers,
Rodrigo
On 6/14/06, Philip Levis <pal at cs.stanford.edu> wrote:
> On Jun 14, 2006, at 7:07 PM, Sukun Kim wrote:
>
> > The packet is longer only when it's more than 1 hop.
>
> This is almost certainly a bug in ForwardingEngineP.forward(), then.
>
> The fact that the difference is 8 bytes is confusing. But I'll hazard
> a guess that these lines are at least part of the culprit:
>
> uint8_t len = call SubPacket.payloadLength(m);
>
> qe->msg = m;
> qe->client = 0xff;
>
> call Packet.setPayloadLength(m, len + sizeof(network_header_t));
>
> It's getting the sub length (which is the full packet length) and
> then adding a network_header_t. The code should either be
>
> qe->msg = m;
> qe->client = 0xff;
>
> call Packet.setPayloadLength(m, call SubPacket.payloadLength(m));
>
> or
>
> uint8_t len = call Packet.payloadLength(m);
>
> qe->msg = m;
> qe->client = 0xff;
>
> call Packet.setPayloadLength(m, len + sizeof(network_header_t));
>
> (the former is probably better).
>
> You might even be able to cut out this code entirely. I'll need to
> think on that, though.
>
> Phil
>
> _______________________________________________
> net2-wg mailing list
> net2-wg at millennium.berkeley.edu
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/net2-wg
>
More information about the net2-wg
mailing list