From 1e15a80e6e9a51b12852b8923dc6d6c802ce108f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mali=C5=A1a=20Vu=C4=8Dini=C4=87?= Date: Mon, 9 Nov 2020 17:28:35 +0100 Subject: [PATCH 1/2] Add l2 security module to cmake build. --- bsp/boards/python/setup.py.in | 1 + cmake/options.cmake | 8 ++++++++ stack/02a-MAClow/IEEE802154_security.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bsp/boards/python/setup.py.in b/bsp/boards/python/setup.py.in index 9c7354d8d1..f093ef7237 100644 --- a/bsp/boards/python/setup.py.in +++ b/bsp/boards/python/setup.py.in @@ -42,6 +42,7 @@ openwsn_module = Extension( ('OPENWSN_UDP_C', '${OPENWSN_UDP_C}'), ('OPENWSN_ICMPV6ECHO_C', '${OPENWSN_ICMPV6ECHO_C}'), ('OPENWSN_6LO_FRAGMENTATION_C', '${OPENWSN_6LO_FRAGMENTATION_C}'), + ('OPENWSN_IEEE802154E_SECURITY_C', '${OPENWSN_IEEE802154E_SECURITY_C}'), # stack configuration ('ADAPTIVE_MSF', '${ADAPTIVE_MSF}'), diff --git a/cmake/options.cmake b/cmake/options.cmake index 7b2cc35731..9fc3f5713f 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -76,3 +76,11 @@ if (PRINTF) else () set(BOARD_OPENSERIAL_PRINTF "0") endif () + +option(L2_SECURITY "Enable link-layer security" OFF) +if (L2_SECURITY) + add_definitions(-DOPENWSN_IEEE802154E_SECURITY_C) + set(OPENWSN_IEEE802154E_SECURITY_C "1") +else () + set(OPENWSN_IEEE802154E_SECURITY_C "0") +endif() diff --git a/stack/02a-MAClow/IEEE802154_security.c b/stack/02a-MAClow/IEEE802154_security.c index 82c5539ec7..2a0e8f5e5d 100755 --- a/stack/02a-MAClow/IEEE802154_security.c +++ b/stack/02a-MAClow/IEEE802154_security.c @@ -257,7 +257,7 @@ void IEEE802154_security_retrieveAuxiliarySecurityHeader(QueueEntry_t *msg, ieee uint8_t temp8b; uint8_t i; uint8_t receivedASN[5]; - macFrameCounter_t l2_frameCounter; + asn_t l2_frameCounter; // retrieve the Security Control field // 1byte, Security Control Field From 9478dfce4c2159de414f506cf0976e98a1f58453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mali=C5=A1a=20Vu=C4=8Dini=C4=87?= Date: Mon, 9 Nov 2020 17:28:44 +0100 Subject: [PATCH 2/2] Revert regression in forwarding.c --- stack/03b-IPv6/forwarding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack/03b-IPv6/forwarding.c b/stack/03b-IPv6/forwarding.c index 7591019cad..f36d269181 100644 --- a/stack/03b-IPv6/forwarding.c +++ b/stack/03b-IPv6/forwarding.c @@ -465,7 +465,7 @@ owerror_t forwarding_send_internal_RoutingTable( open_addr_t temp_prefix64btoWrite; // retrieve the next hop from the routing table - if (msg->is_cjoin_response || msg->creator == COMPONENT_CJOIN) { + if (packetfunctions_isLinkLocal(&msg->l3_destinationAdd)) { if (neighbors_isStableNeighbor(&(msg->l3_destinationAdd)) || msg->is_cjoin_response) { // IP destination is 1-hop neighbor, send directly packetfunctions_ip128bToMac64b(&(msg->l3_destinationAdd), &temp_prefix64btoWrite,