From 46977a572302db5e3b401a701539439dd759a06e Mon Sep 17 00:00:00 2001 From: Alberto Gallegos Ramonet Date: Tue, 13 May 2025 11:08:49 +0900 Subject: [PATCH] lr-wpan: Update correct ext addr use in lr-wpan-data example --- CHANGES.md | 1 + src/lr-wpan/examples/lr-wpan-data.cc | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 426f5540b..f375f69a7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ This file is a best-effort approach to solving this issue; we will do our best b * (flow-monitor) Reformatted documentation and added a new concept figure. * (internet-apps) Added a parameter to the RADVD helper to announce a prefix without the autoconfiguration flag. * (lr-wpan) - Renamed example ``lr-wpan\examples\lr-wpan-mlme.cc`` to ``lr-wpan\examples\lr-wpan-beacon-mode.cc``. +* (lr-wpan) - Update correct use of extended addresses in ``lr-wpan\examples\lr-wpan-data.cc``. * (wifi) Callbacks connected to the `WifiMac::IcfDropReason` trace source are now passed a `struct IcfDropInfo` object that has three fields indicating the reason for dropping the ICF, the ID of the link on which the ICF was dropped and the MAC address of the sender of the ICF. ### Changes to build system diff --git a/src/lr-wpan/examples/lr-wpan-data.cc b/src/lr-wpan/examples/lr-wpan-data.cc index 6b18763dd..8e4491d77 100644 --- a/src/lr-wpan/examples/lr-wpan-data.cc +++ b/src/lr-wpan/examples/lr-wpan-data.cc @@ -46,7 +46,7 @@ DataIndication(McpsDataIndicationParams params, Ptr p) static void DataConfirm(McpsDataConfirmParams params) { - NS_LOG_UNCOND("LrWpanMcpsDataConfirmStatus = " << params.m_status); + NS_LOG_UNCOND("LrWpanMcpsDataConfirmStatus = " << static_cast(params.m_status)); } /** @@ -126,18 +126,23 @@ main(int argc, char* argv[]) // Ptr dev0 = devices.Get(0)->GetObject(); // Ptr dev1 = devices.Get(1)->GetObject(); - // Set 16-bit short addresses if extended is false, otherwise use 64-bit extended addresses + // Set 16-bit and 64-bit MAC addresses. + // Note: Extended addresses must ALWAYS be present. If the devices are using the extended + // address mode, short addresses should use the short address FF:FE. A short address of FF:FF + // indicates that the devices is not associated to any device. if (!extended) { - dev0->SetAddress(Mac16Address("00:01")); - dev1->SetAddress(Mac16Address("00:02")); + dev0->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01")); + dev1->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02")); + dev0->GetMac()->SetShortAddress(Mac16Address("00:01")); + dev1->GetMac()->SetShortAddress(Mac16Address("00:02")); } else { - Ptr mac0 = dev0->GetMac(); - Ptr mac1 = dev1->GetMac(); - mac0->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01")); - mac1->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02")); + dev0->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01")); + dev1->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02")); + dev0->GetMac()->SetShortAddress(Mac16Address("FF:FE")); + dev1->GetMac()->SetShortAddress(Mac16Address("FF:FE")); } // Trace state changes in the phy