Skip to content

Commit ad63934

Browse files
author
Richard Holme
committed
Merging release/4.1.0
1 parent 50bb672 commit ad63934

32 files changed

+648
-286
lines changed

RELEASES.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11
# Release History
2+
3+
## Release 4.1.0
4+
* New Features
5+
* Search expressions supported in Bulk Data Collection
6+
* 'obuspa -c show data model' includes USP command and event arguments
7+
* Bug Fixes
8+
* MQTT Connection failure over TLS with libmosquitto 1.6.13+
9+
* Some ChallengeResponse parameters were not using base64
10+
* Device.LocalAgent.CertificateNumberOfEntries returns empty string rather than 0
11+
* Device.MQTT.Client.1.Status returns "Running" rather than "Connected"
12+
* Device.Security.Certificate.1.Alias is not defined in TR181
13+
* Probuf protocol trace does not indicate if truncated
14+
* Removed unnecessary allowed_controllers code
15+
* Untrusted role cannot issue a RequestChallenge() or ChallengeResponse() command
16+
* Bulk Data Collection using USPNotif throws console error related to HTTP URL (GH Issue #20)
17+
* Race hazard prevents changing MQTT connection parameters
18+
* 'obuspa -e' option accepted, even if C library cannot print callstack
19+
* Certificate validity dates reported incorrectly on 32 bit platforms for dates after 2038
20+
* Object deletion notification not sent for nested objects (GH Issue #21)
21+
* Data Model Enhancements
22+
* Device.MQTT.Capabilities
23+
* API Enhancements
24+
* Table objects must now be registered before child parameters
25+
* USP_REGISTER_Param_SupportedList()
26+
* USP_DM_InformDataModelEvent()
27+
* MQTT password via get_mtp_password_cb
28+
* Known Issues
29+
* ControllerTrust ChallengeResponse handling of retries
30+
231
## Release 4.0.0
332
* ControllerTrust support
433
* Challenge/Response mechanism

src/core/coap_server.c

100755100644
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ typedef struct
9494
// (because the request was received on a new DTLS session, the response will likely need to be too)
9595

9696
STACK_OF(X509) *cert_chain; // Full SSL certificate chain for the CoAP connection, collected in the SSL verify callback
97-
char *allowed_controllers; // pattern describing the endpoint_id of controllers which is granted access to this agent
9897
ctrust_role_t role; // role granted by the CA cert in the chain of trust with the CoAP client
9998

10099
nu_ipaddr_t peer_addr; // Current peer that sent the first block. Whilst building up a USP Record, only PDUs from this peer are accepted
@@ -801,7 +800,6 @@ void InitCoapSession(coap_server_session_t *css)
801800
css->wbio = NULL;
802801
css->is_first_usp_msg = true;
803802
css->cert_chain = NULL;
804-
css->allowed_controllers = NULL;
805803
css->role = ROLE_DEFAULT; // Set default role, if not determined from SSL certs
806804
memset(&css->peer_addr, 0, sizeof(css->peer_addr));
807805
css->peer_port = INVALID;
@@ -1034,7 +1032,7 @@ int PerformSessionDtlsConnect(coap_server_session_t *css)
10341032
if (css->cert_chain != NULL)
10351033
{
10361034
// Exit if unable to determine the role associated with the trusted root cert that signed the peer cert
1037-
err = DEVICE_SECURITY_GetControllerTrust(css->cert_chain, &css->role, &css->allowed_controllers);
1035+
err = DEVICE_SECURITY_GetControllerTrust(css->cert_chain, &css->role);
10381036
if (err != USP_ERR_OK)
10391037
{
10401038
USP_LOG_Error("%s: DEVICE_SECURITY_GetControllerTrust() failed. Resetting CoAP session", __FUNCTION__);
@@ -1084,7 +1082,6 @@ void StopCoapSession(coap_server_session_t *css)
10841082
sk_X509_pop_free(css->cert_chain, X509_free);
10851083
css->cert_chain = NULL;
10861084
}
1087-
USP_SAFE_FREE(css->allowed_controllers);
10881085

10891086
// Free the SSL object, gracefully shutting down the SSL connection
10901087
// NOTE: This also frees the BIO object (if one exists) as it is owned by the SSL object
@@ -1247,7 +1244,7 @@ void ReceiveCoapBlock(coap_server_t *cs, coap_server_session_t *css)
12471244
css->is_first_usp_msg = false;
12481245

12491246
// Post the USP record for processing
1250-
DM_EXEC_PostUspRecord(css->usp_buf, css->usp_buf_len, css->role, css->allowed_controllers, &mtp_reply_to);
1247+
DM_EXEC_PostUspRecord(css->usp_buf, css->usp_buf_len, css->role, &mtp_reply_to);
12511248
FreeReceivedUspRecord(css);
12521249
}
12531250
}

src/core/data_model.c

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int DeleteChildParams_MultiInstanceObject(char *path, int path_len, dm_node_t *n
120120
int strncpy_path_segments(char *dst, char *src, int maxlen);
121121
void DumpSchemaFromRoot(dm_node_t *root, char *name);
122122
void AddChildNodes(dm_node_t *parent, str_vector_t *sv);
123+
void AddChildArgs(str_vector_t *sv, char *path, str_vector_t *args, char *arg_type);
123124
int SortSchemaPath(const void *p1, const void *p2);
124125
int RegisterDefaultControllerTrust(void);
125126
void DestroySchemaRecursive(dm_node_t *parent);
@@ -3065,6 +3066,14 @@ dm_node_t *DM_PRIV_AddSchemaPath(char *path, dm_node_type_t type, unsigned flags
30653066
child = DM_PRIV_FindMatchingChild(parent, seg->name);
30663067
if (child == NULL)
30673068
{
3069+
// Do not allow tables to be registered implicitly by a parameter. Only allow them to be registered explicitly.
3070+
// Only non-table objects are registered implicitly
3071+
if ((seg->type == kDMNodeType_Object_MultiInstance) && (i != num_segments-1))
3072+
{
3073+
USP_ERR_SetMessage("%s: %s must be registered before %s", __FUNCTION__, schema_path, path);
3074+
return NULL;
3075+
}
3076+
30683077
// Node has not yet been added, so add it
30693078
child = CreateNode(seg->name, seg->type, schema_path);
30703079
if (child == NULL)
@@ -3082,7 +3091,9 @@ dm_node_t *DM_PRIV_AddSchemaPath(char *path, dm_node_type_t type, unsigned flags
30823091
inst.order++;
30833092
}
30843093

3085-
// Default the group_id, if this is an object which we are adding implicitly to the data model by registering a parameter
3094+
// Default the group_id
3095+
// For grouped table objects, this will be overridden by the caller
3096+
// For non table objects, the group_id is effectively 'don't care' as non-table objects are not accessible via the grouped vendor hook APIs
30863097
if (IsObject(child))
30873098
{
30883099
dm_object_info_t *info;
@@ -4187,6 +4198,7 @@ int DeleteChildParams_MultiInstanceObject(char *path, int path_len, dm_node_t *n
41874198
DM_INST_VECTOR_Remove(inst);
41884199

41894200
// Add this object instance to the list of instances which are pending notification to the vendor
4201+
path[path_len+len] = '\0';
41904202
DM_TRANS_Add(kDMOp_Del, path, NULL, NULL, node, inst);
41914203
}
41924204

@@ -4458,8 +4470,25 @@ int SortSchemaPath(const void *p1, const void *p2)
44584470
void AddChildNodes(dm_node_t *parent, str_vector_t *sv)
44594471
{
44604472
dm_node_t *child;
4473+
char obj_path[MAX_DM_PATH];
4474+
char *path;
4475+
4476+
// Add this node to the string vector
4477+
USP_SNPRINTF(obj_path, sizeof(obj_path), "%s.", parent->path);
4478+
path = (IsObject(parent)) ? obj_path : parent->path;
4479+
STR_VECTOR_Add(sv, path);
4480+
4481+
// Add arguments (if applicable) to string vector
4482+
if (IsOperation(parent))
4483+
{
4484+
AddChildArgs(sv, parent->path, &parent->registered.oper_info.input_args, "input");
4485+
AddChildArgs(sv, parent->path, &parent->registered.oper_info.output_args, "output");
4486+
}
44614487

4462-
STR_VECTOR_Add(sv, parent->path);
4488+
if (parent->type == kDMNodeType_Event)
4489+
{
4490+
AddChildArgs(sv, parent->path, &parent->registered.event_info.event_args, "event_arg");
4491+
}
44634492

44644493
// Iterate over list of children
44654494
child = (dm_node_t *) parent->child_nodes.head;
@@ -4472,6 +4501,32 @@ void AddChildNodes(dm_node_t *parent, str_vector_t *sv)
44724501
}
44734502
}
44744503

4504+
/*********************************************************************//**
4505+
**
4506+
** AddChildArgs
4507+
**
4508+
** Function called to add recursively to add the schema paths of all nodes to a string vector
4509+
**
4510+
** \param sv - pointer to string vector in which to add the schema paths
4511+
** \param path - data model path of the USP command or event
4512+
** \param args - pointer to string vector containing arguments to add to the schema path vector
4513+
** \param arg_type - pointer to string describing type of argument (input, output, or event_arg)
4514+
**
4515+
** \return None
4516+
**
4517+
**************************************************************************/
4518+
void AddChildArgs(str_vector_t *sv, char *path, str_vector_t *args, char *arg_type)
4519+
{
4520+
int i;
4521+
char buf[MAX_DM_PATH];
4522+
4523+
for (i=0; i < args->num_entries; i++)
4524+
{
4525+
USP_SNPRINTF(buf, sizeof(buf), "%s %s:%s", path, arg_type, args->vector[i]);
4526+
STR_VECTOR_Add(sv, buf);
4527+
}
4528+
}
4529+
44754530
/*********************************************************************//**
44764531
**
44774532
** FindNodeFromHash
@@ -4525,6 +4580,8 @@ int RegisterDefaultControllerTrust(void)
45254580
err |= USP_DM_RegisterRoleName(kCTrustRole_Untrusted, "Untrusted");
45264581
err |= USP_DM_AddControllerTrustPermission(kCTrustRole_Untrusted, "Device.", PERMIT_NONE);
45274582
err |= USP_DM_AddControllerTrustPermission(kCTrustRole_Untrusted, "Device.DeviceInfo.", PERMIT_GET | PERMIT_OBJ_INFO);
4583+
err |= USP_DM_AddControllerTrustPermission(kCTrustRole_Untrusted, "Device.LocalAgent.ControllerTrust.RequestChallenge()", PERMIT_OPER);
4584+
err |= USP_DM_AddControllerTrustPermission(kCTrustRole_Untrusted, "Device.LocalAgent.ControllerTrust.ChallengeResponse()", PERMIT_OPER);
45284585

45294586
if (err != USP_ERR_OK)
45304587
{

src/core/data_model.h

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ extern char *reboot_cause_path;
266266
(node->type == kDMNodeType_DBParam_ReadWriteAuto) || \
267267
(node->type == kDMNodeType_DBParam_Secure))
268268

269+
#define IsOperation(node) ((node->type == kDMNodeType_SyncOperation) || (node->type == kDMNodeType_AsyncOperation))
270+
269271
//------------------------------------------------------------------------------
270272
// Definitions for flags in DATA_MODEL_GetParameterValue()
271273
#define SHOW_PASSWORD 0x00000001 // Used internally by USP Agent to get the actual value of passwords (default behaviour is to return an empty string)

src/core/device.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
*
33
* Copyright (C) 2019-2021, Broadband Forum
4-
* Copyright (C) 2016-2020 CommScope, Inc
4+
* Copyright (C) 2016-2021 CommScope, Inc
55
* Copyright (C) 2020, BT PLC
66
*
77
* Redistribution and use in source and binary forms, with or without
@@ -148,7 +148,7 @@ int DEVICE_CONTROLLER_QueueBinaryMessage(Usp__Header__MsgType usp_msg_type, char
148148
char *DEVICE_CONTROLLER_FindEndpointIdByInstance(int instance);
149149
int DEVICE_CONTROLLER_GetCombinedRole(int instance, combined_role_t *combined_role);
150150
int DEVICE_CONTROLLER_GetCombinedRoleByEndpointId(char *endpoint_id, combined_role_t *combined_role);
151-
void DEVICE_CONTROLLER_SetRolesFromStomp(int stomp_instance, ctrust_role_t role, char *allowed_controllers);
151+
void DEVICE_CONTROLLER_SetRolesFromStomp(int stomp_instance, ctrust_role_t role);
152152
int DEVICE_CONTROLLER_GetSubsRetryParams(char *endpoint_id, unsigned *min_wait_interval, unsigned *interval_multiplier);
153153
void DEVICE_CONTROLLER_NotifyStompConnDeleted(int stomp_instance);
154154
int DEVICE_MTP_Init(void);
@@ -183,7 +183,7 @@ void DEVICE_SUBSCRIPTION_Dump(void);
183183
int DEVICE_SECURITY_Init(void);
184184
int DEVICE_SECURITY_Start(void);
185185
void DEVICE_SECURITY_Stop(void);
186-
int DEVICE_SECURITY_GetControllerTrust(STACK_OF(X509) *cert_chain, ctrust_role_t *role, char **allowed_controllers);
186+
int DEVICE_SECURITY_GetControllerTrust(STACK_OF(X509) *cert_chain, ctrust_role_t *role);
187187
bool DEVICE_SECURITY_IsClientCertAvailable(void);
188188
SSL_CTX *DEVICE_SECURITY_CreateSSLContext(const SSL_METHOD *method, int verify_mode, ssl_verify_callback_t verify_callback);
189189
int DEVICE_SECURITY_LoadTrustStore(SSL_CTX *ssl_ctx, int verify_mode, ssl_verify_callback_t verify_callback);
@@ -230,7 +230,7 @@ void DEVICE_CONTROLLER_NotifyMqttConnDeleted(int mqtt_instance);
230230
void DEVICE_MTP_NotifyMqttConnDeleted(int mqtt_instance);
231231
int DEVICE_MTP_ValidateMqttReference(dm_req_t *req, char *value);
232232
int DEVICE_MQTT_QueueBinaryMessage(Usp__Header__MsgType usp_msg_type, int instance, char *topic, char *response_topic, unsigned char *pbuf, int pbuf_len);
233-
void DEVICE_CONTROLLER_SetRolesFromMqtt(int mqtt_instance, ctrust_role_t role, char *allowed_controllers);
233+
void DEVICE_CONTROLLER_SetRolesFromMqtt(int mqtt_instance, ctrust_role_t role);
234234
char *DEVICE_CONTROLLER_GetControllerTopic(int mqtt_instance);
235235

236236
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)