Bug 1378

Summary: UdpEchoClient::SetFill (uint8_t *fill, ...) do not set packet size attribute correctly
Product: ns-3 Reporter: jesse1013000
Component: applicationsAssignee: George Riley <riley>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, tomh
Priority: P5    
Version: ns-3.13   
Hardware: All   
OS: All   
Attachments: UdpEchoClient::SetFill (uint8_t *fill, ...) patch
a test case for the patch

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.