Skip to content

Commit 94ffaf2

Browse files
e-rknordicjm
authored andcommitted
nrf_802154: rev 03b083502c09d20fdf32cc36e63482da10a76ee9
This commit updates revision of the nrf_802154 component. Signed-off-by: Rafal Kuznia <[email protected]>
1 parent de48963 commit 94ffaf2

File tree

6 files changed

+108
-15
lines changed

6 files changed

+108
-15
lines changed

nrf_802154/common/include/nrf_802154_config.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,38 @@ extern "C" {
611611
#define NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED 0
612612
#endif
613613

614+
/**
615+
* @}
616+
* @defgroup nrf_802154_tx_misc Miscellaneous options
617+
* @{
618+
*/
619+
620+
/**
621+
* @def NRF_802154_TX_DIAGNOSTIC_MODE
622+
*
623+
* Disables strict frame validation.
624+
*
625+
* When this option is disabled the nRF 802.154 Radio Driver performs strict frame format
626+
* validation of any frame that is to be transmitted. Frames that do not conform
627+
* the IEEE 802.15.4 MAC frame format will be discarded on transmit attempts.
628+
*
629+
* When this option is enabled the validation of frame format is disabled what allows for
630+
* sending arbitrary frames. The functionality set of the radio driver is reduced.
631+
* The IE writer, security writer, encryption, and TX timestamp modules cannot be used.
632+
*/
633+
#ifndef NRF_802154_TX_DIAGNOSTIC_MODE
634+
#define NRF_802154_TX_DIAGNOSTIC_MODE 0
635+
#endif
636+
637+
#if NRF_802154_TX_DIAGNOSTIC_MODE
638+
#if NRF_802154_IE_WRITER_ENABLED || \
639+
NRF_802154_SECURITY_WRITER_ENABLED || \
640+
NRF_802154_ENCRYPTION_ENABLED || \
641+
NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED
642+
#error "TX Diagnostic mode is not compatible with IE writer, Security writer, Encryption, and TX timestamp."
643+
#endif
644+
#endif
645+
614646
/** @} */
615647

616648
/**

nrf_802154/doc/CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Added
3030
The feature can be enabled with the :c:macro:`NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED` configuration macro. (KRKNWK-20426)
3131
* The HFXO startup latency can now be configured on all SoC families.
3232
On the nRF52 and nRF53 Series, a conservative default value of 1400 µs is assumed if :c:func:`nrf_802154_clock_hfclk_latency_set` is not called. (KRKNWK-20716)
33+
* Added a TX diagnostic mode that permits sending arbitrary data payloads.
34+
Enable this feature with the :c:macro:`NRF_802154_TX_DIAGNOSTIC_MODE` configuration macro.
35+
When enabled, the driver must be built with reduced functionality. (KRKNWK-20784)
3336

3437
nRF Connect SDK v3.1.0 - nRF 802.15.4 Radio Driver
3538
**************************************************

nrf_802154/driver/src/mac_features/nrf_802154_frame_parser.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ bool nrf_802154_frame_parser_data_init(uint8_t * p_frame,
520520
nrf_802154_frame_parser_level_t requested_parse_level,
521521
nrf_802154_frame_t * p_parser_data)
522522
{
523-
if (p_frame == NULL)
523+
if ((p_frame == NULL) || (valid_data_len > (MAX_PACKET_SIZE + PHR_SIZE)))
524524
{
525525
return false;
526526
}
@@ -545,6 +545,11 @@ bool nrf_802154_frame_parser_valid_data_extend(
545545
uint8_t valid_data_len,
546546
nrf_802154_frame_parser_level_t requested_parse_level)
547547
{
548+
if (valid_data_len > (MAX_PACKET_SIZE + PHR_SIZE))
549+
{
550+
return false;
551+
}
552+
548553
if (valid_data_len > p_parser_data->valid_data_len)
549554
{
550555
p_parser_data->valid_data_len = valid_data_len;

nrf_802154/driver/src/nrf_802154.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,22 @@ bool nrf_802154_transmit_raw(uint8_t * p_data,
426426
PARSE_LEVEL_FULL,
427427
&frame);
428428

429+
#if NRF_802154_TX_DIAGNOSTIC_MODE
429430
if (!result)
430431
{
431-
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
432-
return result;
432+
result = nrf_802154_frame_parser_data_init(p_data,
433+
p_data[PHR_OFFSET] + PHR_SIZE,
434+
PARSE_LEVEL_NONE,
435+
&frame);
436+
}
437+
#endif
438+
439+
if (result)
440+
{
441+
result = are_frame_properties_valid(&p_metadata->frame_props) &&
442+
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
433443
}
434444

435-
result = are_frame_properties_valid(&p_metadata->frame_props) &&
436-
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
437445
if (result)
438446
{
439447
result = nrf_802154_imm_tx_transmit(&frame,
@@ -473,15 +481,23 @@ bool nrf_802154_transmit_raw_at(uint8_t * p_data
473481
PARSE_LEVEL_FULL,
474482
&frame);
475483

484+
#if NRF_802154_TX_DIAGNOSTIC_MODE
476485
if (!result)
477486
{
478-
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
479-
return result;
487+
result = nrf_802154_frame_parser_data_init(p_data,
488+
p_data[PHR_OFFSET] + PHR_SIZE,
489+
PARSE_LEVEL_NONE,
490+
&frame);
491+
}
492+
#endif
493+
494+
if (result)
495+
{
496+
result = are_frame_properties_valid(&p_metadata->frame_props) &&
497+
are_extra_cca_attempts_valid(p_metadata) &&
498+
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
480499
}
481500

482-
result = are_frame_properties_valid(&p_metadata->frame_props) &&
483-
are_extra_cca_attempts_valid(p_metadata) &&
484-
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
485501
if (result)
486502
{
487503
result = nrf_802154_request_transmit_raw_at(&frame, tx_time, p_metadata);
@@ -760,14 +776,22 @@ bool nrf_802154_transmit_csma_ca_raw(uint8_t
760776
PARSE_LEVEL_FULL,
761777
&frame);
762778

779+
#if NRF_802154_TX_DIAGNOSTIC_MODE
763780
if (!result)
764781
{
765-
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
766-
return result;
782+
result = nrf_802154_frame_parser_data_init(p_data,
783+
p_data[PHR_OFFSET] + PHR_SIZE,
784+
PARSE_LEVEL_NONE,
785+
&frame);
786+
}
787+
#endif
788+
789+
if (result)
790+
{
791+
result = are_frame_properties_valid(&p_metadata->frame_props) &&
792+
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
767793
}
768794

769-
result = are_frame_properties_valid(&p_metadata->frame_props) &&
770-
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
771795
if (result)
772796
{
773797
result = nrf_802154_request_csma_ca_start(&frame, p_metadata);

nrf_802154/driver/src/nrf_802154_core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,11 @@ static uint8_t * rx_buffer_get(void)
545545
*/
546546
static bool tx_frame_ack_is_requested(const nrf_802154_frame_t * p_frame)
547547
{
548-
NRF_802154_ASSERT(nrf_802154_frame_parse_level_get(p_frame) >= PARSE_LEVEL_FCF_OFFSETS);
548+
if (nrf_802154_frame_parse_level_get(p_frame) < PARSE_LEVEL_FCF_OFFSETS)
549+
{
550+
// The frame is badly formatted.
551+
return false;
552+
}
549553

550554
if (nrf_802154_frame_type_get(p_frame) == FRAME_TYPE_MULTIPURPOSE)
551555
{

nrf_802154/zephyr/Kconfig.nrfxlib

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ if NRF_802154_RADIO_DRIVER
1818
config NRF_802154_ENCRYPTION
1919
bool "nRF 802.15.4 AES-CCM* authentication & encryption"
2020
depends on !CRYPTO_NRF_ECB
21+
select NRF_802154_IE_WRITER
22+
select NRF_802154_SECURITY_WRITER
23+
help
24+
Enable module for encryption and authentication of outgoing frames and Acks.
25+
26+
config NRF_802154_IE_WRITER
27+
bool "Information element writer"
28+
help
29+
Enable data injection for some Information Element types.
30+
31+
config NRF_802154_SECURITY_WRITER
32+
bool "Security frame counter writer"
33+
help
34+
Enable injection of security frame counter.
35+
36+
config NRF_802154_TX_DIAGNOSTIC_MODE
37+
bool "TX diagnostic mode"
38+
help
39+
Disables strict frame validation.
40+
When this option is disabled the nRF 802.154 Radio Driver performs strict frame
41+
format validation of any frame that is to be transmitted. Frames that do not conform
42+
the IEEE 802.15.4 MAC frame format will be discarded on transmit attempts.
43+
When this option is enabled the validation of frame format is disabled what allows
44+
for sending arbitrary frames. The functionality set of the radio driver is reduced.
45+
The IE writer, security writer, encryption, and TX timestamp modules cannot be used.
2146

2247
config NRF_802154_CSMA_CA_MIN_BE_DEFAULT
2348
int "Minimum CSMA-CA backoff exponent (BE)"

0 commit comments

Comments
 (0)