diff --git a/obuspa/Makefile b/obuspa/Makefile index c7cb90b91..a9d7fa795 100644 --- a/obuspa/Makefile +++ b/obuspa/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=obuspa -PKG_VERSION:=9.0.4.17 +PKG_VERSION:=10.0.0.1 LOCAL_DEV:=0 ifneq ($(LOCAL_DEV),1) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git -PKG_SOURCE_VERSION:=9bd0c3c895cbcf34b922329c55a8262180b1fa86 +PKG_SOURCE_VERSION:=38b2ab47516bb2e6dd673406109b5df7af004a05 PKG_MAINTAINER:=Vivek Dutta PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_MIRROR_HASH:=skip diff --git a/obuspa/patches/0001-fix_segfault_invalid_uds.patch b/obuspa/patches/0001-fix_segfault_invalid_uds.patch index 606644f8d..a2b8a8ee8 100644 --- a/obuspa/patches/0001-fix_segfault_invalid_uds.patch +++ b/obuspa/patches/0001-fix_segfault_invalid_uds.patch @@ -1,6 +1,8 @@ ---- a/src/core/device_uds.c -+++ b/src/core/device_uds.c -@@ -182,10 +182,7 @@ int DEVICE_UDS_Start(void) +Index: obuspa-10.0.0.1/src/core/device_uds.c +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/device_uds.c ++++ obuspa-10.0.0.1/src/core/device_uds.c +@@ -183,10 +183,7 @@ int DEVICE_UDS_Start(void) USP_SNPRINTF(path, sizeof(path), "%s.%d", device_uds_conn_root, instance); USP_LOG_Warning("%s: Deleting %s as it contained invalid parameters.", __FUNCTION__, path); err = DATA_MODEL_DeleteInstance(path, 0); diff --git a/obuspa/patches/0002-fix_e2e_session_init.patch b/obuspa/patches/0002-fix_e2e_session_init.patch index 2476b8d15..7b9b5d008 100644 --- a/obuspa/patches/0002-fix_e2e_session_init.patch +++ b/obuspa/patches/0002-fix_e2e_session_init.patch @@ -1,8 +1,8 @@ -Index: obuspa-9.0.0.25/src/core/device_controller.c +Index: obuspa-10.0.0.1/src/core/device_controller.c =================================================================== ---- obuspa-9.0.0.25.orig/src/core/device_controller.c -+++ obuspa-9.0.0.25/src/core/device_controller.c -@@ -4210,6 +4210,14 @@ int ProcessControllerAdded(int cont_inst +--- obuspa-10.0.0.1.orig/src/core/device_controller.c ++++ obuspa-10.0.0.1/src/core/device_controller.c +@@ -4211,6 +4211,14 @@ int ProcessControllerAdded(int cont_inst goto exit; } @@ -17,7 +17,7 @@ Index: obuspa-9.0.0.25/src/core/device_controller.c // Exit if unable to get the object instance numbers present in this controller's MTP table USP_SNPRINTF(path, sizeof(path), "%s.%d.MTP", device_cont_root, cont_instance); err = DATA_MODEL_GetInstances(path, &iv); -@@ -4251,14 +4259,6 @@ int ProcessControllerAdded(int cont_inst +@@ -4252,14 +4260,6 @@ int ProcessControllerAdded(int cont_inst DEVICE_MQTT_UpdateControllerTopics(); #endif diff --git a/obuspa/patches/0003-Return-error-when-XSI-compliant-strerror_r-fails-in-.patch b/obuspa/patches/0003-Return-error-when-XSI-compliant-strerror_r-fails-in-.patch index 6ba4db775..b0fccd178 100644 --- a/obuspa/patches/0003-Return-error-when-XSI-compliant-strerror_r-fails-in-.patch +++ b/obuspa/patches/0003-Return-error-when-XSI-compliant-strerror_r-fails-in-.patch @@ -1,6 +1,8 @@ ---- a/src/core/usp_err.c -+++ b/src/core/usp_err.c -@@ -189,7 +189,9 @@ char *USP_ERR_ToString(int err, char *bu +Index: obuspa-10.0.0.1/src/core/usp_err.c +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/usp_err.c ++++ obuspa-10.0.0.1/src/core/usp_err.c +@@ -190,7 +190,9 @@ char *USP_ERR_ToString(int err, char *bu { #if HAVE_STRERROR_R && !STRERROR_R_CHAR_P // XSI version of strerror_r diff --git a/obuspa/patches/0004-bulkdata_extn.patch b/obuspa/patches/0004-bulkdata_extn.patch index cd8a03de1..6865c16eb 100644 --- a/obuspa/patches/0004-bulkdata_extn.patch +++ b/obuspa/patches/0004-bulkdata_extn.patch @@ -1,8 +1,8 @@ -diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c -index dc30a98..6a2938b 100644 ---- a/src/core/bdc_exec.c -+++ b/src/core/bdc_exec.c -@@ -548,10 +548,25 @@ int StartSendingReport(bdc_connection_t *bc) +Index: obuspa-10.0.0.1/src/core/bdc_exec.c +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/bdc_exec.c ++++ obuspa-10.0.0.1/src/core/bdc_exec.c +@@ -549,10 +549,25 @@ int StartSendingReport(bdc_connection_t // Set the list of headers bc->headers = NULL; @@ -30,26 +30,26 @@ index dc30a98..6a2938b 100644 bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip"); } -diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h -index 8c259c5..6322221 100644 ---- a/src/core/bdc_exec.h -+++ b/src/core/bdc_exec.h -@@ -53,6 +53,8 @@ void BDC_EXEC_ScheduleExit(void); +Index: obuspa-10.0.0.1/src/core/bdc_exec.h +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/bdc_exec.h ++++ obuspa-10.0.0.1/src/core/bdc_exec.h +@@ -54,6 +54,8 @@ void BDC_EXEC_ScheduleExit(void); #define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server #define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped #define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post. - - -+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be json ObjectHierarchy ++#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be json ObjectHierarchy +#define BDC_FLAG_HEADER_NAME_VAL 0x00000010 // If set, report format in header would be json NameValuePair +#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow +#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn #endif -diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c -index 915b282..f799793 100755 ---- a/src/core/device_bulkdata.c -+++ b/src/core/device_bulkdata.c -@@ -70,8 +70,12 @@ +Index: obuspa-10.0.0.1/src/core/device_bulkdata.c +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c ++++ obuspa-10.0.0.1/src/core/device_bulkdata.c +@@ -71,8 +71,12 @@ //------------------------------------------------------------------------------ // Definitions for formats that we support @@ -64,7 +64,7 @@ index 915b282..f799793 100755 // Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp -@@ -161,6 +165,7 @@ static char *profile_push_event_args[] = +@@ -162,6 +166,7 @@ static char *profile_push_event_args[] = typedef struct { int num_retained_failed_reports; @@ -72,7 +72,7 @@ index 915b282..f799793 100755 #ifdef ENABLE_MQTT char mqtt_reference[254]; // relates to Device.BulkData.Profile.{i}.MQTT.Reference char mqtt_publish_topic[254]; // relates to Device.BulkData.Profile.{i}.MQTT.PublishTopic -@@ -171,6 +176,12 @@ typedef struct +@@ -172,6 +177,12 @@ typedef struct char password[257]; char compression[9]; char method[9]; @@ -85,7 +85,7 @@ index 915b282..f799793 100755 bool use_date_header; } profile_ctrl_params_t; -@@ -219,6 +230,7 @@ int Validate_BulkDataEncodingType(dm_req_t *req, char *value); +@@ -220,6 +231,7 @@ int Validate_BulkDataEncodingType(dm_req int Validate_BulkDataReportingInterval(dm_req_t *req, char *value); int Validate_BulkDataReference(dm_req_t *req, char *value); int Validate_BulkDataReportFormat(dm_req_t *req, char *value); @@ -93,7 +93,7 @@ index 915b282..f799793 100755 int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value); int Validate_BulkDataCompression(dm_req_t *req, char *value); int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value); -@@ -246,7 +258,8 @@ bulkdata_profile_t *bulkdata_find_free_profile(void); +@@ -247,7 +259,8 @@ bulkdata_profile_t *bulkdata_find_free_p bulkdata_profile_t *bulkdata_find_profile(int profile_id); int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map); int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len); @@ -103,7 +103,7 @@ index 915b282..f799793 100755 unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len); int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len); int bulkdata_start_profile(bulkdata_profile_t *bp); -@@ -261,6 +274,8 @@ char *bulkdata_platform_calc_uri_query_string(kv_vector_t *escaped_map); +@@ -262,6 +275,8 @@ char *bulkdata_platform_calc_uri_query_s int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs); void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv); void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map); @@ -112,7 +112,7 @@ index 915b282..f799793 100755 #ifdef ENABLE_MQTT int Validate_BulkDataMqttReference(dm_req_t *req, char *value); void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp); -@@ -298,7 +313,7 @@ int DEVICE_BULKDATA_Init(void) +@@ -299,7 +314,7 @@ int DEVICE_BULKDATA_Init(void) err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING); err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT); err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols)); @@ -121,7 +121,7 @@ index 915b282..f799793 100755 err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL); err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT); err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT); -@@ -313,7 +328,7 @@ int DEVICE_BULKDATA_Init(void) +@@ -314,7 +329,7 @@ int DEVICE_BULKDATA_Init(void) err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING); @@ -130,7 +130,7 @@ index 915b282..f799793 100755 err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME); -@@ -325,9 +340,16 @@ int DEVICE_BULKDATA_Init(void) +@@ -326,9 +341,16 @@ int DEVICE_BULKDATA_Init(void) err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING); // Device.BulkData.Profile.{i}.JSONEncoding @@ -148,7 +148,7 @@ index 915b282..f799793 100755 // Device.BulkData.Profile.{i}.HTTP err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING); -@@ -613,9 +635,10 @@ int Validate_BulkDataProtocol(dm_req_t *req, char *value) +@@ -614,9 +636,10 @@ int Validate_BulkDataProtocol(dm_req_t * int Validate_BulkDataEncodingType(dm_req_t *req, char *value) { // Exit if trying to set a value outside of the range we accept @@ -162,7 +162,7 @@ index 915b282..f799793 100755 return USP_ERR_INVALID_VALUE; } -@@ -719,9 +742,36 @@ int Validate_BulkDataReference(dm_req_t *req, char *value) +@@ -720,9 +743,36 @@ int Validate_BulkDataReference(dm_req_t int Validate_BulkDataReportFormat(dm_req_t *req, char *value) { // Exit if trying to set a value outside of the range we accept @@ -201,7 +201,7 @@ index 915b282..f799793 100755 return USP_ERR_INVALID_VALUE; } -@@ -2052,6 +2102,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile +@@ -2053,6 +2103,14 @@ int bulkdata_platform_get_profile_contro return err; } @@ -216,7 +216,7 @@ index 915b282..f799793 100755 // Exit if unable to get ReportTimestamp USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id); err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0); -@@ -2060,6 +2118,54 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile +@@ -2061,6 +2119,54 @@ int bulkdata_platform_get_profile_contro return err; } @@ -271,7 +271,7 @@ index 915b282..f799793 100755 #ifdef ENABLE_MQTT { char protocol[32]; -@@ -2333,7 +2439,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp) +@@ -2334,7 +2440,7 @@ void bulkdata_process_profile_http(bulkd { int err; report_t *cur_report; @@ -280,7 +280,7 @@ index 915b282..f799793 100755 profile_ctrl_params_t ctrl; unsigned char *compressed_report; int compressed_len; -@@ -2372,10 +2478,23 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp) +@@ -2373,10 +2479,23 @@ void bulkdata_process_profile_http(bulkd } // Exit if unable to generate the report @@ -308,7 +308,7 @@ index 915b282..f799793 100755 return; } -@@ -2384,14 +2503,14 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp) +@@ -2385,14 +2504,14 @@ void bulkdata_process_profile_http(bulkd USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression); if (enable_protocol_trace) { @@ -327,7 +327,7 @@ index 915b282..f799793 100755 } // NOTE: From this point on, only the compressed_report exists -@@ -2421,8 +2540,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp) +@@ -2422,8 +2541,15 @@ void bulkdata_process_profile_usp_event( kv_vector_t event_args; kv_pair_t kv; report_t *cur_report; @@ -344,7 +344,7 @@ index 915b282..f799793 100755 // Exit if the MTP has not been connected to successfully after bootup // This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP). -@@ -2431,13 +2557,63 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp) +@@ -2432,13 +2558,63 @@ void bulkdata_process_profile_usp_event( goto exit; } @@ -361,7 +361,7 @@ index 915b282..f799793 100755 + if (err != USP_ERR_OK) { + return; + } -+ ++ + if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) { + // Exit if unable to get ReportTimestamp + USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id); @@ -415,7 +415,7 @@ index 915b282..f799793 100755 // When sending via USP events, only one report is ever sent in each USP event // So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports -@@ -2455,11 +2631,17 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp) +@@ -2456,11 +2632,17 @@ void bulkdata_process_profile_usp_event( } bp->num_retained_reports = 1; @@ -436,7 +436,7 @@ index 915b282..f799793 100755 return; } -@@ -2467,15 +2649,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp) +@@ -2468,15 +2650,15 @@ void bulkdata_process_profile_usp_event( // Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add() kv.key = "Data"; @@ -455,7 +455,7 @@ index 915b282..f799793 100755 // From the point of view of this code, the report(s) have been successfully sent, so don't retain them // NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism -@@ -2547,11 +2729,24 @@ void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp) +@@ -2548,11 +2730,24 @@ void bulkdata_process_profile_mqtt(bulkd } // Exit if unable to generate the report @@ -483,9 +483,9 @@ index 915b282..f799793 100755 + USP_ERR_SetMessage("%s: bulkdata invalid report encoding type %s", __FUNCTION__, ctrl.encoding_type); + return; } - + // Print out the JSON report, if debugging is enabled -@@ -2762,7 +2957,7 @@ int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *ou +@@ -2763,7 +2958,7 @@ int bulkdata_reduce_to_alt_name(char *sp ** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send ** **************************************************************************/ @@ -494,7 +494,7 @@ index 915b282..f799793 100755 { JsonNode *top; // top of report JsonNode *array; // array of reports (retained + current) -@@ -2867,6 +3062,483 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta +@@ -2868,6 +3063,483 @@ char *bulkdata_generate_json_report(bulk return result; } @@ -978,7 +978,7 @@ index 915b282..f799793 100755 /*********************************************************************//** ** ** bulkdata_compress_report -@@ -3070,6 +3742,20 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_ +@@ -3071,6 +3743,20 @@ int bulkdata_schedule_sending_http_repor flags |= BDC_FLAG_DATE_HEADER; } diff --git a/obuspa/patches/0005-CTrust-SecureRoles.patch b/obuspa/patches/0005-CTrust-SecureRoles.patch index c49e18b52..1d5e455d5 100644 --- a/obuspa/patches/0005-CTrust-SecureRoles.patch +++ b/obuspa/patches/0005-CTrust-SecureRoles.patch @@ -1,16 +1,16 @@ -Index: obuspa-9.0.4.3/src/core/data_model.c +Index: obuspa-10.0.0.1/src/core/data_model.c =================================================================== ---- obuspa-9.0.4.3.orig/src/core/data_model.c -+++ obuspa-9.0.4.3/src/core/data_model.c -@@ -57,6 +57,7 @@ - #include "iso8601.h" +--- obuspa-10.0.0.1.orig/src/core/data_model.c ++++ obuspa-10.0.0.1/src/core/data_model.c +@@ -59,6 +59,7 @@ #include "group_get_vector.h" + #include "inst_sel_vector.h" #include "plugin.h" +#include "device_ctrust.h" #ifdef ENABLE_COAP #include "usp_coap.h" -@@ -507,6 +508,14 @@ int DATA_MODEL_GetParameterValue(char *p +@@ -510,6 +511,14 @@ int DATA_MODEL_GetParameterValue(char *p return USP_ERR_INVALID_PATH; } @@ -25,7 +25,7 @@ Index: obuspa-9.0.4.3/src/core/data_model.c // NOTE: We do not check 'is_qualified_instance' here, because the only time it would be unqualified, is if the // path represented a multi-instance object. If path does represent this, then it will be caught below (switch statement) -@@ -537,8 +546,8 @@ int DATA_MODEL_GetParameterValue(char *p +@@ -541,8 +550,8 @@ int DATA_MODEL_GetParameterValue(char *p break; case kDMNodeType_DBParam_Secure: @@ -36,19 +36,19 @@ Index: obuspa-9.0.4.3/src/core/data_model.c { *buf = '\0'; break; -Index: obuspa-9.0.4.3/src/core/device_ctrust.c +Index: obuspa-10.0.0.1/src/core/device_ctrust.c =================================================================== ---- obuspa-9.0.4.3.orig/src/core/device_ctrust.c -+++ obuspa-9.0.4.3/src/core/device_ctrust.c -@@ -64,6 +64,7 @@ - #include "text_utils.h" +--- obuspa-10.0.0.1.orig/src/core/device_ctrust.c ++++ obuspa-10.0.0.1/src/core/device_ctrust.c +@@ -66,6 +66,7 @@ #include "dm_inst_vector.h" + #include "inst_sel_vector.h" #include "database.h" +#include "device_ctrust.h" //------------------------------------------------------------------------------ // Location of the controller trust tables within the data model -@@ -228,6 +229,7 @@ credential_t *FindCredentialByCertInstan +@@ -235,6 +236,7 @@ credential_t *FindCredentialByCertInstan int Get_CredentialRole(dm_req_t *req, char *buf, int len); int Get_CredentialCertificate(dm_req_t *req, char *buf, int len); int Get_CredentialNumEntries(dm_req_t *req, char *buf, int len); @@ -56,7 +56,7 @@ Index: obuspa-9.0.4.3/src/core/device_ctrust.c #ifndef REMOVE_DEVICE_SECURITY int InitChallengeTable(); -@@ -347,6 +349,10 @@ int DEVICE_CTRUST_Init(void) +@@ -354,6 +356,10 @@ int DEVICE_CTRUST_Init(void) challenge_response_input_args, NUM_ELEM(challenge_response_input_args), NULL, 0); #endif @@ -67,7 +67,7 @@ Index: obuspa-9.0.4.3/src/core/device_ctrust.c // Exit if any errors occurred if (err != USP_ERR_OK) { -@@ -2793,3 +2799,128 @@ exit: +@@ -2908,3 +2914,128 @@ exit: return err; } #endif // REMOVE_DEVICE_SECURITY @@ -196,10 +196,10 @@ Index: obuspa-9.0.4.3/src/core/device_ctrust.c + + return false; +} -Index: obuspa-9.0.4.3/src/core/device_ctrust.h +Index: obuspa-10.0.0.1/src/core/device_ctrust.h =================================================================== --- /dev/null -+++ obuspa-9.0.4.3/src/core/device_ctrust.h ++++ obuspa-10.0.0.1/src/core/device_ctrust.h @@ -0,0 +1,48 @@ +/* + * @@ -249,11 +249,11 @@ Index: obuspa-9.0.4.3/src/core/device_ctrust.h +bool DEVICE_CTRUST_IsControllerSecured(void); + +#endif -Index: obuspa-9.0.4.3/src/include/usp_api.h +Index: obuspa-10.0.0.1/src/include/usp_api.h =================================================================== ---- obuspa-9.0.4.3.orig/src/include/usp_api.h -+++ obuspa-9.0.4.3/src/include/usp_api.h -@@ -418,6 +418,7 @@ typedef struct +--- obuspa-10.0.0.1.orig/src/include/usp_api.h ++++ obuspa-10.0.0.1/src/include/usp_api.h +@@ -422,6 +422,7 @@ typedef struct #define DM_DECIMAL 0x00000100 // 64 bit floating point number (double) #define DM_LONG 0x00000200 // 64 bit signed integer (long long) #define DM_VALUE_CHANGE_WILL_IGNORE 0x00000400 // Do not emit value change notifications for this parameter @@ -261,11 +261,11 @@ Index: obuspa-9.0.4.3/src/include/usp_api.h //------------------------------------------------------------------------- // Functions to register the data model -Index: obuspa-9.0.4.3/src/core/group_get_vector.c +Index: obuspa-10.0.0.1/src/core/group_get_vector.c =================================================================== ---- obuspa-9.0.4.3.orig/src/core/group_get_vector.c -+++ obuspa-9.0.4.3/src/core/group_get_vector.c -@@ -49,6 +49,16 @@ +--- obuspa-10.0.0.1.orig/src/core/group_get_vector.c ++++ obuspa-10.0.0.1/src/core/group_get_vector.c +@@ -50,6 +50,16 @@ #include "group_get_vector.h" #include "int_vector.h" #include "data_model.h" @@ -282,7 +282,7 @@ Index: obuspa-9.0.4.3/src/core/group_get_vector.c //------------------------------------------------------------------------------ // Forward declarations. Note these are not static, because we need them in the symbol table for USP_LOG_Callstack() to show them -@@ -282,14 +292,14 @@ void GROUP_GET_VECTOR_GetValues(group_ge +@@ -283,14 +293,14 @@ void GROUP_GET_VECTOR_GetValues(group_ge return; #endif @@ -299,7 +299,7 @@ Index: obuspa-9.0.4.3/src/core/group_get_vector.c gge->err_code = DATA_MODEL_GetParameterValue(gge->path, buf, sizeof(buf), 0); if (gge->err_code != USP_ERR_OK) { -@@ -320,7 +330,6 @@ void GROUP_GET_VECTOR_GetValues(group_ge +@@ -321,7 +331,6 @@ void GROUP_GET_VECTOR_GetValues(group_ge chunk_size = MIN(GROUP_GET_CHUNK_SIZE, iv->num_entries - start_index); GetParameterGroup(i, ggv, iv, start_index, chunk_size); } @@ -307,7 +307,7 @@ Index: obuspa-9.0.4.3/src/core/group_get_vector.c } } -@@ -378,88 +387,101 @@ void GetParameterGroup(int group_id, gro +@@ -379,88 +388,101 @@ void GetParameterGroup(int group_id, gro return; } @@ -467,7 +467,7 @@ Index: obuspa-9.0.4.3/src/core/group_get_vector.c } /*********************************************************************//** -@@ -486,9 +508,10 @@ void GetParametersIndividually(group_get +@@ -487,9 +509,10 @@ void GetParametersIndividually(group_get for (i=0; i < ggv->num_entries; i++) { gge = &ggv->vector[i]; @@ -479,7 +479,7 @@ Index: obuspa-9.0.4.3/src/core/group_get_vector.c gge->err_code = DATA_MODEL_GetParameterValue(gge->path, buf, sizeof(buf), 0); if (gge->err_code == USP_ERR_OK) { -@@ -497,42 +520,51 @@ void GetParametersIndividually(group_get +@@ -498,42 +521,51 @@ void GetParametersIndividually(group_get } else { @@ -555,7 +555,7 @@ Index: obuspa-9.0.4.3/src/core/group_get_vector.c } } } -@@ -545,3 +577,4 @@ void GetParametersIndividually(group_get +@@ -546,3 +578,4 @@ void GetParametersIndividually(group_get } } } diff --git a/obuspa/patches/0006-contains-expression.patch b/obuspa/patches/0006-contains-expression.patch index f57233efb..e91b7fce0 100644 --- a/obuspa/patches/0006-contains-expression.patch +++ b/obuspa/patches/0006-contains-expression.patch @@ -1,8 +1,8 @@ -Index: obuspa-9.0.4.11/src/core/expr_vector.c +Index: obuspa-10.0.0.1/src/core/expr_vector.c =================================================================== ---- obuspa-9.0.4.11.orig/src/core/expr_vector.c -+++ obuspa-9.0.4.11/src/core/expr_vector.c -@@ -58,6 +58,7 @@ char *expr_op_2_str[kExprOp_Max] = +--- obuspa-10.0.0.1.orig/src/core/expr_vector.c ++++ obuspa-10.0.0.1/src/core/expr_vector.c +@@ -59,6 +59,7 @@ char *expr_op_2_str[kExprOp_Max] = "<", // kExprOp_LessThan ">", // kExprOp_GreaterThan "=", // kExprOp_Equals @@ -10,7 +10,7 @@ Index: obuspa-9.0.4.11/src/core/expr_vector.c }; -@@ -482,6 +483,15 @@ char *SplitOnOperator(char *buf, expr_op +@@ -483,6 +484,15 @@ char *SplitOnOperator(char *buf, expr_op *op = '\0'; return &op[2]; } @@ -26,20 +26,20 @@ Index: obuspa-9.0.4.11/src/core/expr_vector.c // Exit if found the "<" operator op = strchr(buf, '<'); -Index: obuspa-9.0.4.11/src/core/path_resolver.c +Index: obuspa-10.0.0.1/src/core/path_resolver.c =================================================================== ---- obuspa-9.0.4.11.orig/src/core/path_resolver.c -+++ obuspa-9.0.4.11/src/core/path_resolver.c -@@ -1481,7 +1481,7 @@ int ResolveUniqueKey(char *resolved, cha +--- obuspa-10.0.0.1.orig/src/core/path_resolver.c ++++ obuspa-10.0.0.1/src/core/path_resolver.c +@@ -1088,7 +1088,7 @@ int ResolveUniqueKey(char *resolved, cha char temp[MAX_DM_PATH]; bool is_match; bool is_ref_match; - expr_op_t valid_ops[] = {kExprOp_Equal, kExprOp_NotEqual, kExprOp_LessThanOrEqual, kExprOp_GreaterThanOrEqual, kExprOp_LessThan, kExprOp_GreaterThan}; + expr_op_t valid_ops[] = {kExprOp_Equal, kExprOp_NotEqual, kExprOp_LessThanOrEqual, kExprOp_GreaterThanOrEqual, kExprOp_LessThan, kExprOp_GreaterThan, kExprOp_Contains}; - unsigned short permission_bitmask; // Exit if unable to find the end of the unique key -@@ -1815,6 +1815,67 @@ int DoUniqueKeysMatch(int index, search_ + p = strchr(unresolved, ']'); +@@ -1754,6 +1754,67 @@ int DoUniqueKeysMatch(int index, search_ } USP_ASSERT(gge->value != NULL); // GROUP_GET_VECTOR_GetValues() should have set an error message if the vendor hook didn't set a value for the parameter @@ -107,11 +107,11 @@ Index: obuspa-9.0.4.11/src/core/path_resolver.c // Determine the function to call to perform the comparison if (type_flags & (DM_INT | DM_UINT | DM_ULONG | DM_LONG | DM_DECIMAL)) { -Index: obuspa-9.0.4.11/src/include/usp_api.h +Index: obuspa-10.0.0.1/src/include/usp_api.h =================================================================== ---- obuspa-9.0.4.11.orig/src/include/usp_api.h -+++ obuspa-9.0.4.11/src/include/usp_api.h -@@ -105,6 +105,7 @@ typedef enum +--- obuspa-10.0.0.1.orig/src/include/usp_api.h ++++ obuspa-10.0.0.1/src/include/usp_api.h +@@ -106,6 +106,7 @@ typedef enum kExprOp_LessThan, // '<' kExprOp_GreaterThan, // '>' kExprOp_Equals, // '=' diff --git a/obuspa/patches/1000-suppress-logs.patch b/obuspa/patches/1000-suppress-logs.patch index dc2af7ecd..6d573e4da 100644 --- a/obuspa/patches/1000-suppress-logs.patch +++ b/obuspa/patches/1000-suppress-logs.patch @@ -1,8 +1,8 @@ -Index: obuspa-9.0.4.1/src/core/cli_server.c +Index: obuspa-10.0.0.1/src/core/cli_server.c =================================================================== ---- obuspa-9.0.4.1.orig/src/core/cli_server.c -+++ obuspa-9.0.4.1/src/core/cli_server.c -@@ -715,10 +715,6 @@ int ExecuteCli_Get(str_vector_t *args) +--- obuspa-10.0.0.1.orig/src/core/cli_server.c ++++ obuspa-10.0.0.1/src/core/cli_server.c +@@ -724,10 +724,6 @@ int ExecuteCli_Get(str_vector_t *args) USP_ASSERT(gge->value != NULL); SendCliResponse("%s => %s\n", gge->path, gge->value); } @@ -13,11 +13,11 @@ Index: obuspa-9.0.4.1/src/core/cli_server.c } GROUP_GET_VECTOR_Destroy(&ggv); -Index: obuspa-9.0.4.1/src/core/data_model.c +Index: obuspa-10.0.0.1/src/core/data_model.c =================================================================== ---- obuspa-9.0.4.1.orig/src/core/data_model.c -+++ obuspa-9.0.4.1/src/core/data_model.c -@@ -1316,7 +1316,7 @@ int DATA_MODEL_NotifyInstanceAdded(char +--- obuspa-10.0.0.1.orig/src/core/data_model.c ++++ obuspa-10.0.0.1/src/core/data_model.c +@@ -1330,7 +1330,7 @@ int DATA_MODEL_NotifyInstanceAdded(char // Exit if instance already exists - nothing to do if (exists) { @@ -26,7 +26,7 @@ Index: obuspa-9.0.4.1/src/core/data_model.c return USP_ERR_CREATION_FAILURE; } -@@ -1404,7 +1404,7 @@ int DATA_MODEL_NotifyInstanceDeleted(cha +@@ -1418,7 +1418,7 @@ int DATA_MODEL_NotifyInstanceDeleted(cha // Exit if instance does not exist - nothing to do if (exists == false) { diff --git a/obuspa/patches/1001-use-datamodel-caching.patch b/obuspa/patches/1001-use-datamodel-caching.patch index c0d2961a0..5220fe75d 100644 --- a/obuspa/patches/1001-use-datamodel-caching.patch +++ b/obuspa/patches/1001-use-datamodel-caching.patch @@ -1,8 +1,14 @@ -Index: obuspa-9.0.4.1/src/core/cli_server.c -=================================================================== ---- obuspa-9.0.4.1.orig/src/core/cli_server.c -+++ obuspa-9.0.4.1/src/core/cli_server.c -@@ -501,6 +501,7 @@ int CLI_SERVER_ExecuteCliCommand(char *c +commit 7bb794c3d8bbdcf4aa39f8c28f1fabcda11487b9 +Author: Vivek Kumar Dutta +Date: Wed Apr 30 17:18:27 2025 +0530 + + 1001-use-datamodel-caching.patch + +diff --git a/src/core/cli_server.c b/src/core/cli_server.c +index da61c6f..abac7cb 100644 +--- a/src/core/cli_server.c ++++ b/src/core/cli_server.c +@@ -511,6 +511,7 @@ int CLI_SERVER_ExecuteCliCommand(char *cmd_line) SendCliResponse("WARNING: Discarding unused args: %s\n", args.vector[cli_cmd->max_args+1]); } @@ -10,36 +16,34 @@ Index: obuspa-9.0.4.1/src/core/cli_server.c // Process command err = cli_cmd->exec_cmd(&args); print_help = false; -@@ -683,6 +684,13 @@ int ExecuteCli_Get(str_vector_t *args) - } - #endif +@@ -670,6 +671,11 @@ int ExecuteCli_Version(str_vector_t *args) + int ExecuteCli_Get(str_vector_t *args) + { + combined_role_t *combined_role; ++ ++ char *path[2] = {args->vector[1], 0}; ++ ++ vendor_create_dm_cache(path, 1); ++ + #ifndef REMOVE_USP_BROKER + char *arg1; -+ if (arg1 != NULL) { -+ char *path[2] = {0}; -+ -+ path[0] = arg1; -+ vendor_create_dm_cache(path, 1); -+ } -+ - // Exit if unable to get a list of all parameters referenced by the expression - STR_VECTOR_Init(¶ms); - INT_VECTOR_Init(&group_ids); -Index: obuspa-9.0.4.1/src/core/data_model.h -=================================================================== ---- obuspa-9.0.4.1.orig/src/core/data_model.h -+++ obuspa-9.0.4.1/src/core/data_model.h -@@ -370,5 +370,6 @@ int DM_PRIV_ReRegister_DBParam_Default(c +diff --git a/src/core/data_model.h b/src/core/data_model.h +index 7564127..2736d7c 100755 +--- a/src/core/data_model.h ++++ b/src/core/data_model.h +@@ -405,5 +405,6 @@ int DM_PRIV_ReRegister_DBParam_Default(char *path, char *value); bool DM_PRIV_IsChildNodeOf(dm_node_t *node, dm_node_t *parent_node); void DM_PRIV_GetAllEventsAndCommands(dm_node_t *node, str_vector_t *events, str_vector_t *commands); +int vendor_create_dm_cache(char *paths[], int num_paths); #endif -Index: obuspa-9.0.4.1/src/core/handle_get.c -=================================================================== ---- obuspa-9.0.4.1.orig/src/core/handle_get.c -+++ obuspa-9.0.4.1/src/core/handle_get.c -@@ -123,6 +123,7 @@ void MSG_HANDLER_HandleGet(Usp__Msg *usp +diff --git a/src/core/handle_get.c b/src/core/handle_get.c +index d9d3e9e..c263978 100644 +--- a/src/core/handle_get.c ++++ b/src/core/handle_get.c +@@ -129,6 +129,7 @@ void MSG_HANDLER_HandleGet(Usp__Msg *usp, char *controller_endpoint, mtp_conn_t goto exit; } @@ -47,11 +51,11 @@ Index: obuspa-9.0.4.1/src/core/handle_get.c // Calculate the number of hierarchical levels to traverse in the data model when performing partial path resolution // NOTE: protocol buffer has depth as an unsigned quantity, but internally we use a signed number, so limit range to that of a signed number depth = usp->body->request->get->max_depth; -Index: obuspa-9.0.4.1/src/core/msg_handler.c -=================================================================== ---- obuspa-9.0.4.1.orig/src/core/msg_handler.c -+++ obuspa-9.0.4.1/src/core/msg_handler.c -@@ -862,6 +862,8 @@ int HandleUspMessage(Usp__Msg *usp, char +diff --git a/src/core/msg_handler.c b/src/core/msg_handler.c +index 647591d..b7498d8 100755 +--- a/src/core/msg_handler.c ++++ b/src/core/msg_handler.c +@@ -863,6 +863,8 @@ int HandleUspMessage(Usp__Msg *usp, char *endpoint_id, mtp_conn_t *mtpc) MSG_HANDLER_UspMsgTypeToString(usp->header->msg_type), iso8601_cur_time(buf, sizeof(buf)) ); diff --git a/obuspa/patches/1002-mqtt-qos.patch b/obuspa/patches/1002-mqtt-qos.patch index e7261d0db..e3475a757 100644 --- a/obuspa/patches/1002-mqtt-qos.patch +++ b/obuspa/patches/1002-mqtt-qos.patch @@ -1,6 +1,8 @@ ---- a/src/core/device_bulkdata.c 2025-02-18 16:49:27.507575767 +0530 -+++ b/src/core/device_bulkdata.c 2025-02-18 16:51:45.535693108 +0530 -@@ -374,6 +374,8 @@ +Index: obuspa-10.0.0.1/src/core/device_bulkdata.c +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c ++++ obuspa-10.0.0.1/src/core/device_bulkdata.c +@@ -375,6 +375,8 @@ int DEVICE_BULKDATA_Init(void) // Device.BulkData.Profile.{i}.MQTT err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.Reference", "", Validate_BulkDataMqttReference, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.PublishTopic", "", NULL, NULL, DM_STRING); diff --git a/obuspa/patches/1003-ct-full-access-rename.patch b/obuspa/patches/1003-ct-full-access-rename.patch index ebf4dc897..8ebfe19af 100644 --- a/obuspa/patches/1003-ct-full-access-rename.patch +++ b/obuspa/patches/1003-ct-full-access-rename.patch @@ -1,8 +1,8 @@ -diff --git a/src/core/data_model.c b/src/core/data_model.c -index 360c5e2..136de0d 100644 ---- a/src/core/data_model.c -+++ b/src/core/data_model.c -@@ -5180,7 +5180,7 @@ int RegisterDefaultControllerTrust(void) +Index: obuspa-10.0.0.1/src/core/data_model.c +=================================================================== +--- obuspa-10.0.0.1.orig/src/core/data_model.c ++++ obuspa-10.0.0.1/src/core/data_model.c +@@ -5356,7 +5356,7 @@ int RegisterDefaultControllerTrust(void) int err = USP_ERR_OK; // Register 'Full Access' role diff --git a/obuspa/patches/2001-validate-controller-mtp.patch b/obuspa/patches/2001-validate-controller-mtp.patch index fdb44b5d9..3ae89e815 100644 --- a/obuspa/patches/2001-validate-controller-mtp.patch +++ b/obuspa/patches/2001-validate-controller-mtp.patch @@ -1,8 +1,8 @@ -Index: obuspa-9.0.4.1/src/core/device.h +Index: obuspa-10.0.0.1/src/core/device.h =================================================================== ---- obuspa-9.0.4.1.orig/src/core/device.h -+++ obuspa-9.0.4.1/src/core/device.h -@@ -338,6 +338,10 @@ void DEVICE_CONTROLLER_SetInheritedRole( +--- obuspa-10.0.0.1.orig/src/core/device.h ++++ obuspa-10.0.0.1/src/core/device.h +@@ -344,6 +344,10 @@ void DEVICE_CONTROLLER_SetInheritedRole( int DEVICE_CONTROLLER_CountEnabledWebsockClientConnections(void); #endif @@ -11,13 +11,13 @@ Index: obuspa-9.0.4.1/src/core/device.h +#endif + #ifndef REMOVE_USP_BROKER - int DEVICE_SUBSCRIPTION_RouteNotification(Usp__Msg *usp, int instance); + int DEVICE_SUBSCRIPTION_RouteNotification(Usp__Msg *usp, int instance, char *subscribed_path); bool DEVICE_SUBSCRIPTION_MarkVendorLayerSubs(int broker_instance, subs_notify_t notify_type, char *path, int group_id); -Index: obuspa-9.0.4.1/src/core/device_controller.c +Index: obuspa-10.0.0.1/src/core/device_controller.c =================================================================== ---- obuspa-9.0.4.1.orig/src/core/device_controller.c -+++ obuspa-9.0.4.1/src/core/device_controller.c -@@ -967,6 +967,78 @@ int DEVICE_CONTROLLER_QueueBinaryMessage +--- obuspa-10.0.0.1.orig/src/core/device_controller.c ++++ obuspa-10.0.0.1/src/core/device_controller.c +@@ -968,6 +968,78 @@ int DEVICE_CONTROLLER_QueueBinaryMessage return USP_ERR_OK; } @@ -96,11 +96,11 @@ Index: obuspa-9.0.4.1/src/core/device_controller.c /*********************************************************************//** ** ** DEVICE_CONTROLLER_IsMTPConfigured -Index: obuspa-9.0.4.1/src/core/msg_handler.c +Index: obuspa-10.0.0.1/src/core/msg_handler.c =================================================================== ---- obuspa-9.0.4.1.orig/src/core/msg_handler.c -+++ obuspa-9.0.4.1/src/core/msg_handler.c -@@ -1219,6 +1219,15 @@ int ValidateUspRecord(UspRecord__Record +--- obuspa-10.0.0.1.orig/src/core/msg_handler.c ++++ obuspa-10.0.0.1/src/core/msg_handler.c +@@ -1220,6 +1220,15 @@ int ValidateUspRecord(UspRecord__Record usp_service_instance = USP_BROKER_GetUspServiceInstance(rec->from_id, 0); #endif diff --git a/obuspa/patches/2002-max_controllers.patch b/obuspa/patches/2002-max_controllers.patch index cd3841894..11f705b55 100644 --- a/obuspa/patches/2002-max_controllers.patch +++ b/obuspa/patches/2002-max_controllers.patch @@ -1,8 +1,8 @@ -Index: obuspa-9.0.4.1/src/core/mqtt.c +Index: obuspa-10.0.0.1/src/core/mqtt.c =================================================================== ---- obuspa-9.0.4.1.orig/src/core/mqtt.c -+++ obuspa-9.0.4.1/src/core/mqtt.c -@@ -258,6 +258,8 @@ void MqttSubscriptionDestroy(mqtt_subscr +--- obuspa-10.0.0.1.orig/src/core/mqtt.c ++++ obuspa-10.0.0.1/src/core/mqtt.c +@@ -259,6 +259,8 @@ void MqttSubscriptionDestroy(mqtt_subscr #define DEFINE_MQTT_TrustCertVerifyCallbackIndex(index) \ int MQTT_TrustCertVerifyCallback_##index (int preverify_ok, X509_STORE_CTX *x509_ctx) \ {\ @@ -11,7 +11,7 @@ Index: obuspa-9.0.4.1/src/core/mqtt.c return DEVICE_SECURITY_TrustCertVerifyCallbackWithCertChain(preverify_ok, x509_ctx, &mqtt_clients[index].cert_chain);\ } -@@ -268,6 +270,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex +@@ -269,6 +271,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex DEFINE_MQTT_TrustCertVerifyCallbackIndex(2); DEFINE_MQTT_TrustCertVerifyCallbackIndex(3); DEFINE_MQTT_TrustCertVerifyCallbackIndex(4); @@ -23,7 +23,7 @@ Index: obuspa-9.0.4.1/src/core/mqtt.c // Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS //------------------------------------------------------------------------------------ -@@ -278,10 +285,15 @@ ssl_verify_callback_t* mqtt_verify_callb +@@ -279,10 +286,15 @@ ssl_verify_callback_t* mqtt_verify_callb MQTT_TrustCertVerifyCallbackIndex(2), MQTT_TrustCertVerifyCallbackIndex(3), MQTT_TrustCertVerifyCallbackIndex(4),