[ndnSIM] [EXT] Bug in Default Network Device of ndnSIM's ndn-stack-helper.cpp
Junxiao Shi
shijunxiao at arizona.edu
Sat Jun 17 18:27:57 PDT 2023
Hi Andre
See NDN contributing guide:
https://github.com/named-data/.github/blob/main/CONTRIBUTING.md
Please submit your code to Gerrit system:
https://gerrit.named-data.net/admin/repos/ndnSIM,general
Yours, Junxiao
On Fri, Jun 9, 2023 at 7:07 PM Andre Madureira via ndnSIM <
ndnsim at lists.cs.ucla.edu> wrote:
> *External Email*
> Hello,
>
> I've tried building a custom forwarding strategy that checks the LinkType
> to see if the NDN face is operating as Adhoc, Multi-access or
> Point-to-Point. But to my surprise this link type field was not working, as
> the NDN Face was always being created as if the NS3 network device is a
> Point-to-Point one. I figured that the function responsible by the NDN Face
> creation was the following:
>
> shared_ptr<Face>
> StackHelper::DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
> Ptr<NetDevice> netDevice)
>
> So I've checked the function and found that no checks have been done to
> identify the NS3's network device operation (Adhoc, Multiaccess or
> Point-to-point). So I've modified the function to look like this:
>
> shared_ptr<Face>
> StackHelper::DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
> Ptr<NetDevice> netDevice) const
> {
> NS_LOG_DEBUG("Creating default Face on node " << node->GetId());
>
> // Create an ndnSIM-specific transport instance
> ::nfd::face::GenericLinkService::Options opts;
> opts.allowFragmentation = true;
> opts.allowReassembly = true;
> opts.allowCongestionMarking = true;
>
> auto linkService = make_unique<::nfd::face::GenericLinkService>(opts);
>
> auto linkType = ::ndn::nfd::LINK_TYPE_POINT_TO_POINT;
> if (netDevice->IsPointToPoint() == 0)
> linkType = ::ndn::nfd::LINK_TYPE_MULTI_ACCESS;
> // check for Adhoc communication
> auto wifiNetDev = dynamic_cast<ns3::WifiNetDevice*>(&(*netDevice));
> if (wifiNetDev != NULL) {
> auto wifiMac = wifiNetDev->GetMac();
> if (dynamic_cast<ns3::AdhocWifiMac*>(&(*wifiMac)) != NULL)
> linkType = ::ndn::nfd::LINK_TYPE_AD_HOC;
> }
>
> auto transport =
> make_unique<NetDeviceTransport>(node, netDevice, constructFaceUri(
> netDevice),
> "netdev://[ff:ff:ff:ff:ff:ff]",
> ::ndn::nfd::FACE_SCOPE_NON_LOCAL,
> ::ndn::nfd::
> FACE_PERSISTENCY_PERSISTENT, linkType);
>
> auto face = std::make_shared<Face>(std::move(linkService), std::move(
> transport));
> face->setMetric(1);
>
> ndn->addFace(face);
> NS_LOG_LOGIC("Node " << node->GetId() << ": added Face as face #" <<
> face->getLocalUri()
> << " - remoteURI = " << face->getRemoteUri() << "
> - linkType " << linkType);
>
> return face;
> }
>
> I've tested the code with Point-to-Point network devices and WifiNetDevice
> with ns3::AdhocWifiMac configured and in both cases the linkType was
> properly identified when the NDN Face was created. But I don't know if it
> will work under other network devices or MAC's. I'm sending this message in
> the hopes that there's another way to solve this problem and as an attempt
> to improve ndnSIM code.
>
> Best regards,
> Andre Madureira
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20230617/c2ba2e39/attachment.html>
More information about the ndnSIM
mailing list