Before commenting read Forum rules
Don't comment the topic if you have a new question.
You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.
Before commenting read Forum rules
Don't comment the topic if you have a new question.
You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.
Hi, Mikko!
I try connect DLMS Director to my meter. My meter use DLMS.c library (server).
When i connect with low password - OK.
But when i connect with high password - crash in server.c in svr_handleMethodRequest() function.
Crash in row 2674:
if ((ret = bb_set2(data, e->value.byteArr, 0, e->value.byteArr->size)) != 0)
{
error = DLMS_ERROR_CODE_HARDWARE_FAULT;
}
Crash due to e->value.byteArr is NULL.
Exchange:
15:10:08 Send SNRM request.
7E A0 07 03 25 93 6F 66 7E
15:10:08 03:10:08.993 Sent 7E A0 07 03 25 93 6F 66 7E
15:10:08 03:10:08.993 Received 7E A0 1E 25 03 73 A2 19 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
15:10:08
7E A0 1E 25 03 73 A2 19 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
15:10:08 Parsing UA reply succeeded.
15:10:08 Send AARQ request.
7E A0 4C 03 25 10 5E 06 E6 E6 00 60 3E A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 02 AC 12 80 10 14 07 31 33 2A 17 13 62 0F 61 3A 35 67 53 4B 0A BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 62 1E 5D FF FF 63 91 7E
15:10:08 03:10:08.993 Sent 7E A0 4C 03 25 10 5E 06 E6 E6 00 60 3E A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 02 AC 12 80 10 14 07 31 33 2A 17 13 62 0F 61 3A 35 67 53 4B 0A BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 62 1E 5D FF FF 63 91 7E
15:10:09 03:10:09.009 Received 7E A0 58 25 03 30 10 34 E6 E7 00 61 4A A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 0E 88 02 07 80 89 07 60 85 74 05 08 02 02 AA 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 10 04 0E 08 00 06 5F 1F 04 00 00 1E 1D 04 00 00 07 46 BB 7E
15:10:09
7E A0 58 25 03 30 10 34 E6 E7 00 61 4A A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 0E 88 02 07 80 89 07 60 85 74 05 08 02 02 AA 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 10 04 0E 08 00 06 5F 1F 04 00 00 1E 1D 04 00 00 07 46 BB 7E
15:10:09 Parsing AARE reply succeeded.
15:10:09 Authenticating.
7E A0 2B 03 25 32 8B CA E6 E6 00 C3 01 C1 00 0F 00 00 28 00 00 FF 01 01 09 10 A9 13 7A E9 38 43 D0 BB 7C BB 7C BF 39 3B 24 24 61 FF 7E
15:10:09 03:10:09.009 Sent 7E A0 2B 03 25 32 8B CA E6 E6 00 C3 01 C1 00 0F 00 00 28 00 00 FF 01 01 09 10 A9 13 7A E9 38 43 D0 BB 7C BB 7C BF 39 3B 24 24 61 FF 7E
My object with high password like in server example:
int addAssociationHigh()
{
int ret;
//Dedicated key.
static unsigned char CYPHERING_INFO[20] = { 0 };
const unsigned char ln[6] = { 0, 0, 40, 0, 3, 255 };
if ((ret = INIT_OBJECT(associationHigh, DLMS_OBJECT_TYPE_ASSOCIATION_LOGICAL_NAME, ln)) == 0)
{
associationHigh.authenticationMechanismName.mechanismId = DLMS_AUTHENTICATION_HIGH;
OA_ATTACH(associationHigh.objectList, ALL_OBJECTS);
BB_ATTACH(associationHigh.xDLMSContextInfo.cypheringInfo, CYPHERING_INFO, 0);
associationHigh.clientSAP = 0x12;
associationHigh.xDLMSContextInfo.maxSendPduSize = associationHigh.xDLMSContextInfo.maxReceivePduSize = PDU_BUFFER_SIZE;
associationHigh.xDLMSContextInfo.conformance = (DLMS_CONFORMANCE)(DLMS_CONFORMANCE_BLOCK_TRANSFER_WITH_ACTION |
DLMS_CONFORMANCE_BLOCK_TRANSFER_WITH_SET_OR_WRITE |
DLMS_CONFORMANCE_BLOCK_TRANSFER_WITH_GET_OR_READ |
DLMS_CONFORMANCE_SET |
DLMS_CONFORMANCE_SELECTIVE_ACCESS |
DLMS_CONFORMANCE_ACTION |
DLMS_CONFORMANCE_MULTIPLE_REFERENCES |
DLMS_CONFORMANCE_GET);
bb_addString(&associationHigh.secret, "qwerty");
#ifndef DLMS_IGNORE_OBJECT_POINTERS
associationHigh.securitySetup = &securitySetupHigh;
#else
memcpy(associationHigh.securitySetupReference, securitySetupHigh.base.logicalName, 6);
#endif //DLMS_IGNORE_OBJECT_POINTERS
}
return ret;
}
How to fix it?
Thanks!
Hi Dmitry,
Hi Dmitry,
I tested this and it worked without problems. Are you using malloc or have you defined DLMS_IGNORE_MALLOC?
BR,
Mikko
Hi, Mikko!
Hi, Mikko!
Yes, i'm use gxmalloc. Don't use #define DLMS_IGNORE_MALLOC. It commented in gxignore.h.
I think problem is in
I think problem is in
int invoke_AssociationLogicalName(dlmsServerSettings* settings, gxValueEventArg* e)
function, file gxinvoke.c:
Calls DLMS method reply_to_HLS_authentication (if (e->index == 1)....)
in this case use
e->byteArray = 1;
but e->value.byteArr not inited (NULL).
Next use settings->info.data instead e->value.byteArr:
if ((ret = dlms_secure(&settings->base,
ic,
&settings->base.ctoSChallenge,
readSecret,
&settings->info.data)) != 0)
{
return ret;
}
bb_insertUInt8(&settings->info.data, 0, DLMS_DATA_TYPE_OCTET_STRING);
bb_insertUInt8(&settings->info.data, 1, (unsigned char)(settings->info.data.size - 1));
object->associationStatus = DLMS_ASSOCIATION_STATUS_ASSOCIATED;
and after this in svr_handleMethodRequest() function in row 2674 calls if ((ret = bb_set2(data, e->value.byteArr, 0, e->value.byteArr->size)) != 0).
with unnitialized e->value.byteArr.
Hi Dmitry,
Hi Dmitry,
This is now fixed. Get the latest version.
BR,
Mikko
Thanks a lot!
Thanks a lot!
That works now good.