From cf3d63ffce29a9f9302edaacf19301d0829e4fda Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 13 May 2008 01:04:42 +0100 Subject: [PATCH 1/6] WAF: add uselib_local to the ns3 library to pull in library dependencies from the ns-3 modules into the main library. --- wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wscript b/wscript index 0eeaac12a..6cc76a904 100644 --- a/wscript +++ b/wscript @@ -303,8 +303,10 @@ def build(bld): lib.target = 'ns3' if env['NS3_ENABLED_MODULES']: lib.add_objects = list(modules) + lib.uselib_local = list(modules) else: lib.add_objects = list(env['NS3_MODULES']) + lib.uselib_local = list(env['NS3_MODULES']) def get_command_template(): From c227e133ed61daf7a35fc158e74748bebdf1ba0b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 14 May 2008 09:37:00 -0700 Subject: [PATCH 2/6] update pcap trace setup filename --- examples/mixed-wireless.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/mixed-wireless.cc b/examples/mixed-wireless.cc index 05dbcf0a4..baf9a2836 100644 --- a/examples/mixed-wireless.cc +++ b/examples/mixed-wireless.cc @@ -339,9 +339,9 @@ main (int argc, char *argv[]) CsmaHelper::EnableAsciiAll (ascii); // Let's do a pcap trace on the backbone devices - WifiHelper::EnablePcap ("mixed-wireless.pcap", backboneDevices); + WifiHelper::EnablePcap ("mixed-wireless", backboneDevices); // Let's additionally trace the application Sink, ifIndex 0 - CsmaHelper::EnablePcap ("mixed-wireless.pcap", appSink->GetId (), 0); + CsmaHelper::EnablePcap ("mixed-wireless", appSink->GetId (), 0); #ifdef ENABLE_FOR_TRACING_EXAMPLE Config::Connect ("/NodeList/*/$MobilityModelNotifier/CourseChange", From 4b558ec06500d9ca4244a3c9d80c542df8190205 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 14 May 2008 18:15:26 +0100 Subject: [PATCH 3/6] Missing Packet::Copy in Node::ReceiveFromDevice for the multiple protocol handlers scenario. --- src/node/node.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node/node.cc b/src/node/node.cc index 456e13a95..ef56ec6db 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -186,6 +186,11 @@ Node::ReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from) { bool found = false; + // if there are (potentially) multiple handlers, we need to copy the + // packet before passing it to each handler, because handlers may + // modify it. + bool copyNeeded = (m_handlers.size () > 1); + for (ProtocolHandlerList::iterator i = m_handlers.begin (); i != m_handlers.end (); i++) { @@ -195,7 +200,7 @@ Node::ReceiveFromDevice (Ptr device, Ptr packet, if (i->protocol == 0 || i->protocol == protocol) { - i->handler (device, packet, protocol, from); + i->handler (device, (copyNeeded ? packet->Copy () : packet), protocol, from); found = true; } } From bf1c46e9d86ace6ec9def2e8930b17832e54b86c Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 14 May 2008 19:15:00 +0100 Subject: [PATCH 4/6] PacketSocket bind-to-interface bug --- src/node/packet-socket.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index 7d3578475..f45690ecf 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -111,11 +111,11 @@ PacketSocket::DoBind (const PacketSocketAddress &address) Ptr dev ; if (address.IsSingleDevice ()) { - dev = 0; + dev = m_node->GetDevice (address.GetSingleDevice ()); } else { - dev = m_node->GetDevice (address.GetSingleDevice ()); + dev = 0; } m_node->RegisterProtocolHandler (MakeCallback (&PacketSocket::ForwardUp, this), address.GetProtocol (), dev); From 84b9842a1b6c58b5a16fcfdfa738c79ca3892f0f Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 15 May 2008 12:54:28 +0100 Subject: [PATCH 5/6] GlobalRoutingManager: don't abort with non-IP NetDevices, just skip them. --- .../global-routing/global-router-interface.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index cda479043..5f8f8ccf2 100644 --- a/src/routing/global-routing/global-router-interface.cc +++ b/src/routing/global-routing/global-router-interface.cc @@ -533,6 +533,21 @@ GlobalRouter::DiscoverLSAs (void) { Ptr ndLocal = node->GetDevice(i); + // Check if it is an IP interface (could be a pure L2 NetDevice) + bool isIp = false; + for (uint32_t i = 0; i < ipv4Local->GetNInterfaces (); ++i ) + { + if (ipv4Local->GetNetDevice (i) == ndLocal) + { + isIp = true; + break; + } + } + if (!isIp) + { + continue; + } + if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () ) { NS_LOG_LOGIC ("Broadcast link"); From afd6db2ccbd52ffa71f3973322ca0f45a625f8cf Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 15 May 2008 12:56:10 +0100 Subject: [PATCH 6/6] GlobalRoutingManager: don't segfault for NetDevices that have no associated Channel (e.g. virtual NetDevices); just skip them. --- src/routing/global-routing/global-router-interface.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index 5f8f8ccf2..2816e5308 100644 --- a/src/routing/global-routing/global-router-interface.cc +++ b/src/routing/global-routing/global-router-interface.cc @@ -638,6 +638,10 @@ GlobalRouter::DiscoverLSAs (void) // router (to use OSPF lingo) is running. // Ptr ch = ndLocal->GetChannel(); + if (ch == NULL) + { + continue; + } Ptr ndRemote = GetAdjacent(ndLocal, ch); // // The adjacent net device is aggregated to a node. We need to ask that net