Bug 2335

Summary: assert failure on PointToPointNetDevice::Send() without NetDeviceQueueInterface
Product: ns-3 Reporter: Hajime Tazaki <tazaki>
Component: point-to-pointAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: major CC: natale.patriciello, stavallo, tomh
Priority: P5    
Version: pre-release   
Hardware: PC   
OS: Linux   
Attachments: patch to fix

Description Hajime Tazaki 2016-03-10 22:40:42 UTC
because DCE uses its own IPv4/IPv6 instances in advanced mode (using Linux/FreeBSD kernel), an example script doesn't call TrafficControlLayer::SetupDevice() called via Ipv4L3Protocol::AddInterface() but it uses NetDevices (e.g. p2p, csma).

and it results with assert failure due to lack of NetDeviceQueueInterface during P2PInterface:Send().

assert failed. cond="m_queueInterface", file=../src/point-to-point/model/point-to-point-net-device.cc, line=535
terminate called without an active exception
Aborted (core dumped)

In src/point-to-point/model/point-to-point-netdevice.cc

   529 bool
   530 PointToPointNetDevice::Send (
   531   Ptr<Packet> packet, 
   532   const Address &dest, 
   533   uint16_t protocolNumber)
   534 {
   535   NS_ASSERT (m_queueInterface);
   536   Ptr<NetDeviceQueue> txq = m_queueInterface->GetTxQueue (0);
   537 

Does this NetDeviceQueue really depend on Layer 3 stuff ? Isn't it possible to handle during p2p device installation ?
Comment 1 Tom Henderson 2016-03-11 11:59:25 UTC
Created attachment 2339 [details]
patch to fix
Comment 2 Tom Henderson 2016-03-11 12:05:29 UTC
> 
> Does this NetDeviceQueue really depend on Layer 3 stuff ? Isn't it possible
> to handle during p2p device installation ?

Fortunately it is easy to relax this assumption for now; patch attached should resolve it.

We can revisit the assumptions concerning whether L3 protocols should be aware of this layer or not (and responsibility for installing this layer) post-release.
Comment 3 natale.patriciello 2016-03-11 12:44:11 UTC
Tom, isn't better to initialize txq to 0? This way, we are sure that the subsequent if does not crash..
Comment 4 Stefano Avallone 2016-03-11 13:56:07 UTC
(In reply to natale.patriciello from comment #3)
> Tom, isn't better to initialize txq to 0? This way, we are sure that the
> subsequent if does not crash..

Is it necessary to initialize a Ptr<> to 0 or is that automatically done?
Comment 5 Tom Henderson 2016-03-11 14:36:02 UTC
(In reply to Stefano Avallone from comment #4)
> (In reply to natale.patriciello from comment #3)
> > Tom, isn't better to initialize txq to 0? This way, we are sure that the
> > subsequent if does not crash..
> 
> Is it necessary to initialize a Ptr<> to 0 or is that automatically done?

It is not necessary; uninitialized Ptr<> will evaluate to 0.
Comment 6 Hajime Tazaki 2016-03-12 15:53:56 UTC
(In reply to Tom Henderson from comment #1)
> Created attachment 2339 [details]
> patch to fix

i confirmed the above patch alleviates the assert in my local tests.  thanks.
Comment 7 Tom Henderson 2016-03-12 19:14:33 UTC
pushed in changeset 14452cf32a37