From f13ffe2ed223f3ed3e4179f86d07445fc1138ff7 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 11 Sep 2008 11:35:42 +0100 Subject: [PATCH 01/10] Make the WAF env available to regression tests --- regression/tests/test-udp-echo.py | 2 +- wscript | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/regression/tests/test-udp-echo.py b/regression/tests/test-udp-echo.py index e3dd72194..46346f5a4 100644 --- a/regression/tests/test-udp-echo.py +++ b/regression/tests/test-udp-echo.py @@ -8,5 +8,5 @@ import tracediff def run(verbose, generate, refDirName): """Execute a test.""" - + #print tracediff.env return tracediff.run_test(verbose, generate, refDirName, "udp-echo") diff --git a/wscript b/wscript index 190f735f2..7a2a2c23f 100644 --- a/wscript +++ b/wscript @@ -815,8 +815,8 @@ def dev_null(): class Regression(object): def __init__(self, testdir): self.testdir = testdir - env = Params.g_build.env_of_name('default') - self.diff = env['DIFF'] + self.env = Params.g_build.env_of_name('default') + self.diff = self.env['DIFF'] def run_test(self, verbose, generate, refDirName, testName, *arguments): refTestDirName = os.path.join(refDirName, (testName + ".ref")) @@ -934,7 +934,7 @@ def run_regression(): print "Done." if not os.path.exists(dir_name): - print "Reference traces directory does not exist" + print "Reference traces directory (%s) does not exist" % dir_name return 3 bad = [] From a4aeb6e815c4daa9e56da21a9fb4cf308aadc061 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 11 Sep 2008 11:44:39 +0100 Subject: [PATCH 02/10] Check for mercurial in configuration stage; also fixes OSError exception when mercurial was not available. --- wscript | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wscript b/wscript index 7a2a2c23f..80a900e47 100644 --- a/wscript +++ b/wscript @@ -272,9 +272,12 @@ def configure(conf): conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in Params.g_options.enable_modules.split(',')] - ## we cannot run regression tests without diff + # we cannot run regression tests without diff conf.find_program('diff', var='DIFF') + # we cannot pull regression traces without mercurial + conf.find_program('hg', var='MERCURIAL') + # Write a summary of optional features status print "---- Summary of optional NS-3 features:" for (name, caption, was_enabled, reason_not_enabled) in conf.env['NS3_OPTIONAL_FEATURES']: @@ -816,7 +819,6 @@ class Regression(object): def __init__(self, testdir): self.testdir = testdir self.env = Params.g_build.env_of_name('default') - self.diff = self.env['DIFF'] def run_test(self, verbose, generate, refDirName, testName, *arguments): refTestDirName = os.path.join(refDirName, (testName + ".ref")) @@ -853,7 +855,7 @@ class Regression(object): if verbose: #diffCmd = "diff traces " + refTestDirName + " | head" - diffCmd = subprocess.Popen([self.diff, "traces", refTestDirName], + diffCmd = subprocess.Popen([self.env['DIFF'], "traces", refTestDirName], stdout=dev_null()) headCmd = subprocess.Popen("head", stdin=diffCmd.stdout) rc2 = headCmd.wait() @@ -861,7 +863,7 @@ class Regression(object): rc1 = diffCmd.wait() rc = rc1 or rc2 else: - rc = subprocess.Popen([self.diff, "traces", refTestDirName], stdout=dev_null()).wait() + rc = subprocess.Popen([self.env['DIFF'], "traces", refTestDirName], stdout=dev_null()).wait() if rc: print "----------" print "Traces differ in test: test-" + testName @@ -907,8 +909,8 @@ def run_regression(): print "========== Running Regression Tests ==========" dir_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX - - if subprocess.Popen(["hg", "version"], stdout=dev_null(), stderr=dev_null()).wait() == 0: + env = Params.g_build.env_of_name('default') + if env['MERCURIAL']: print "Synchronizing reference traces using Mercurial." if not os.path.exists(dir_name): print "Cloning " + REGRESSION_TRACES_REPO + dir_name + " from repo." From 7c2c80af1b9e2fd84f71a0e65623d3fd09fe15f1 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 11 Sep 2008 15:21:19 +0100 Subject: [PATCH 03/10] Check the return value of read(); Fixes #336. --- src/core/random-variable.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/random-variable.cc b/src/core/random-variable.cc index 6a08378b2..6992e0052 100644 --- a/src/core/random-variable.cc +++ b/src/core/random-variable.cc @@ -196,7 +196,9 @@ void RandomVariableBase::GetRandomSeeds(uint32_t seeds[6]) { for (int i = 0; i < 6; ++i) { - read(RandomVariableBase::devRandom, &seeds[i], sizeof(seeds[i])); + ssize_t bytes_read = read (RandomVariableBase::devRandom, + &seeds[i], sizeof (seeds[i])); + NS_ASSERT (bytes_read == sizeof (seeds[i])); } if (RngStream::CheckSeed(seeds)) break; // Got a valid one } From 75cba7225716dfcd2d074bd52d3ac6b1f68573e3 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 11 Sep 2008 09:54:19 -0700 Subject: [PATCH 04/10] Do not assert. Use NS_FATAL_ERROR. --- src/core/random-variable.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/random-variable.cc b/src/core/random-variable.cc index 6992e0052..86c7d5f5b 100644 --- a/src/core/random-variable.cc +++ b/src/core/random-variable.cc @@ -198,7 +198,10 @@ void RandomVariableBase::GetRandomSeeds(uint32_t seeds[6]) { ssize_t bytes_read = read (RandomVariableBase::devRandom, &seeds[i], sizeof (seeds[i])); - NS_ASSERT (bytes_read == sizeof (seeds[i])); + if (bytes_read != sizeof (seeds[i])) + { + NS_FATAL_ERROR ("Read from /dev/random failed"); + } } if (RngStream::CheckSeed(seeds)) break; // Got a valid one } From d82bf3abd61d3f6060959aad427d6f9f973f1493 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 11 Sep 2008 10:08:18 -0700 Subject: [PATCH 05/10] make sample run. --- samples/main-propagation-loss.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/main-propagation-loss.cc b/samples/main-propagation-loss.cc index 2ab140bfa..e86d569bd 100644 --- a/samples/main-propagation-loss.cc +++ b/samples/main-propagation-loss.cc @@ -51,8 +51,8 @@ PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, int main (int argc, char *argv[]) { - Config::SetGlobal ("LogDistancePropagationLossModel::ReferenceDistance", StringValue ("1.0")); - Config::SetGlobal ("LogDistancePropagationLossModel::Exponent", StringValue ("4")); + Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceDistance", StringValue ("1.0")); + Config::SetDefault ("ns3::LogDistancePropagationLossModel::Exponent", StringValue ("4")); PrintOne (-10, 20, 5, 0, 10000, 2); From f5bb4c33024d30644f59204a04907d163f1f42b1 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 11 Sep 2008 11:08:22 -0700 Subject: [PATCH 06/10] bug 333:The Position attribute is not constructable anymore. --- src/devices/wifi/propagation-loss-model.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/devices/wifi/propagation-loss-model.cc b/src/devices/wifi/propagation-loss-model.cc index b9d09ff32..b54e90a0b 100644 --- a/src/devices/wifi/propagation-loss-model.cc +++ b/src/devices/wifi/propagation-loss-model.cc @@ -277,12 +277,10 @@ LogDistancePropagationLossModel::GetLoss (Ptr a, * * rx = rx0(tx) - 10 * n * log (d/d0) */ - static Ptr zero = - CreateObject ("Position", - VectorValue (Vector (0.0, 0.0, 0.0))); - static Ptr reference = - CreateObject ("Position", - VectorValue (Vector (m_referenceDistance, 0.0, 0.0))); + static Ptr zero = CreateObject (); + static Ptr reference = CreateObject (); + zero->SetPosition (Vector (0.0, 0.0, 0.0)); + reference->SetPosition (Vector (m_referenceDistance, 0.0, 0.0)); double ref = m_reference->GetLoss (zero, reference); double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance); double rxc = ref - pathLossDb; From a7f445f46033651843bf34184e00ee6b9a7f9d5f Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 11 Sep 2008 15:32:39 -0700 Subject: [PATCH 07/10] fix bug 338, MTU overflows frameSize --- src/devices/csma/csma-net-device.cc | 48 ++++++++++++------- src/devices/csma/csma-net-device.h | 4 +- .../point-to-point-net-device.cc | 23 ++++++--- .../point-to-point-net-device.h | 4 +- 4 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index db2fc0042..391027d46 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -128,58 +128,64 @@ CsmaNetDevice::DoDispose () NetDevice::DoDispose (); } - uint16_t -CsmaNetDevice::MtuFromFrameSize (uint16_t frameSize) + uint32_t +CsmaNetDevice::MtuFromFrameSize (uint32_t frameSize) { NS_LOG_FUNCTION (frameSize); + NS_ASSERT_MSG (frameSize <= std::numeric_limits::max (), + "CsmaNetDevice::MtuFromFrameSize(): Frame size should be derived from 16-bit quantity: " << frameSize); + + uint32_t newSize; + switch (m_encapMode) { case DIX: - return frameSize - ETHERNET_OVERHEAD; + newSize = frameSize - ETHERNET_OVERHEAD; + break; case LLC: { LlcSnapHeader llc; NS_ASSERT_MSG ((uint32_t)(frameSize - ETHERNET_OVERHEAD) >= llc.GetSerializedSize (), "CsmaNetDevice::MtuFromFrameSize(): Given frame size too small to support LLC mode"); - return frameSize - ETHERNET_OVERHEAD - llc.GetSerializedSize (); + newSize = frameSize - ETHERNET_OVERHEAD - llc.GetSerializedSize (); } + break; case ILLEGAL: default: NS_FATAL_ERROR ("CsmaNetDevice::MtuFromFrameSize(): Unknown packet encapsulation mode"); return 0; } - // - // Prevent compiler from complaining - // - return 0; + + return newSize; } - uint16_t -CsmaNetDevice::FrameSizeFromMtu (uint16_t mtu) + uint32_t +CsmaNetDevice::FrameSizeFromMtu (uint32_t mtu) { NS_LOG_FUNCTION (mtu); + uint32_t newSize; + switch (m_encapMode) { case DIX: - return mtu + ETHERNET_OVERHEAD; + newSize = mtu + ETHERNET_OVERHEAD; + break; case LLC: { LlcSnapHeader llc; - return mtu + ETHERNET_OVERHEAD + llc.GetSerializedSize (); + newSize = mtu + ETHERNET_OVERHEAD + llc.GetSerializedSize (); } + break; case ILLEGAL: default: NS_FATAL_ERROR ("CsmaNetDevice::FrameSizeFromMtu(): Unknown packet encapsulation mode"); return 0; } - // - // Prevent compiler from complaining - // - return 0; + return newSize; } void @@ -207,7 +213,15 @@ CsmaNetDevice::SetMtu (uint16_t mtu) { NS_LOG_FUNCTION (mtu); - m_frameSize = FrameSizeFromMtu (mtu); + uint32_t newFrameSize = FrameSizeFromMtu (mtu); + + if (newFrameSize > std::numeric_limits::max ()) + { + NS_LOG_WARN ("CsmaNetDevice::SetMtu(): Frame size overflow, MTU not set."); + return false; + } + + m_frameSize = newFrameSize; m_mtu = mtu; NS_LOG_LOGIC ("m_encapMode = " << m_encapMode); diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 8a8faafd3..08f25cae5 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -461,13 +461,13 @@ private: * Calculate the value for the MTU that would result from * setting the frame size to the given value. */ - uint16_t MtuFromFrameSize (uint16_t frameSize); + uint32_t MtuFromFrameSize (uint32_t frameSize); /** * Calculate the value for the frame size that would be required * to be able to set the MTU to the given value. */ - uint16_t FrameSizeFromMtu (uint16_t mtu); + uint32_t FrameSizeFromMtu (uint32_t mtu); /** * Start Sending a Packet Down the Wire. diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index a68f72c2b..159d8a004 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -504,20 +504,21 @@ PointToPointNetDevice::GetRemote (void) const return Address (); } - uint16_t -PointToPointNetDevice::MtuFromFrameSize (uint16_t frameSize) + uint32_t +PointToPointNetDevice::MtuFromFrameSize (uint32_t frameSize) { NS_LOG_FUNCTION (frameSize); - + NS_ASSERT_MSG (frameSize <= std::numeric_limits::max (), + "PointToPointNetDevice::MtuFromFrameSize(): Frame size should be derived from 16-bit quantity: " << + frameSize); PppHeader ppp; - NS_ASSERT_MSG ((uint32_t)frameSize >= ppp.GetSerializedSize (), "PointToPointNetDevice::MtuFromFrameSize(): Given frame size too small to support PPP"); return frameSize - ppp.GetSerializedSize (); } - uint16_t -PointToPointNetDevice::FrameSizeFromMtu (uint16_t mtu) + uint32_t +PointToPointNetDevice::FrameSizeFromMtu (uint32_t mtu) { NS_LOG_FUNCTION (mtu); @@ -548,7 +549,15 @@ PointToPointNetDevice::SetMtu (uint16_t mtu) { NS_LOG_FUNCTION (mtu); - m_frameSize = FrameSizeFromMtu (mtu); + uint32_t newFrameSize = FrameSizeFromMtu (mtu); + + if (newFrameSize > std::numeric_limits::max ()) + { + NS_LOG_WARN ("PointToPointNetDevice::SetMtu(): Frame size overflow, MTU not set."); + return false; + } + + m_frameSize = newFrameSize; m_mtu = mtu; NS_LOG_LOGIC ("m_frameSize = " << m_frameSize); diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index a0c755cc9..67636fa71 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -286,13 +286,13 @@ private: * Calculate the value for the MTU that would result from * setting the frame size to the given value. */ - uint16_t MtuFromFrameSize (uint16_t frameSize); + uint32_t MtuFromFrameSize (uint32_t frameSize); /** * Calculate the value for the frame size that would be required * to be able to set the MTU to the given value. */ - uint16_t FrameSizeFromMtu (uint16_t mtu); + uint32_t FrameSizeFromMtu (uint32_t mtu); /** * \returns the address of the remote device connected to this device From d0696fd77639af3b3c62316968152e636cf3afc2 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 12 Sep 2008 10:12:50 -0700 Subject: [PATCH 08/10] release_steps.txt nits --- doc/release_steps.txt | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/doc/release_steps.txt b/doc/release_steps.txt index 0802632fd..f4d666be4 100644 --- a/doc/release_steps.txt +++ b/doc/release_steps.txt @@ -14,23 +14,23 @@ Steps in doing an ns-3 release 4. test dev tarball on release platforms (waf check and maybe some other scripts) 5. once you are happy with the tarball, tag ns-3-dev and ns-3-dev-ref-traces - - hg tag "ns-3.1x" + - hg tag "ns-3.x" - hg push - cd into regression/ns-3-dev-ref-traces - - hg tag "ns-3.1x" + - hg tag "ns-3.x" - hg push 6. clone the tagged ns-3-dev and place it on the repository - ssh code.nsnam.org; sudo tcsh; su code; - cp -r /home/code/repos/ns-3-dev /home/code/repos/ns-3.1x - - cd /home/code/repos/ns-3.1x/.hg and edit the hgrc appropriately: - "description = ns-3.1x release - name = ns-3.1x" + - cd /home/code/repos/ns-3.x/.hg and edit the hgrc appropriately: + "description = ns-3.x release + name = ns-3.x" - clone the ns-3-dev-ref-traces and place it on the repository as above - but use the name ns-3.1x-ref-traces and edit the hgrc appropriately -7. check out a clean version of the new release (ns-3.1x) somewhere + but use the name ns-3.x-ref-traces and edit the hgrc appropriately +7. check out a clean version of the new release (ns-3.x) somewhere 8. Update the VERSION for this new release - change the string 3-dev in the VERSION file to the real version - (e.g. 3.1) This must agree with the version name you chose in the clone + (e.g. 3.2) This must agree with the version name you chose in the clone for the regression tests to work. - hg commit - hg push @@ -46,16 +46,17 @@ Steps in doing an ns-3 release - There should be no regression errors at this time 10. Create final tarballs - ./waf configure; ./waf dist - - this will create an ns-3.1x.tar.bz2 tarball - - this will also create a ns-3.1x-ref-traces.tar.bz2 tarball -11. upload "ns-3.1x.tar.bz2" to the /var/www/html/releases/ directory on + - this will create an ns-3.x.tar.bz2 tarball + - this will also create a ns-3.x-ref-traces.tar.bz2 tarball +11. upload "ns-3.x.tar.bz2" to the /var/www/html/releases/ directory on the www.nsnam.org server - give it 644 file permissions, and user/group = apache -12. upload "ns-3.1x-ref-traces.tar.bz2" to the /var/www/html/releases/ +12. upload "ns-3.x-ref-traces.tar.bz2" to the /var/www/html/releases/ directory on the www.nsnam.org server - give it 644 file permissions, and user/group = apache 13. update web pages on www.nsnam.org (source is in the www/ module) - clone the source repo (hg clone http://code.nsnam.org/www) + - update index.html - add link to news.html - update getting_started.html - update documents.html From 370c7f72150d93fb1b49e92a2390ce26975b926f Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 12 Sep 2008 10:19:40 -0700 Subject: [PATCH 09/10] update RELEASE_NOTES known issues --- RELEASE_NOTES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 5d2a78b08..38f08f90f 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -78,6 +78,8 @@ ns-3 is known to fail on the following platforms: - gcc 3.3 and earlier - optimized builds on gcc 3.4.4 and 3.4.5 - optimized builds on linux x86 gcc 4.0.x + - optimized builds on Ubuntu 8.10 alpha 5 x86 gcc4.3.2 + - MinGW The IPv4 API defined in src/node/ipv4.h is expected to undergo major changes in preparation of the merge of the IPv6 API and implementation. From f51afd386bb1664066edb4209a7a04348ee3084c Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 12 Sep 2008 10:36:57 -0700 Subject: [PATCH 10/10] Added tag ns-3.2-RC2-bis for changeset d783a951f8f5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 57619abe6..64abffec4 100644 --- a/.hgtags +++ b/.hgtags @@ -18,3 +18,4 @@ ea16c44eb90db579c83d3434fc8a960be506a7f5 ns-3.1-RC3 5768685f9fdba9fbf2e9561a840f085142c73575 ns-3.1 dfd634417b8d1896d981b6f44d8f71030611596a ns-3.2-RC1 319eb29611b18998abbad01548825643a8017bcb ns-3.2-RC2 +d783a951f8f5e64b33bc518f0415f76cae1ca6f3 ns-3.2-RC2-bis