summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Larson <[email protected]>2020-11-10 14:38:15 -0800
committerScott Larson <[email protected]>2020-11-10 14:38:15 -0800
commit7bc9b45c7160ab55c03b1a2d748a8b6041d77d86 (patch)
tree099fc51b9e0029518bf5c7e0787c52864a9c014c
parente3d7b92eebc5dd1904dce78630ee1eba3bad813f (diff)
patch release 6.1.2
-rwxr-xr-xREADME.md16
m---------addons/azure_iot/azure-sdk-for-c0
-rw-r--r--addons/azure_iot/azure_iot_security_module/iot-security-module-core/cmake-modules/asc_security_coreBuild.cmake2
-rw-r--r--addons/azure_iot/docs/README.md12
-rw-r--r--addons/dhcp/nxd_dhcpv6_client.c18
-rw-r--r--addons/mqtt/nxd_mqtt_client.c31
-rw-r--r--addons/mqtt/nxd_mqtt_client.h7
-rw-r--r--addons/ppp/nx_ppp.c149
-rw-r--r--addons/ppp/nx_ppp.h8
-rw-r--r--common/inc/nx_api.h7
10 files changed, 167 insertions, 83 deletions
diff --git a/README.md b/README.md
index 0c36cd6a..5594a59f 100755
--- a/README.md
+++ b/README.md
@@ -55,21 +55,19 @@ Each official release (preview or GA) will be tagged to mark the commit and push
- samples
```
+# Azure IoT
+
+NetX Duo includes [Azure IoT Middleware for Azure RTOS](https://github.com/azure-rtos/netxduo/tree/master/addons/azure_iot), a platform specific library that acts as a binding layer between the Azure RTOS and the [Azure SDK for Embedded C](https://github.com/Azure/azure-sdk-for-c/tree/master/sdk/docs/iot).
+
# Security
Azure RTOS provides OEMs with components to secure communication and to create code and data isolation using underlying
MCU/MPU hardware protection mechanisms. It is ultimately the responsibility of the device builder to ensure the device
fully meets the evolving security requirements associated with its specific use case.
-## Azure Security Center for IoT - RTOS
+## Azure Defender for IoT security module
-The Azure Security Center for IoT - RTOS security module provides a comprehensive security solution for Azure RTOS
-devices. Azure RTOS now ships with the ASC for IoT security module built-in and provides coverage for common threats
-and potential malicious activities. The ASC module is part of the Azure IoT SDK (addons/azure_iot/). As the device
-connects to Azure IoT hub, ASC collectors gather network connectivity information and sends it to ASC service for
-analysis. For details on how ASC works, the type of informaiton it collects, refer to [Azure Security Center for IoT
-module](https://github.com/azure-rtos/netxduo/tree/v6.1_rel/addons/azure_iot/docs#azure-security-center-for-iot-module)
-section in the Azure IoT document.
+The Azure Defender for IoT security module provides a comprehensive security solution for Azure RTOS devices. Azure RTOS now ships with the Defender for IoT security module built-in and provides coverage for common threats and potential malicious activities. The security module is part of the Azure IoT Middleware for Azure RTOS (addons/azure_iot/). As the device connects to Azure IoT hub, Defender for IoT collectors gather network connectivity information and sends it to the Defender for IoT service for analysis. For details on how the security module works and the type of information it collects, refer to [Azure Defender for IoT security module](https://github.com/azure-rtos/netxduo/tree/v6.1_rel/addons/azure_iot/docs#azure-defender-for-iot-module) section in the Azure IoT document.
# Licensing
@@ -96,4 +94,4 @@ The following are references to additional Azure RTOS and Azure IoT in general:
| Azure RTOS Sales Questions: | https://azure-rtos.ms-iot-contact.com/ |
| Microsoft Q/A for Azure IoT: | https://docs.microsoft.com/en-us/answers/products/azure?product=iot |
| Internet of Things Show: | https://aka.ms/iotshow |
-| IoT Tech Community: | https://aka.ms/iottechcommunity |
+| IoT Tech Community: | https://aka.ms/iottechcommunity | \ No newline at end of file
diff --git a/addons/azure_iot/azure-sdk-for-c b/addons/azure_iot/azure-sdk-for-c
new file mode 160000
+Subproject 14015dd76a7f5a0c70840e472773a4df239a9d1
diff --git a/addons/azure_iot/azure_iot_security_module/iot-security-module-core/cmake-modules/asc_security_coreBuild.cmake b/addons/azure_iot/azure_iot_security_module/iot-security-module-core/cmake-modules/asc_security_coreBuild.cmake
index b152a1b8..c1957acc 100644
--- a/addons/azure_iot/azure_iot_security_module/iot-security-module-core/cmake-modules/asc_security_coreBuild.cmake
+++ b/addons/azure_iot/azure_iot_security_module/iot-security-module-core/cmake-modules/asc_security_coreBuild.cmake
@@ -36,7 +36,7 @@ function(setTargetCompileOptions target)
/wd5031
/wd5045
)
- else()
+ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
# Make warning as error
target_compile_options(${target}
PRIVATE
diff --git a/addons/azure_iot/docs/README.md b/addons/azure_iot/docs/README.md
index 67ee68a6..d3c59c2f 100644
--- a/addons/azure_iot/docs/README.md
+++ b/addons/azure_iot/docs/README.md
@@ -23,9 +23,9 @@ The Azure IoT Middleware for Azure RTOS is built as part of the NetXDuo. Make su
Module | Marcos |
| --- | --- |
| Azure IoT Middleware for Azure RTOS | `NX_ENABLE_EXTENDED_NOTIFY_SUPPORT`<br> `NX_SECURE_ENABLE`<br> `NXD_MQTT_CLOUD_ENABLE`
-| Azure Security Center for IoT Module | `NX_ENABLE_IP_PACKET_FILTER`
+| Azure Defender for IoT security module | `NX_ENABLE_IP_PACKET_FILTER`
-**NOTE:** Azure Security Center for IoT Module is enabled by default. You can define `NX_AZURE_DISABLE_IOT_SECURITY_MODULE` to disable it. [Learn more](#azure-security-center-for-iot-module).
+**NOTE:** Azure Defender for IoT security module is enabled by default. You can define `NX_AZURE_DISABLE_IOT_SECURITY_MODULE` to disable it. [Learn more](#azure-defender-for-iot-security-module).
Follow [this example](/ports/cortex_m7/iar/inc/nx_port.h) to see how to define these *marcos* in the header file.
@@ -56,15 +56,15 @@ Enhanced features provided in middleware:
* Device Provisioning Service.
* JSON parser.
-## Azure Security Center for IoT Module
+## Azure Defender for IoT security module
-The [Azure Security Center (ASC) for IoT - RTOS security module](https://docs.microsoft.com/azure/asc-for-iot/iot-security-azure-rtos) provides a comprehensive security solution for Azure RTOS devices. The middleware ships with the ASC for IoT Security Module built-in and enabled by default to detect common threats and potential malicious activities.
+The [Azure Defender for IoT security module](https://docs.microsoft.com/azure/defender-for-iot/iot-security-azure-rtos) provides a comprehensive security solution for Azure RTOS devices. The middleware ships with the ASC for IoT Security Module built-in and enabled by default to detect common threats and potential malicious activities.
### Opt-out
To disable (opt-out) the module for your application, you can choose one of these two options:
* Define `NX_AZURE_DISABLE_IOT_SECURITY_MODULE` in NetXDuo header file such as [`nx_port.h`](/ports/cortex_m7/iar/inc/nx_port.h) when building the middleware.
-* Call [`UINT nx_azure_iot_security_module_disable(NX_AZURE_IOT *nx_azure_iot_ptr)`](https://docs.microsoft.com/en-us/azure/asc-for-iot/azure-rtos-security-module-api#disable-azure-iot-security-module) in your application code.
+* Call [`UINT nx_azure_iot_security_module_disable(NX_AZURE_IOT *nx_azure_iot_ptr)`](https://docs.microsoft.com/azure/defender-for-iot/azure-rtos-security-module-api#disable-azure-iot-security-module) in your application code.
### Data collection
@@ -100,7 +100,7 @@ Connection Type | RAM | Network |
So the total additional connection traffic will be:
*Total (in bytes) = Metadata (e.g. 300 bytes) + IPv4 Connections * 36 + IPv6 Connections * 60*
-Learn [here](https://docs.microsoft.com/en-us/azure/defender-for-iot) for more information about Azure Security Center for IoT.
+Learn [here](https://docs.microsoft.com/en-us/azure/defender-for-iot) for more information about Azure Defender for IoT.
## APIs
diff --git a/addons/dhcp/nxd_dhcpv6_client.c b/addons/dhcp/nxd_dhcpv6_client.c
index 708d4d47..26da0207 100644
--- a/addons/dhcp/nxd_dhcpv6_client.c
+++ b/addons/dhcp/nxd_dhcpv6_client.c
@@ -4900,7 +4900,7 @@ UINT count = 1;
/* FUNCTION RELEASE */
/* */
/* _nx_dhcpv6_name_string_unencode PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -4937,6 +4937,9 @@ UINT count = 1;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), fixed */
+/* domain name labelSize issue,*/
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _nx_dhcpv6_name_string_unencode(UCHAR *data, UINT start, UCHAR *buffer, UINT size)
@@ -4953,7 +4956,7 @@ UINT length = 0;
UINT labelSize = *character++;
- /* Is this a compression pointer or a count. */
+ /* Check labelSize. */
if (labelSize <= NX_DHCPV6_LABEL_MAX)
{
@@ -4970,16 +4973,11 @@ UINT length = 0;
*buffer++ = '.';
length++;
}
- else if ((labelSize & NX_DHCPV6_COMPRESS_MASK) == NX_DHCPV6_COMPRESS_VALUE)
- {
-
- /* This is a pointer, just adjust the source. */
- character = data + ((labelSize & NX_DHCPV6_LABEL_MAX) << 8) + *character;
- }
else
{
-
- /* Not defined, just fail */
+ /* Not defined or in compressed form. Based on section 8 of RFC 3315,
+ a domain name, or list of domain names, in DHCP MUST NOT be stored
+ in compressed form, so just fail */
return(0);
}
}
diff --git a/addons/mqtt/nxd_mqtt_client.c b/addons/mqtt/nxd_mqtt_client.c
index 174e8486..5915e7a1 100644
--- a/addons/mqtt/nxd_mqtt_client.c
+++ b/addons/mqtt/nxd_mqtt_client.c
@@ -246,7 +246,7 @@ ULONG bytes_copied;
/* FUNCTION RELEASE */
/* */
/* _nxd_mqtt_client_sub_unsub PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -265,6 +265,10 @@ ULONG bytes_copied;
/* to subscribe to */
/* topic_name_length Length of the topic string */
/* in bytes */
+/* packet_id_ptr Pointer to packet id that */
+/* will be filled with */
+/* assigned packet id for */
+/* sub/unsub message */
/* QoS Expected QoS level */
/* */
/* OUTPUT */
@@ -295,10 +299,14 @@ ULONG bytes_copied;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
+/* added packet id parameter, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _nxd_mqtt_client_sub_unsub(NXD_MQTT_CLIENT *client_ptr, UINT op,
- CHAR *topic_name, UINT topic_name_length, UINT QoS)
+ CHAR *topic_name, UINT topic_name_length,
+ USHORT *packet_id_ptr, UINT QoS)
{
@@ -361,6 +369,11 @@ UCHAR temp_data[2];
temp_data[0] = (UCHAR)(client_ptr -> nxd_mqtt_client_packet_identifier >> 8);
temp_data[1] = (client_ptr -> nxd_mqtt_client_packet_identifier & 0xFF);
+ if (packet_id_ptr)
+ {
+ *packet_id_ptr = (USHORT)(client_ptr -> nxd_mqtt_client_packet_identifier & 0xFFFF);
+ }
+
/* Append packet ID. */
ret = nx_packet_data_append(packet_ptr, temp_data, 2, client_ptr -> nxd_mqtt_client_packet_pool_ptr, NX_WAIT_FOREVER);
@@ -4755,7 +4768,7 @@ UINT ret = NXD_MQTT_SUCCESS;
/* FUNCTION RELEASE */
/* */
/* _nxd_mqtt_client_subscribe PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -4795,6 +4808,9 @@ UINT ret = NXD_MQTT_SUCCESS;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
+/* added packet id parameter, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _nxd_mqtt_client_subscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, UINT topic_name_length, UINT QoS)
@@ -4806,7 +4822,7 @@ UINT _nxd_mqtt_client_subscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, U
}
return(_nxd_mqtt_client_sub_unsub(client_ptr, (MQTT_CONTROL_PACKET_TYPE_SUBSCRIBE << 4) | 0x02,
- topic_name, topic_name_length, QoS));
+ topic_name, topic_name_length, NX_NULL, QoS));
}
@@ -4817,7 +4833,7 @@ UINT _nxd_mqtt_client_subscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, U
/* FUNCTION RELEASE */
/* */
/* _nxd_mqtt_client_unsubscribe PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -4854,12 +4870,15 @@ UINT _nxd_mqtt_client_subscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, U
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
+/* added packet id parameter, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _nxd_mqtt_client_unsubscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, UINT topic_name_length)
{
return(_nxd_mqtt_client_sub_unsub(client_ptr, (MQTT_CONTROL_PACKET_TYPE_UNSUBSCRIBE << 4) | 0x02,
- topic_name, topic_name_length, 0));
+ topic_name, topic_name_length, NX_NULL, 0));
}
/**************************************************************************/
diff --git a/addons/mqtt/nxd_mqtt_client.h b/addons/mqtt/nxd_mqtt_client.h
index 3fe10448..92433689 100644
--- a/addons/mqtt/nxd_mqtt_client.h
+++ b/addons/mqtt/nxd_mqtt_client.h
@@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nxd_mqtt_client.h PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -45,6 +45,9 @@
/* 09-30-2020 Yuxin Zhou Modified comment(s), and */
/* added ack receive notify, */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
+/* added packet id parameter, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@@ -449,7 +452,7 @@ UINT _nxd_mqtt_client_receive_notify_set(NXD_MQTT_CLIENT *client_ptr,
VOID (*receive_notify)(NXD_MQTT_CLIENT *client_ptr, UINT message_count));
UINT _nxd_mqtt_client_release_callback_set(NXD_MQTT_CLIENT *client_ptr, VOID (*memory_release_function)(CHAR *, UINT));
UINT _nxd_mqtt_client_sub_unsub(NXD_MQTT_CLIENT *client_ptr, UINT op,
- CHAR *topic_name, UINT topic_name_length, UINT QoS);
+ CHAR *topic_name, UINT topic_name_length, USHORT *packet_id_ptr, UINT QoS);
UINT _nxd_mqtt_client_subscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, UINT topic_name_length, UINT QoS);
UINT _nxd_mqtt_client_unsubscribe(NXD_MQTT_CLIENT *client_ptr, CHAR *topic_name, UINT topic_name_length);
UINT _nxd_mqtt_client_will_message_set(NXD_MQTT_CLIENT *client_ptr,
diff --git a/addons/ppp/nx_ppp.c b/addons/ppp/nx_ppp.c
index 77e0461c..47410a20 100644
--- a/addons/ppp/nx_ppp.c
+++ b/addons/ppp/nx_ppp.c
@@ -1401,7 +1401,7 @@ UINT status;
/* FUNCTION RELEASE */
/* */
/* _nx_ppp_receive_packet_process PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -1440,6 +1440,10 @@ UINT status;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* improved packet length */
+/* verification, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
void _nx_ppp_receive_packet_process(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
@@ -1448,6 +1452,7 @@ void _nx_ppp_receive_packet_process(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
UINT protocol;
UINT ppp_ipcp_state;
UINT code;
+UINT length;
#ifndef NX_PPP_DISABLE_INFO
@@ -1498,6 +1503,20 @@ UINT code;
/* Return. */
return;
}
+
+ /* Get the message length. */
+ length = (((UINT) packet_ptr -> nx_packet_prepend_ptr[4]) << 8) | ((UINT) packet_ptr -> nx_packet_prepend_ptr[5]);
+
+ /* Check if the packet length is equal to message length plus 2 bytes protocal type. */
+ if ((length + 2) != packet_ptr -> nx_packet_length)
+ {
+
+ /* Release the packet. */
+ nx_packet_release(packet_ptr);
+
+ /* Return. */
+ return;
+ }
}
/* Determine if the packet is LCP. */
@@ -2191,7 +2210,7 @@ NX_PACKET *packet_ptr;
/* FUNCTION RELEASE */
/* */
/* _nx_ppp_lcp_state_machine_update PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -2234,6 +2253,10 @@ NX_PACKET *packet_ptr;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* improved packet length */
+/* verification, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
void _nx_ppp_lcp_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
@@ -2242,6 +2265,7 @@ void _nx_ppp_lcp_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
UINT configure_status;
UCHAR *lcp_message_ptr;
UCHAR code;
+UINT status;
/* Determine if a packet is present. If so, derive the event from the packet. */
if (packet_ptr)
@@ -2469,8 +2493,14 @@ UCHAR code;
/* The peer has sent a configuration request. */
/* Retrieve configuration. */
- configure_status = _nx_ppp_lcp_configuration_retrieve(ppp_ptr, packet_ptr, ppp_ptr -> nx_ppp_peer_naked_list, ppp_ptr -> nx_ppp_rejected_list);
-
+ status = _nx_ppp_lcp_configuration_retrieve(ppp_ptr, packet_ptr, ppp_ptr -> nx_ppp_peer_naked_list, ppp_ptr -> nx_ppp_rejected_list, &configure_status);
+
+ /* Discard invalid packet. */
+ if (status)
+ {
+ return;
+ }
+
/* Determine if the configuration request is fine or needs to be negotiated further. */
if (configure_status == 0)
{
@@ -2540,7 +2570,13 @@ UCHAR code;
/* The peer has sent a configuration request. */
/* Retrieve configuration. */
- configure_status = _nx_ppp_lcp_configuration_retrieve(ppp_ptr, packet_ptr, ppp_ptr -> nx_ppp_peer_naked_list, ppp_ptr -> nx_ppp_rejected_list);
+ status = _nx_ppp_lcp_configuration_retrieve(ppp_ptr, packet_ptr, ppp_ptr -> nx_ppp_peer_naked_list, ppp_ptr -> nx_ppp_rejected_list, &configure_status);
+
+ /* Discard invalid packet. */
+ if (status)
+ {
+ return;
+ }
/* Determine if the configuration request is fine or needs to be negotiated further. */
if (configure_status == 0)
@@ -2742,7 +2778,13 @@ UCHAR code;
/* The peer has sent a configuration request. */
/* Retrieve configuration. */
- configure_status = _nx_ppp_lcp_configuration_retrieve(ppp_ptr, packet_ptr, ppp_ptr -> nx_ppp_peer_naked_list, ppp_ptr -> nx_ppp_rejected_list);
+ status = _nx_ppp_lcp_configuration_retrieve(ppp_ptr, packet_ptr, ppp_ptr -> nx_ppp_peer_naked_list, ppp_ptr -> nx_ppp_rejected_list, &configure_status);
+
+ /* Discard invalid packet. */
+ if (status)
+ {
+ return;
+ }
/* Determine if the configuration request is fine or needs to be negotiated further. */
if (configure_status == 0)
@@ -3339,7 +3381,7 @@ NX_PACKET *packet_ptr;
/* FUNCTION RELEASE */
/* */
/* _nx_ppp_lcp_configuration_retrieve PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -3354,12 +3396,14 @@ NX_PACKET *packet_ptr;
/* ppp_ptr PPP instance pointer */
/* naked_list List of NAKed options */
/* rejected_list List of rejected options */
+/* configure_status Returned configration status: */
+/* 0 -> Success */
+/* 1 -> NAKed options */
+/* 2 -> Rejected options */
/* */
/* OUTPUT */
/* */
-/* 0 -> Success */
-/* 1 -> NAKed one or more options */
-/* 2 -> Rejected on or more options */
+/* status Completion status */
/* */
/* CALLS */
/* */
@@ -3376,19 +3420,26 @@ NX_PACKET *packet_ptr;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* improved packet length */
+/* verification, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
-UINT _nx_ppp_lcp_configuration_retrieve(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list)
+UINT _nx_ppp_lcp_configuration_retrieve(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list, UINT *configure_status)
{
UINT option_index, nak_list_index, rejected_list_index;
-UINT len, status = 0;
+UINT len;
UINT type;
UINT counter;
ULONG authentication_protocol;
UCHAR *option_data;
+ /* Initialize the configure status. */
+ *configure_status = 0;
+
/* Clear both the NAKed and rejected list length. */
naked_list[0] = 0;
rejected_list[0] = 0;
@@ -3409,7 +3460,9 @@ UCHAR *option_data;
/* Check if the length is valid. */
if ((len < 2) || (len > (packet_ptr -> nx_packet_length - (option_index - 2))))
- return(2);
+ {
+ return(NX_PPP_BAD_PACKET);
+ }
/* Set a pointer to option data. */
option_data = &packet_ptr -> nx_packet_prepend_ptr[option_index];
@@ -3429,7 +3482,7 @@ UCHAR *option_data;
/* Determine if the MRU is too small. */
if (ppp_ptr -> nx_ppp_mru < NX_PPP_MINIMUM_MRU)
{
- status |= 1;
+ *configure_status |= 1;
/* Default the MRU. */
ppp_ptr -> nx_ppp_mru = NX_PPP_MRU;
@@ -3482,7 +3535,7 @@ UCHAR *option_data;
/* Check to see if we don't have any authentication protocols enabled. */
if (ppp_ptr -> nx_ppp_generate_authentication_protocol == 0)
{
- status |= 2;
+ *configure_status |= 2;
/* Check if out of boundary. */
if ((rejected_list_index + len) > NX_PPP_OPTION_MESSAGE_LENGTH)
@@ -3500,7 +3553,7 @@ UCHAR *option_data;
/* Determine if this peer has PAP enabled. */
if (ppp_ptr -> nx_ppp_generate_authentication_protocol == NX_PPP_PAP_PROTOCOL)
{
- status |= 1;
+ *configure_status |= 1;
/* Check if out of boundary. */
if ((nak_list_index + 4) > NX_PPP_OPTION_MESSAGE_LENGTH)
@@ -3520,7 +3573,7 @@ UCHAR *option_data;
/* Determine if this peer has CHAP enabled. */
if (ppp_ptr -> nx_ppp_generate_authentication_protocol == NX_PPP_CHAP_PROTOCOL)
{
- status |= 1;
+ *configure_status |= 1;
/* Check if out of boundary. */
if ((nak_list_index + 5) > NX_PPP_OPTION_MESSAGE_LENGTH)
@@ -3547,7 +3600,7 @@ UCHAR *option_data;
/* Now determine if something other than CHAP MD5 was requested. */
if (option_data[2] != 0x05)
{
- status |= 1;
+ *configure_status |= 1;
/* Check if out of boundary. */
if ((nak_list_index + 5) > NX_PPP_OPTION_MESSAGE_LENGTH)
@@ -3587,7 +3640,7 @@ UCHAR *option_data;
default:
- status |= 2;
+ *configure_status |= 2;
/* Check if out of boundary. */
if ((rejected_list_index + len) > NX_PPP_OPTION_MESSAGE_LENGTH)
@@ -3602,9 +3655,15 @@ UCHAR *option_data;
break;
}
}
-
+
+ /* Check if packet length is valid. */
+ if (option_index != packet_ptr -> nx_packet_length)
+ {
+ return(NX_PPP_BAD_PACKET);
+ }
+
/* Return status. */
- return(status);
+ return(NX_SUCCESS);
}
@@ -6039,7 +6098,7 @@ UINT name_length;
/* FUNCTION RELEASE */
/* */
/* _nx_ppp_ipcp_state_machine_update PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -6080,6 +6139,10 @@ UINT name_length;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* corrected the NAKed list */
+/* pointer, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
void _nx_ppp_ipcp_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
@@ -6443,7 +6506,7 @@ UCHAR code;
/* Yes, there are rejected options so send a new request. */
_nx_ppp_ipcp_response_send(ppp_ptr, NX_PPP_IPCP_CONFIGURE_REJECT, &ppp_ptr -> nx_ppp_rejected_list[1], ppp_ptr -> nx_ppp_rejected_list[0], NX_NULL);
}
- else if (ppp_ptr -> nx_ppp_naked_list[0] != 0)
+ else if (ppp_ptr -> nx_ppp_peer_naked_list[0] != 0)
{
/* Yes, there are naked options so send a new request. */
@@ -6727,7 +6790,7 @@ UCHAR code;
/* FUNCTION RELEASE */
/* */
/* _nx_ppp_ipcp_configure_check PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -6765,6 +6828,10 @@ UCHAR code;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* improved packet length */
+/* verification, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _nx_ppp_ipcp_configure_check(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list, UCHAR *good_data)
@@ -6786,12 +6853,6 @@ UCHAR option;
/* Subtract 4 to remove the code, id, and length bytes from the length. */
length = length - 4;
- /* Check for valid packet length. */
- if ((length + 6) > packet_ptr -> nx_packet_length)
- {
- return(NX_FALSE);
- }
-
/* Initialize the rejected and naked lists. */
rejected_list[0] = naked_list[0] = good_data[0] = 0;
@@ -6832,7 +6893,7 @@ UCHAR option;
{
/* Check if out of boundary. */
- if ((good_index + 6) > NX_PPP_OPTION_MESSAGE_LENGTH)
+ if ((opt_length != 4) || ((good_index + 6) > NX_PPP_OPTION_MESSAGE_LENGTH))
return(NX_FALSE);
/* IP address option. */
@@ -6851,7 +6912,7 @@ UCHAR option;
}
/* Adjust the main index. */
- w += (opt_length + good_index);
+ w += 6;
/* Check if we really have an IP address. */
if (!ip_stat)
@@ -6906,8 +6967,8 @@ UCHAR option;
{
/* Check if out of boundary. */
- if ((good_index + 6) > NX_PPP_OPTION_MESSAGE_LENGTH)
- break;
+ if ((opt_length != 4) || ((good_index + 6) > NX_PPP_OPTION_MESSAGE_LENGTH))
+ return(NX_FALSE);
/* Only request a hint if we don't have already have a dns address . */
good_data[good_index++] = NX_PPP_DNS_SERVER_OPTION;
@@ -6924,7 +6985,7 @@ UCHAR option;
}
/* Adjust the main index. */
- w += (opt_length + 2);
+ w += 6;
/* Check if we really have an primary DNS address. */
if (!ip_stat)
@@ -6978,8 +7039,8 @@ UCHAR option;
{
/* Check if out of boundary. */
- if ((good_index + 6) > NX_PPP_OPTION_MESSAGE_LENGTH)
- break;
+ if ((opt_length != 4) || ((good_index + 6) > NX_PPP_OPTION_MESSAGE_LENGTH))
+ return(NX_FALSE);
/* Only request a hint if we don't have already have a dns address . */
good_data[good_index++] = NX_PPP_DNS_SECONDARY_SERVER_OPTION;
@@ -6996,7 +7057,7 @@ UCHAR option;
}
/* Adjust the main index. */
- w += (opt_length + 2);
+ w += 6;
/* Check if we really have an primary DNS address. */
if (!ip_stat)
@@ -7249,7 +7310,7 @@ UINT index;
/* FUNCTION RELEASE */
/* */
/* _nx_ppp_ipcp_response_extract PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -7283,6 +7344,10 @@ UINT index;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* improved packet length */
+/* verification, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
void _nx_ppp_ipcp_response_extract(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
@@ -7304,12 +7369,6 @@ ULONG length;
else
length = 0;
- /* Check for valid packet length. */
- if ((length + 6) > packet_ptr -> nx_packet_length)
- {
- return;
- }
-
/* Loop to parse the options to look for primary DNS address. */
i = 6;
while (length)
diff --git a/addons/ppp/nx_ppp.h b/addons/ppp/nx_ppp.h
index 2a5e90c8..854bc13e 100644
--- a/addons/ppp/nx_ppp.h
+++ b/addons/ppp/nx_ppp.h
@@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_ppp.h PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -45,6 +45,10 @@
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), */
+/* improved packet length */
+/* verification, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@@ -786,7 +790,7 @@ void _nx_ppp_lcp_state_machine_update(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr)
void _nx_ppp_lcp_code_reject(NX_PPP *ppp_ptr, UCHAR *lcp_ptr);
void _nx_ppp_lcp_configure_reply_send(NX_PPP *ppp_ptr, UINT configure_status, UCHAR *lcp_ptr, UCHAR *naked_list, UCHAR *rejected_list);
void _nx_ppp_lcp_configure_request_send(NX_PPP *ppp_ptr);
-UINT _nx_ppp_lcp_configuration_retrieve(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list);
+UINT _nx_ppp_lcp_configuration_retrieve(NX_PPP *ppp_ptr, NX_PACKET *packet_ptr, UCHAR *naked_list, UCHAR *rejected_list, UINT *configure_status);
void _nx_ppp_lcp_nak_configure_list(NX_PPP *ppp_ptr, UCHAR *naked_list);
void _nx_ppp_lcp_terminate_ack_send(NX_PPP *ppp_ptr);
void _nx_ppp_lcp_terminate_request_send(NX_PPP *ppp_ptr);
diff --git a/common/inc/nx_api.h b/common/inc/nx_api.h
index 959ea52d..cd56b4eb 100644
--- a/common/inc/nx_api.h
+++ b/common/inc/nx_api.h
@@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_api.h PORTABLE C */
-/* 6.1 */
+/* 6.1.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@@ -49,6 +49,9 @@
/* ThreadX version check, */
/* updated product constants, */
/* resulting in version 6.1 */
+/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
+/* updated product constants, */
+/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@@ -456,7 +459,7 @@ VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG
#define AZURE_RTOS_NETXDUO
#define NETXDUO_MAJOR_VERSION 6
#define NETXDUO_MINOR_VERSION 1
-#define NETXDUO_PATCH_VERSION 0
+#define NETXDUO_PATCH_VERSION 2
/* Define the following symbols for backward compatibility */
#define EL_PRODUCT_NETXDUO