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", 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; } } diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index 09f7ce099..d04ef5dc2 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -137,11 +137,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); diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index cda479043..2816e5308 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"); @@ -623,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 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():