diff -ur ns-3.7/src/internet-stack/ipv4-l3-protocol.cc ns-3-804/src/internet-stack/ipv4-l3-protocol.cc --- ns-3.7/src/internet-stack/ipv4-l3-protocol.cc 2010-01-28 15:17:45.000000000 -0800 +++ ns-3-804/src/internet-stack/ipv4-l3-protocol.cc 2010-02-03 08:29:13.000000000 -0800 @@ -603,7 +603,15 @@ Socket::SocketErrno errno_; Ptr oif (0); // unused for now ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment); - Ptr newRoute = m_routingProtocol->RouteOutput (packet, ipHeader, oif, errno_); + Ptr newRoute; + if (m_routingProtocol != 0) + { + newRoute = m_routingProtocol->RouteOutput (packet, ipHeader, oif, errno_); + } + else + { + NS_LOG_ERROR ("Ipv4L3Protocol::Send: m_routingProtocol == 0"); + } if (newRoute) { int32_t interface = GetInterfaceForDevice (newRoute->GetOutputDevice ()); diff -ur ns-3.7/src/internet-stack/tcp-l4-protocol.cc ns-3-804/src/internet-stack/tcp-l4-protocol.cc --- ns-3.7/src/internet-stack/tcp-l4-protocol.cc 2010-01-28 15:17:45.000000000 -0800 +++ ns-3-804/src/internet-stack/tcp-l4-protocol.cc 2010-02-03 08:15:47.000000000 -0800 @@ -584,7 +584,15 @@ Socket::SocketErrno errno_; Ptr route; Ptr oif (0); //specify non-zero if bound to a source address - route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); + if (ipv4->GetRoutingProtocol () != 0) + { + route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); + } + else + { + NS_LOG_ERROR ("No IPV4 Routing Protocol"); + route = 0; + } ipv4->Send (packet, saddr, daddr, PROT_NUMBER, route); } } @@ -623,7 +631,15 @@ header.SetProtocol (PROT_NUMBER); Socket::SocketErrno errno_; Ptr route; - route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); + if (ipv4->GetRoutingProtocol () != 0) + { + route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); + } + else + { + NS_LOG_ERROR ("No IPV4 Routing Protocol"); + route = 0; + } ipv4->Send (packet, saddr, daddr, PROT_NUMBER, route); } else diff -ur ns-3.7/src/internet-stack/tcp-socket-impl.cc ns-3-804/src/internet-stack/tcp-socket-impl.cc --- ns-3.7/src/internet-stack/tcp-socket-impl.cc 2010-01-28 15:17:45.000000000 -0800 +++ ns-3-804/src/internet-stack/tcp-socket-impl.cc 2010-02-03 10:15:03.000000000 -0800 @@ -1132,6 +1132,11 @@ { return false; // No data exists } + if (m_endPoint == 0) + { + NS_LOG_INFO ("TcpSocketImpl::SendPendingData: No endpoint; m_shutdownSend=" << m_shutdownSend); + return false; // Is this the right way to handle this condition? + } uint32_t nPacketsSent = 0; while (m_pendingData->SizeFromSeq (m_firstPendingSequence, m_nextTxSequence)) { @@ -1181,7 +1186,7 @@ if (m_shutdownSend) { m_errno = ERROR_SHUTDOWN; - return -1; + return false; }