Bug 1069

Summary: ApWifiMac unduly calls RegularWifiMac::Receive and crashes
Product: ns-3 Reporter: Francesco Malandrino <francesco.malandrino>
Component: wifiAssignee: Dean Armstrong <deanarm>
Status: RESOLVED FIXED    
Severity: major CC: nicola, ns-bugs, ruben, sertinell
Priority: P5    
Version: ns-3.10   
Hardware: PC   
OS: All   
Attachments: First draft patch

Description Francesco Malandrino 2011-03-09 09:41:04 EST
In a scenario with overlapping AP coverage areas, it is often the case that an AP hears a packet sent from a station to another AP. In this case, ApWifiMac::Receive calls RegularWifiMac::Receive (src/devices/wifi/ap-wifi-mac:538), which in turn crashes (src/devices/wifi/regular-wifi-mac.cc:504).

Commenting src/devices/wifi/ap-wifi-mac:538 fixes the issue (and apparently produces no other damage); however, a clean solution would probably be explicitly discarding the packets directed to another AP in ApWifiMac::Receive.

I am setting the severity as "major" beacuse this causes ns-3 to spectacularly fail where AP coverage areas overlap, which is a scenario of interest for, e.g., "green" stuff.
Comment 1 Dean Armstrong 2011-03-10 06:30:44 EST
Created attachment 1039 [details]
First draft patch

Thanks for reporting this, Francesco. It is, indeed, a major oversight.

I've attached a proposed patch for this based on head of ns-3-dev. Could you confirm that this makes things work sensibly in your case?

Comments on the approach taken are welcome.

Thanks,
Dean.
Comment 2 Francesco Malandrino 2011-03-10 07:39:38 EST
The attached patch seems to work.

Francesco
Comment 3 Nicola Baldo 2011-03-28 10:23:25 EDT
*** Bug 1080 has been marked as a duplicate of this bug. ***
Comment 4 Nicola Baldo 2011-03-28 10:35:36 EDT
Dean, thanks for the patch. I am fine with it, except that I would not call NotifyRxDrop in the newly added case. I think the packet should be silently discarded. Other devices (e.g., CSMA) behave this way with packets not addressed to self.

Sergio, can you confirm that Dean's patch solves your problem?
Comment 5 Ruben Merz 2011-04-01 08:04:49 EDT
(In reply to comment #4)
> Dean, thanks for the patch. I am fine with it, except that I would not call
> NotifyRxDrop in the newly added case. I think the packet should be silently
> discarded. Other devices (e.g., CSMA) behave this way with packets not
> addressed to self.

I agree. But will it be captured elsewhere by the "monitor" mode (for pcap tracing?)
 
> Sergio, can you confirm that Dean's patch solves your problem?
Comment 6 Nicola Baldo 2011-04-03 14:06:07 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > Dean, thanks for the patch. I am fine with it, except that I would not call
> > NotifyRxDrop in the newly added case. I think the packet should be silently
> > discarded. Other devices (e.g., CSMA) behave this way with packets not
> > addressed to self.
> 
> I agree. But will it be captured elsewhere by the "monitor" mode (for pcap
> tracing?)
> 

yes, NotifyPromiscSniffRx () is called in YansWifiPhy::EndReceive (), hence all the packets that are received correctly by the phy will end up in the pcap trace.
Comment 7 Ruben Merz 2011-04-03 15:59:09 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > Dean, thanks for the patch. I am fine with it, except that I would not call
> > > NotifyRxDrop in the newly added case. I think the packet should be silently
> > > discarded. Other devices (e.g., CSMA) behave this way with packets not
> > > addressed to self.
> > 
> > I agree. But will it be captured elsewhere by the "monitor" mode (for pcap
> > tracing?)
> > 
> 
> yes, NotifyPromiscSniffRx () is called in YansWifiPhy::EndReceive (), hence all
> the packets that are received correctly by the phy will end up in the pcap
> trace.

Thanks.

@Sergio: does it fix your problem?
Comment 8 Nicola Baldo 2011-04-10 13:12:50 EDT
changeset:   7014:937151f978b3
user:        Dean Armstrong <deanarm@gmail.com>
date:        Sun Apr 10 19:08:46 2011 +0200
summary:     fix Bug 1069 - ApWifiMac unduly calls RegularWifiMac::Receive and crashes

changeset:   7015:d70f5487cde0
tag:         tip
user:        Nicola Baldo <nicola@baldo.biz>
date:        Sun Apr 10 19:11:22 2011 +0200
summary:     revised fix for bug 1069