Bug 287

Summary: Simple device/channel call stack issue
Product: ns-3 Reporter: Rajib Bhattacharjea <raj.b>
Component: devicesAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: ns-3.1   
Hardware: All   
OS: All   
Attachments: ScheduleNow instead of calling up the rx side

Description Rajib Bhattacharjea 2008-08-14 20:51:21 EDT
The SimpleChannel and SimpleNetDevice are forwarding devices such that SimpleNetDevice::Send calls SimpleChannel::Send, which calls SimpleNetDevice::Receive on the other end.  This means that the call stack resulting from invoking a Scheduler event can contain all the calls down the network stack AND all the upcalls up the network stack on the other side.  So potentially, packets can be received at the other node before the state on the sender side has been fully updated to reflect having sent the data.  E.g. in the case of TCP, the ACK comes back before the call to Socket::Send completes, wreaking havoc.

There is a potential stack overflow issue as well if both sides send data back in response.

It seems to make sense to break this call stack issue at the line between the Channel::Send and the NetDevice::Receive on the other end.  The NetDevice::Receive could be scheduled with Simulator::ScheduleNow(...) so that it logically occurs at the "now" time, but allows the call stack to unravel up to the next Scheduler event.
Comment 1 Rajib Bhattacharjea 2008-08-14 20:55:42 EDT
Created attachment 229 [details]
ScheduleNow instead of calling up the rx side

Is it just this easy?  Anyone opposed to pushing this?
Comment 2 Mathieu Lacage 2008-08-15 01:43:47 EDT
(In reply to comment #1)
> Created an attachment (id=229) [details]
> ScheduleNow instead of calling up the rx side
> 
> Is it just this easy?  Anyone opposed to pushing this?


looks good to me.

Comment 3 Rajib Bhattacharjea 2008-08-15 11:40:56 EDT
fixed
3534:e170f2c17e03