mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: 10.0.0.5
This commit is contained in:
parent
02577401c7
commit
6166ba0041
2 changed files with 2 additions and 296 deletions
|
|
@ -5,13 +5,13 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=10.0.0.4
|
||||
PKG_VERSION:=10.0.0.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=484474cebd0491c700fb1560271132f7a4536fa3
|
||||
PKG_SOURCE_VERSION:=0f6e5fd442e026430a43962ebcad7252d4dad2e9
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
|
|
|||
|
|
@ -174,297 +174,3 @@ Index: obuspa-10.0.0.2/src/core/device_ctrust.c
|
|||
+
|
||||
+ return false;
|
||||
+}
|
||||
Index: obuspa-10.0.0.2/src/vendor/vendor_datamodel_ext.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/vendor/vendor_datamodel_ext.c
|
||||
+++ obuspa-10.0.0.2/src/vendor/vendor_datamodel_ext.c
|
||||
@@ -694,7 +694,7 @@ int session_start(dm_req_t *req, char *c
|
||||
USP_ARG_GetUnsigned(input_args, "Timeout", 300, &timeout);
|
||||
arg.len = (int) timeout;
|
||||
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -708,7 +708,7 @@ int session_commit(dm_req_t *req, char *
|
||||
memset(&arg, 0, sizeof(vendor_data_t));
|
||||
arg.cmd = CMD_SESSION_MGMT;
|
||||
arg.path = "commit";
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -722,7 +722,7 @@ int session_abort(dm_req_t *req, char *c
|
||||
memset(&arg, 0, sizeof(vendor_data_t));
|
||||
arg.cmd = CMD_SESSION_MGMT;
|
||||
arg.path = "abort";
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
// check and reset session
|
||||
ubus_enqueue_cmd(&arg);
|
||||
Index: obuspa-10.0.0.2/src/vendor/vendor_ubus_thread.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/vendor/vendor_ubus_thread.c
|
||||
+++ obuspa-10.0.0.2/src/vendor/vendor_ubus_thread.c
|
||||
@@ -94,6 +94,8 @@ static struct ubus_thread_global g_ubus_
|
||||
#define USP_PROTO "usp"
|
||||
#define MIN_NUM_TO_GROUP (10)
|
||||
|
||||
+extern int vendor_create_dm_cache(char *paths[], int num_paths);
|
||||
+
|
||||
static void _pull_instances(const char *path, str_vector_t *inst_vec);
|
||||
static int _uspd_call(struct ubus_context *ctx, const char *object, const char *method,
|
||||
struct blob_buf *data, ubus_data_handler_t callback,
|
||||
@@ -489,16 +491,25 @@ static void _get_value_single_cb(struct
|
||||
blobmsg_for_each_attr(cur, params, rem) {
|
||||
char path[MAX_DM_PATH] = {0}, val[MAX_DM_VALUE_LEN] = {0};
|
||||
int fault;
|
||||
+ str_vector_t flags_vec;
|
||||
|
||||
- fault = get_details_from_blob(cur, path, val, NULL, NULL, NULL);
|
||||
+ STR_VECTOR_Init(&flags_vec);
|
||||
+ fault = get_details_from_blob(cur, path, val, NULL, NULL, &flags_vec);
|
||||
if (fault != USP_ERR_OK) {
|
||||
arg->fault = fault;
|
||||
}
|
||||
|
||||
if (strcmp(path, arg->path) == 0) {
|
||||
+ if (STR_VECTOR_Find(&flags_vec, DM_FLAG_SECURE) != INVALID) {
|
||||
+ if (arg->is_secured == false) {
|
||||
+ val[0]='\0';
|
||||
+ }
|
||||
+ }
|
||||
USP_STRNCPY(arg->p_value, val, arg->len);
|
||||
+ STR_VECTOR_Destroy(&flags_vec);
|
||||
break;
|
||||
}
|
||||
+ STR_VECTOR_Destroy(&flags_vec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,12 +559,20 @@ static void _get_value_group_cb(struct u
|
||||
blobmsg_for_each_attr(cur, params, rem) {
|
||||
char path[MAX_DM_PATH], val[MAX_DM_VALUE_LEN];
|
||||
int fault;
|
||||
+ str_vector_t flags_vec;
|
||||
|
||||
- fault = get_details_from_blob(cur, path, val, NULL, NULL, NULL);
|
||||
+ STR_VECTOR_Init(&flags_vec);
|
||||
+ fault = get_details_from_blob(cur, path, val, NULL, NULL, &flags_vec);
|
||||
if (fault != USP_ERR_OK) {
|
||||
arg->fault = fault;
|
||||
}
|
||||
+ if (STR_VECTOR_Find(&flags_vec, DM_FLAG_SECURE) != INVALID) {
|
||||
+ if (arg->is_secured == false) {
|
||||
+ val[0]='\0';
|
||||
+ }
|
||||
+ }
|
||||
USP_ARG_Add(&pv_set, path, val);
|
||||
+ STR_VECTOR_Destroy(&flags_vec);
|
||||
}
|
||||
|
||||
if (arg->kv) {
|
||||
@@ -1648,22 +1667,27 @@ int ubus_thread_cleanup(void)
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
-int _get_controller_id(char *id)
|
||||
+int _get_controller_info(vendor_data_t *argp)
|
||||
{
|
||||
- if (!id)
|
||||
+ if (!argp)
|
||||
return INVALID;
|
||||
|
||||
controller_info_t ci;
|
||||
|
||||
- id[0] = '\0'; // init with the empty value
|
||||
+ argp->ceid[0] = '\0'; // init with the empty value
|
||||
memset(&ci, 0, sizeof(controller_info_t));
|
||||
MSG_HANDLER_GetControllerInfo(&ci);
|
||||
|
||||
if (ci.endpoint_id != NULL) {
|
||||
if (ci.endpoint_id[0] > 'A' && ci.endpoint_id[0] < 'z') {
|
||||
- USP_STRNCPY(id, ci.endpoint_id, MAX_DM_PATH); // Only copy if its a valid string
|
||||
+ USP_STRNCPY(argp->ceid, ci.endpoint_id, MAX_DM_PATH); // Only copy if its a valid string
|
||||
}
|
||||
}
|
||||
|
||||
+ if (DEVICE_CTRUST_IsControllerSecured()) {
|
||||
+ USP_LOG_Debug("Controller [%s] is secured", argp->ceid);
|
||||
+ argp->is_secured = true;
|
||||
+ }
|
||||
+
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
Index: obuspa-10.0.0.2/src/vendor/vendor_ubus_thread.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/vendor/vendor_ubus_thread.h
|
||||
+++ obuspa-10.0.0.2/src/vendor/vendor_ubus_thread.h
|
||||
@@ -73,6 +73,7 @@ typedef struct
|
||||
int inst;
|
||||
int fault;
|
||||
int ipc_timeout;
|
||||
+ bool is_secured;
|
||||
str_vector_t *vec;
|
||||
kv_vector_t *kv;
|
||||
kv_vector_t *kv_out;
|
||||
@@ -90,7 +91,7 @@ int ubus_thread_cleanup(void);
|
||||
int ubus_enqueue_cmd(vendor_data_t *arg);
|
||||
|
||||
// Utility functions
|
||||
-int _get_controller_id(char *id);
|
||||
+int _get_controller_info(vendor_data_t *arg);
|
||||
int uspd_call(struct ubus_context *ctx, const char *method, struct blob_buf *data, ubus_data_handler_t callback, vendor_data_t *arg);
|
||||
int uspd_call_async(const char *method, struct blob_buf *data, ubus_data_handler_t callback, void *priv);
|
||||
#endif // VENDOR_UBUS_THREAD_H
|
||||
Index: obuspa-10.0.0.2/src/vendor/vendor_uspd.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/vendor/vendor_uspd.c
|
||||
+++ obuspa-10.0.0.2/src/vendor/vendor_uspd.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "vendor_uspd.h"
|
||||
+#include "msg_handler.h"
|
||||
#include "os_utils.h"
|
||||
#include "common_defs.h"
|
||||
#include "str_vector.h"
|
||||
@@ -116,7 +117,7 @@ static int uspd_operate_async(dm_req_t *
|
||||
arg.path = req->path;
|
||||
arg.kv = input_args;
|
||||
arg.inst = instance;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -135,7 +136,7 @@ static int uspd_operate_sync(dm_req_t *r
|
||||
arg.p_value = command_key;
|
||||
arg.kv = input_args;
|
||||
arg.kv_out = output_args;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -266,7 +267,7 @@ static int group_get(int group_id, kv_ve
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
arg.path = group_path;
|
||||
arg.kv = params;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
ubus_enqueue_cmd(&arg);
|
||||
}
|
||||
USP_LOG_Debug("Group %s, cached index %d, is_cached %d, fault %d",g_uspd.group_vec.vector[group_id], g_uspd.cached_dm.num_entries, ret, arg.fault);
|
||||
@@ -284,7 +285,7 @@ static int uspd_set_value(dm_req_t *req,
|
||||
arg.path = req->path;
|
||||
arg.p_value = buf;
|
||||
arg.len = strlen(buf);
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -305,7 +306,7 @@ static int group_set(int group_id, kv_ve
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
arg.kv = params;
|
||||
arg.p_failure_index = failure_index;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -329,7 +330,7 @@ static int group_add(int group_id, char
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
arg.path = temp;
|
||||
arg.p_instance = instance;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -355,7 +356,7 @@ static int group_del(int group_id, char
|
||||
arg.cmd = CMD_DEL;
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
arg.path = temp;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -608,7 +609,7 @@ static int initiate_data_caching(str_vec
|
||||
arg.ipc_timeout = 10 * g_uspd.ipc_timeout;
|
||||
arg.path = path_vec->vector[i];
|
||||
arg.vec = &g_uspd.cached_instances;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
// Caching with datamodel kv
|
||||
@@ -617,7 +618,7 @@ static int initiate_data_caching(str_vec
|
||||
arg.ipc_timeout = 10 * g_uspd.ipc_timeout;
|
||||
arg.path = path_vec->vector[i];
|
||||
arg.kv_out = &g_uspd.cached_dm;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
ubus_enqueue_cmd(&arg);
|
||||
}
|
||||
|
||||
@@ -640,7 +641,7 @@ static int uspd_get_value(dm_req_t *req,
|
||||
arg.path = req->path;
|
||||
arg.p_value = buf;
|
||||
arg.len = len;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
ubus_enqueue_cmd(&arg);
|
||||
} else {
|
||||
USP_STRNCPY(buf, kv_param.vector[0].value, len)
|
||||
@@ -710,9 +711,6 @@ static void uspd_register_leaf(char *spa
|
||||
int type;
|
||||
|
||||
type = convert_dmt_to_dmtype(bbf_dmt);
|
||||
- if (flags_vec && STR_VECTOR_Find(flags_vec, DM_FLAG_SECURE) != INVALID) {
|
||||
- type |= DM_SECURE;
|
||||
- }
|
||||
|
||||
group = get_associated_group(spath);
|
||||
if (group == INVALID) {
|
||||
@@ -768,7 +766,7 @@ static int cache_const_dm(kv_vector_t *c
|
||||
arg.cmd = CMD_GROUP_GET;
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
arg.path = "Device.DeviceInfo.";
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -1033,7 +1031,7 @@ static int uspd_tran_start()
|
||||
memset(&arg, 0, sizeof(vendor_data_t));
|
||||
arg.cmd = CMD_TRAN_START;
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -1047,7 +1045,7 @@ static int uspd_tran_commit()
|
||||
memset(&arg, 0, sizeof(vendor_data_t));
|
||||
arg.cmd = CMD_TRAN_COMMIT;
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
@@ -1061,7 +1059,7 @@ static int uspd_tran_abort()
|
||||
memset(&arg, 0, sizeof(vendor_data_t));
|
||||
arg.cmd = CMD_TRAN_ABORT;
|
||||
arg.ipc_timeout = g_uspd.ipc_timeout;
|
||||
- _get_controller_id(arg.ceid);
|
||||
+ _get_controller_info(&arg);
|
||||
|
||||
ubus_enqueue_cmd(&arg);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue