Possible bug: SpectrumWifiPhy with mesh

52 views
Skip to first unread message

Natasha Zlobinsky

unread,
Aug 17, 2020, 7:08:05 AM8/17/20
to ns-3-users
I have tried everything to use SpectrumWifiPhy with mesh, trying to install a SpectrumWifiPhy instance into a MeshHelper using MeshHelper::Install() and traced the source code from the Install function to CreateInterface etc. to the line where I think the issue is, but I still don't know why this is not working. I think this is a bug.

Attached is a minimal working example.

The signature for MeshHelper::Install requires a
const WifiPhyHelper &

SpectrumWifiPhyHelper inherits from WifiPhyHelper, so I see no reason why this should not work, but it doesn't. The line in 
That line meshDevices = mesh.Install (spectrumPhy, nodes);
where mesh = MeshHelper::Default() and meshDevices is a NetDeviceContainer,
 causes the error 

assert failed. cond="m_ptr", msg="Attempted to dereference zero pointer", file=./ns3/ptr.h, line=630
terminate called without an active exception

Program received signal SIGABRT, Aborted.
0x00007fffede9d438 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

The line where this issue is coming is in Ptr<WifiPhy> phy = phyHelper.Create (node, device); and then in that Create function, the line is
phy->SetChannel (m_channel); (seems to work)
phy->SetDevice (device); (seems not to work)

Could someone please assist with how to use SpectrumWifiPhy with Mesh, and why that error occurs?
minimal_spectrum_mesh.cc

Tom Henderson

unread,
Aug 17, 2020, 12:04:19 PM8/17/20
to ns-3-...@googlegroups.com, Natasha Zlobinsky
On 8/17/20 4:08 AM, Natasha Zlobinsky wrote:
> I have tried everything to use SpectrumWifiPhy with mesh, trying to
> install a SpectrumWifiPhy instance into a MeshHelper using
> MeshHelper::Install() and traced the source code from the Install
> function to CreateInterface etc. to the line where I think the issue is,
> but I still don't know why this is not working. I think this is a bug.
>
> Attached is a minimal working example.

Natasha, thanks for the bug report and for providing a small example to
reproduce. I found that there was an unnecessary downcast to
YansWifiPhy in the code, and once I removed that, your example started
to work. I just committed the change to ns-3-dev; you can either pull
if you are using ns-3-dev, or else manually apply the patch here:
https://gitlab.com/nsnam/ns-3-dev/-/commit/bb0ec5258

- Tom

Natasha Zlobinsky

unread,
Aug 18, 2020, 4:39:48 AM8/18/20
to ns-3-users
Thanks so much, Tom for the fix! Yes, I pulled the latest ns-3-dev and it works now! 
Much appreciated!

Regards
Reply all
Reply to author
Forward
0 new messages