Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions nrf_802154/common/include/nrf_802154_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,38 @@ extern "C" {
#define NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED 0
#endif

/**
* @}
* @defgroup nrf_802154_tx_misc Miscellaneous options
* @{
*/

/**
* @def NRF_802154_TX_DIAGNOSTIC_MODE
*
* Disables strict frame validation.
*
* When this option is disabled the nRF 802.154 Radio Driver performs strict frame format
* validation of any frame that is to be transmitted. Frames that do not conform
* the IEEE 802.15.4 MAC frame format will be discarded on transmit attempts.
*
* When this option is enabled the validation of frame format is disabled what allows for
* sending arbitrary frames. The functionality set of the radio driver is reduced.
* The IE writer, security writer, encryption, and TX timestamp modules cannot be used.
*/
#ifndef NRF_802154_TX_DIAGNOSTIC_MODE
#define NRF_802154_TX_DIAGNOSTIC_MODE 0
#endif

#if NRF_802154_TX_DIAGNOSTIC_MODE
#if NRF_802154_IE_WRITER_ENABLED || \
NRF_802154_SECURITY_WRITER_ENABLED || \
NRF_802154_ENCRYPTION_ENABLED || \
NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED
#error "TX Diagnostic mode is not compatible with IE writer, Security writer, Encryption, and TX timestamp."
#endif
#endif

/** @} */

/**
Expand Down
3 changes: 3 additions & 0 deletions nrf_802154/doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Added
The feature can be enabled with the :c:macro:`NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED` configuration macro. (KRKNWK-20426)
* The HFXO startup latency can now be configured on all SoC families.
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)
* Added a TX diagnostic mode that permits sending arbitrary data payloads.
Enable this feature with the :c:macro:`NRF_802154_TX_DIAGNOSTIC_MODE` configuration macro.
When enabled, the driver must be built with reduced functionality. (KRKNWK-20784)

nRF Connect SDK v3.1.0 - nRF 802.15.4 Radio Driver
**************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ bool nrf_802154_frame_parser_data_init(uint8_t * p_frame,
nrf_802154_frame_parser_level_t requested_parse_level,
nrf_802154_frame_t * p_parser_data)
{
if (p_frame == NULL)
if ((p_frame == NULL) || (valid_data_len > (MAX_PACKET_SIZE + PHR_SIZE)))
{
return false;
}
Expand All @@ -545,6 +545,11 @@ bool nrf_802154_frame_parser_valid_data_extend(
uint8_t valid_data_len,
nrf_802154_frame_parser_level_t requested_parse_level)
{
if (valid_data_len > (MAX_PACKET_SIZE + PHR_SIZE))
{
return false;
}

if (valid_data_len > p_parser_data->valid_data_len)
{
p_parser_data->valid_data_len = valid_data_len;
Expand Down
50 changes: 37 additions & 13 deletions nrf_802154/driver/src/nrf_802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,22 @@ bool nrf_802154_transmit_raw(uint8_t * p_data,
PARSE_LEVEL_FULL,
&frame);

#if NRF_802154_TX_DIAGNOSTIC_MODE
if (!result)
{
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
return result;
result = nrf_802154_frame_parser_data_init(p_data,
p_data[PHR_OFFSET] + PHR_SIZE,
PARSE_LEVEL_NONE,
&frame);
}
#endif

if (result)
{
result = are_frame_properties_valid(&p_metadata->frame_props) &&
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
}

result = are_frame_properties_valid(&p_metadata->frame_props) &&
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
if (result)
{
result = nrf_802154_imm_tx_transmit(&frame,
Expand Down Expand Up @@ -473,15 +481,23 @@ bool nrf_802154_transmit_raw_at(uint8_t * p_data
PARSE_LEVEL_FULL,
&frame);

#if NRF_802154_TX_DIAGNOSTIC_MODE
if (!result)
{
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
return result;
result = nrf_802154_frame_parser_data_init(p_data,
p_data[PHR_OFFSET] + PHR_SIZE,
PARSE_LEVEL_NONE,
&frame);
}
#endif

if (result)
{
result = are_frame_properties_valid(&p_metadata->frame_props) &&
are_extra_cca_attempts_valid(p_metadata) &&
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
}

result = are_frame_properties_valid(&p_metadata->frame_props) &&
are_extra_cca_attempts_valid(p_metadata) &&
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
if (result)
{
result = nrf_802154_request_transmit_raw_at(&frame, tx_time, p_metadata);
Expand Down Expand Up @@ -760,14 +776,22 @@ bool nrf_802154_transmit_csma_ca_raw(uint8_t
PARSE_LEVEL_FULL,
&frame);

#if NRF_802154_TX_DIAGNOSTIC_MODE
if (!result)
{
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
return result;
result = nrf_802154_frame_parser_data_init(p_data,
p_data[PHR_OFFSET] + PHR_SIZE,
PARSE_LEVEL_NONE,
&frame);
}
#endif

if (result)
{
result = are_frame_properties_valid(&p_metadata->frame_props) &&
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
}

result = are_frame_properties_valid(&p_metadata->frame_props) &&
is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode);
if (result)
{
result = nrf_802154_request_csma_ca_start(&frame, p_metadata);
Expand Down
6 changes: 5 additions & 1 deletion nrf_802154/driver/src/nrf_802154_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ static uint8_t * rx_buffer_get(void)
*/
static bool tx_frame_ack_is_requested(const nrf_802154_frame_t * p_frame)
{
NRF_802154_ASSERT(nrf_802154_frame_parse_level_get(p_frame) >= PARSE_LEVEL_FCF_OFFSETS);
if (nrf_802154_frame_parse_level_get(p_frame) < PARSE_LEVEL_FCF_OFFSETS)
{
// The frame is badly formatted.
return false;
}

if (nrf_802154_frame_type_get(p_frame) == FRAME_TYPE_MULTIPURPOSE)
{
Expand Down
25 changes: 25 additions & 0 deletions nrf_802154/zephyr/Kconfig.nrfxlib
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,31 @@ if NRF_802154_RADIO_DRIVER
config NRF_802154_ENCRYPTION
bool "nRF 802.15.4 AES-CCM* authentication & encryption"
depends on !CRYPTO_NRF_ECB
select NRF_802154_IE_WRITER
select NRF_802154_SECURITY_WRITER
help
Enable module for encryption and authentication of outgoing frames and Acks.

config NRF_802154_IE_WRITER
bool "Information element writer"
help
Enable data injection for some Information Element types.

config NRF_802154_SECURITY_WRITER
bool "Security frame counter writer"
help
Enable injection of security frame counter.

config NRF_802154_TX_DIAGNOSTIC_MODE
bool "TX diagnostic mode"
help
Disables strict frame validation.
When this option is disabled the nRF 802.154 Radio Driver performs strict frame
format validation of any frame that is to be transmitted. Frames that do not conform
the IEEE 802.15.4 MAC frame format will be discarded on transmit attempts.
When this option is enabled the validation of frame format is disabled what allows
for sending arbitrary frames. The functionality set of the radio driver is reduced.
The IE writer, security writer, encryption, and TX timestamp modules cannot be used.

config NRF_802154_CSMA_CA_MIN_BE_DEFAULT
int "Minimum CSMA-CA backoff exponent (BE)"
Expand Down