Bug 1378 - UdpEchoClient::SetFill (uint8_t *fill, ...) do not set packet size attribute correctly
UdpEchoClient::SetFill (uint8_t *fill, ...) do not set packet size attribute ...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: applications
ns-3.13
All All
: P5 normal
Assigned To: George Riley
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-29 00:32 EST by jesse1013000
Modified: 2012-02-29 22:38 EST (History)
2 users (show)

See Also:


Attachments
UdpEchoClient::SetFill (uint8_t *fill, ...) patch (316 bytes, patch)
2012-02-29 00:32 EST, jesse1013000
Details | Diff
a test case for the patch (2.49 KB, application/octet-stream)
2012-02-29 00:34 EST, jesse1013000
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jesse1013000 2012-02-29 00:32:19 EST
Created attachment 1343 [details]
UdpEchoClient::SetFill (uint8_t *fill, ...)  patch

Function UdpEchoClient::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize) do not set packet size attribute correctly. When "fillSize >= dataSize", m_size is not set.
A solution  is to add statement "m_size = dataSize " before statement "return" in "if (fillSize >= dataSize) { ...}" statement block. 

if (fillSize >= dataSize)
  {
    memcpy (m_data, fill, dataSize);
    m_size = dataSize; // Add this statement
    return;
  }
Comment 1 jesse1013000 2012-02-29 00:34:25 EST
Created attachment 1344 [details]
a test case for the patch

a test case for the patch
Comment 2 Tommaso Pecorella 2012-02-29 12:58:27 EST
He's right.

Either apply the patch or do the same with an else{} and the return removal.

Tommaso
Comment 3 Tom Henderson 2012-02-29 22:38:41 EST
fixed in changeset 7458a10a17d1

Thanks for providing a test case, which I added to the test suite.