From 1cf723bc3c4f9343da653a50611b93b3885ece0a Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Wed, 29 Jun 2022 16:35:49 +0200 Subject: [PATCH] fixup! opendsme: add initial support --- pkg/opendsme/contrib/opendsme.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/opendsme/contrib/opendsme.cpp b/pkg/opendsme/contrib/opendsme.cpp index 7cf5a6668a25..a61c16215b33 100644 --- a/pkg/opendsme/contrib/opendsme.cpp +++ b/pkg/opendsme/contrib/opendsme.cpp @@ -47,6 +47,8 @@ static int _get(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) gnrc_netif_acquire(netif); int res; network_uint16_t addr; + le_uint64_t ext_addr; + uint8_t *addr_ptr = static_cast(ext_addr.u8); switch (opt->opt) { case NETOPT_MAX_PDU_SIZE: *((uint16_t *)opt->data) = IEEE802154_FRAME_LEN_MAX; @@ -57,11 +59,18 @@ static int _get(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) res = sizeof(uint16_t); break; case NETOPT_ADDRESS: - assert(opt->data_len >= sizeof(network_uint16_t)); + assert(opt->data_len >= IEEE802154_SHORT_ADDRESS_LEN); m_dsme.getShortAddress(&addr); memcpy(opt->data, &addr, IEEE802154_SHORT_ADDRESS_LEN); res = IEEE802154_SHORT_ADDRESS_LEN; break; + case NETOPT_ADDRESS_LONG: { + assert(opt->data_len >= IEEE802154_LONG_ADDRESS_LEN); + addr_ptr << m_dsme.getAddress(); + *((be_uint64_t*) opt->data) = byteorder_ltobll(ext_addr); + res = IEEE802154_LONG_ADDRESS_LEN; + break; + } case NETOPT_LINK: assert(opt->data_len >= sizeof(netopt_enable_t)); *((netopt_enable_t*) opt->data) = m_dsme.isAssociated()