From 6c0d5166e8d42e53c618d580a5ffd459b22797e5 Mon Sep 17 00:00:00 2001 From: Mitch Watrous Date: Fri, 15 Apr 2011 13:03:02 -0700 Subject: [PATCH 1/3] Make examples that were in samples directory run --- src/{network => core}/examples/main-test-sync.cc | 0 src/core/examples/wscript | 6 +++++- src/core/test/examples-to-run.py | 10 +++++++++- src/core/wscript | 3 +++ src/internet/test/examples-to-run.py | 1 + src/internet/wscript | 3 +++ src/mobility/test/examples-to-run.py | 3 +++ src/mobility/wscript | 3 +++ src/network/examples/wscript | 8 ++------ src/network/test/examples-to-run.py | 2 ++ src/network/wscript | 3 +++ src/propagation/test/examples-to-run.py | 1 + src/propagation/wscript | 3 +++ test.py | 2 ++ 14 files changed, 40 insertions(+), 8 deletions(-) rename src/{network => core}/examples/main-test-sync.cc (100%) diff --git a/src/network/examples/main-test-sync.cc b/src/core/examples/main-test-sync.cc similarity index 100% rename from src/network/examples/main-test-sync.cc rename to src/core/examples/main-test-sync.cc diff --git a/src/core/examples/wscript b/src/core/examples/wscript index 6de106202..da239037e 100644 --- a/src/core/examples/wscript +++ b/src/core/examples/wscript @@ -4,7 +4,7 @@ def build(bld): if not bld.env['ENABLE_EXAMPLES']: return; - obj = bld.create_ns3_program('main-attribute-value', ['core', 'node', 'devices/point-to-point']) + obj = bld.create_ns3_program('main-attribute-value', ['network', 'point-to-point']) obj.source = 'main-attribute-value.cc' obj = bld.create_ns3_program('main-callback', ['core']) @@ -23,3 +23,7 @@ def build(bld): ['core']) obj.source = 'sample-random-variable.cc' + if bld.env['ENABLE_THREADING'] and bld.env["ENABLE_REAL_TIME"]: + obj = bld.create_ns3_program('main-test-sync', ['network']) + obj.source = 'main-test-sync.cc' + diff --git a/src/core/test/examples-to-run.py b/src/core/test/examples-to-run.py index cb0a204e8..23cf2c0f7 100644 --- a/src/core/test/examples-to-run.py +++ b/src/core/test/examples-to-run.py @@ -8,6 +8,12 @@ # # See test.py for more information. cpp_examples = [ + ("main-attribute-value", "True", "True"), + ("main-callback", "True", "True"), + ("sample-simulator", "True", "True"), + ("main-ptr", "True", "True"), + ("main-random-variable", "True", "True"), + ("sample-random-variable", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain @@ -16,4 +22,6 @@ cpp_examples = [ # (example_name, do_run). # # See test.py for more information. -python_examples = [] +python_examples = [ + ("sample-simulator.py", "True"), +] diff --git a/src/core/wscript b/src/core/wscript index e288f20cc..a70506729 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -292,6 +292,9 @@ def build(bld): core_test.uselib = core_test.uselib + ' GSL GSLCBLAS M' core_test.source.extend(['test/rng-test-suite.cc']) + if (bld.env['ENABLE_EXAMPLES']): + bld.add_subdirs('examples') + pymod = bld.ns3_python_bindings() if pymod is not None: pymod.source += ['bindings/module_helpers.cc'] diff --git a/src/internet/test/examples-to-run.py b/src/internet/test/examples-to-run.py index cb0a204e8..9fafb8ba9 100644 --- a/src/internet/test/examples-to-run.py +++ b/src/internet/test/examples-to-run.py @@ -8,6 +8,7 @@ # # See test.py for more information. cpp_examples = [ + ("main-simple", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/internet/wscript b/src/internet/wscript index 7432d8b12..7649c59b5 100644 --- a/src/internet/wscript +++ b/src/internet/wscript @@ -283,5 +283,8 @@ def build(bld): obj.uselib = 'DL' internet_test.uselib = 'DL' + if (bld.env['ENABLE_EXAMPLES']): + bld.add_subdirs('examples') + bld.ns3_python_bindings() diff --git a/src/mobility/test/examples-to-run.py b/src/mobility/test/examples-to-run.py index cb0a204e8..d7c34d0c4 100644 --- a/src/mobility/test/examples-to-run.py +++ b/src/mobility/test/examples-to-run.py @@ -8,6 +8,9 @@ # # See test.py for more information. cpp_examples = [ + ("main-grid-topology", "True", "True"), + ("main-random-topology", "True", "True"), + ("main-random-walk", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/mobility/wscript b/src/mobility/wscript index b065ae20c..da6f3fbd1 100644 --- a/src/mobility/wscript +++ b/src/mobility/wscript @@ -53,4 +53,7 @@ def build(bld): 'helper/ns2-mobility-helper.h', ] + if (bld.env['ENABLE_EXAMPLES']): + bld.add_subdirs('examples') + bld.ns3_python_bindings() diff --git a/src/network/examples/wscript b/src/network/examples/wscript index 4839ee55c..6bd430683 100644 --- a/src/network/examples/wscript +++ b/src/network/examples/wscript @@ -4,13 +4,9 @@ def build(bld): if not bld.env['ENABLE_EXAMPLES']: return; - obj = bld.create_ns3_program('main-packet-header', ['common', 'core']) + obj = bld.create_ns3_program('main-packet-header', ['network']) obj.source = 'main-packet-header.cc' - obj = bld.create_ns3_program('main-packet-tag', ['common', 'core']) + obj = bld.create_ns3_program('main-packet-tag', ['network']) obj.source = 'main-packet-tag.cc' - if bld.env['ENABLE_THREADING'] and bld.env["ENABLE_REAL_TIME"]: - obj = bld.create_ns3_program('main-test-sync') - obj.source = 'main-test-sync.cc' - diff --git a/src/network/test/examples-to-run.py b/src/network/test/examples-to-run.py index cb0a204e8..a9647ae79 100644 --- a/src/network/test/examples-to-run.py +++ b/src/network/test/examples-to-run.py @@ -8,6 +8,8 @@ # # See test.py for more information. cpp_examples = [ + ("main-packet-header", "True", "True"), + ("main-packet-tag", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/network/wscript b/src/network/wscript index a70120c6e..fa1ea3fa0 100644 --- a/src/network/wscript +++ b/src/network/wscript @@ -126,4 +126,7 @@ def build(bld): 'helper/trace-helper.h', ] + if (bld.env['ENABLE_EXAMPLES']): + bld.add_subdirs('examples') + bld.ns3_python_bindings() diff --git a/src/propagation/test/examples-to-run.py b/src/propagation/test/examples-to-run.py index cb0a204e8..cdd23245d 100644 --- a/src/propagation/test/examples-to-run.py +++ b/src/propagation/test/examples-to-run.py @@ -8,6 +8,7 @@ # # See test.py for more information. cpp_examples = [ + ("main-propagation-loss", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/propagation/wscript b/src/propagation/wscript index d3d4918b9..df7d068e4 100644 --- a/src/propagation/wscript +++ b/src/propagation/wscript @@ -24,4 +24,7 @@ def build(bld): 'model/cost231-propagation-loss-model.h', ] + if (bld.env['ENABLE_EXAMPLES']): + bld.add_subdirs('examples') + bld.ns3_python_bindings() diff --git a/test.py b/test.py index 3b300bda4..8c038b246 100755 --- a/test.py +++ b/test.py @@ -47,6 +47,7 @@ interesting_config_items = [ "NS3_MODULE_PATH", "NSC_ENABLED", "ENABLE_REAL_TIME", + "ENABLE_THREADING", "ENABLE_EXAMPLES", "EXAMPLE_DIRECTORIES", "ENABLE_PYTHON_BINDINGS", @@ -56,6 +57,7 @@ interesting_config_items = [ NSC_ENABLED = False ENABLE_REAL_TIME = False +ENABLE_THREADING = False ENABLE_EXAMPLES = True ENABLE_CLICK = False ENABLE_OPENFLOW = False From 338eb5423340b409b46e6685fccf5aa911ab68ad Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 15 Apr 2011 15:45:50 -0700 Subject: [PATCH 2/3] bug 1046: Check AODV LocalDeliver callback before using it --- RELEASE_NOTES | 1 + src/aodv/model/aodv-routing-protocol.cc | 31 +++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index c3ca9b996..aa809422e 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -30,6 +30,7 @@ since ns-3.10, in many cases referencing the Bugzilla bug number. - Fixed the UanPhyGen::IsStateBusy method, error with logical OR - CsmaNetDevice ReceiveErrorModel was not dropping the packet - bug 1064 - Correct Friis propagation loss equation in spectrum module + - bug 1046 - Check Aodv LocalDeliver callback before using it Known issues ------------ diff --git a/src/aodv/model/aodv-routing-protocol.cc b/src/aodv/model/aodv-routing-protocol.cc index 2217d176f..6e04447fa 100644 --- a/src/aodv/model/aodv-routing-protocol.cc +++ b/src/aodv/model/aodv-routing-protocol.cc @@ -385,6 +385,12 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header, if (IsMyOwnAddress (origin)) return true; + // AODV is not a multicast routing protocol + if (dst.IsMulticast ()) + { + return false; + } + // Broadcast local delivery/forwarding for (std::map , Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j) @@ -399,9 +405,18 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header, return true; } UpdateRouteLifeTime (origin, ActiveRouteTimeout); - NS_LOG_LOGIC ("Broadcast local delivery to " << iface.GetLocal ()); Ptr packet = p->Copy (); - lcb (p, header, iif); + if (lcb.IsNull () == false) + { + NS_LOG_LOGIC ("Broadcast local delivery to " << iface.GetLocal ()); + lcb (p, header, iif); + // Fall through to additional processing + } + else + { + NS_LOG_ERROR ("Unable to deliver packet locally due to null callback " << p->GetUid () << " from " << origin); + ecb (p, header, Socket::ERROR_NOROUTETOHOST); + } if (!EnableBroadcast) { return true; @@ -438,8 +453,16 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header, UpdateRouteLifeTime (toOrigin.GetNextHop (), ActiveRouteTimeout); m_nb.Update (toOrigin.GetNextHop (), ActiveRouteTimeout); } - NS_LOG_LOGIC ("Unicast local delivery to " << dst); - lcb (p, header, iif); + if (lcb.IsNull () == false) + { + NS_LOG_LOGIC ("Unicast local delivery to " << dst); + lcb (p, header, iif); + } + else + { + NS_LOG_ERROR ("Unable to deliver packet locally due to null callback " << p->GetUid () << " from " << origin); + ecb (p, header, Socket::ERROR_NOROUTETOHOST); + } return true; } From c3ebf91792ac32bb1d15c2b8deee501dfa58552f Mon Sep 17 00:00:00 2001 From: Mitch Watrous Date: Fri, 15 Apr 2011 16:03:28 -0700 Subject: [PATCH 3/3] Move example from core to point-to-point --- src/core/examples/wscript | 3 --- .../examples/main-attribute-value.cc | 0 src/point-to-point/examples/wscript | 8 ++++++++ src/point-to-point/wscript | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) rename src/{core => point-to-point}/examples/main-attribute-value.cc (100%) create mode 100644 src/point-to-point/examples/wscript diff --git a/src/core/examples/wscript b/src/core/examples/wscript index da239037e..6e6f04315 100644 --- a/src/core/examples/wscript +++ b/src/core/examples/wscript @@ -4,9 +4,6 @@ def build(bld): if not bld.env['ENABLE_EXAMPLES']: return; - obj = bld.create_ns3_program('main-attribute-value', ['network', 'point-to-point']) - obj.source = 'main-attribute-value.cc' - obj = bld.create_ns3_program('main-callback', ['core']) obj.source = 'main-callback.cc' diff --git a/src/core/examples/main-attribute-value.cc b/src/point-to-point/examples/main-attribute-value.cc similarity index 100% rename from src/core/examples/main-attribute-value.cc rename to src/point-to-point/examples/main-attribute-value.cc diff --git a/src/point-to-point/examples/wscript b/src/point-to-point/examples/wscript new file mode 100644 index 000000000..8f561292e --- /dev/null +++ b/src/point-to-point/examples/wscript @@ -0,0 +1,8 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + if not bld.env['ENABLE_EXAMPLES']: + return; + + obj = bld.create_ns3_program('main-attribute-value', ['network', 'point-to-point']) + obj.source = 'main-attribute-value.cc' diff --git a/src/point-to-point/wscript b/src/point-to-point/wscript index 2bc41aa29..ce8faa742 100644 --- a/src/point-to-point/wscript +++ b/src/point-to-point/wscript @@ -26,4 +26,7 @@ def build(bld): 'helper/point-to-point-helper.h', ] + if (bld.env['ENABLE_EXAMPLES']): + bld.add_subdirs('examples') + bld.ns3_python_bindings()