rspro: re-order ASN1 choice members to work around wireshark asn.1 bug

It seems that for some reason the asn2wrs.py code generator cannot deal
with ASN.1 choices being defined with their numeric values defined in
non-ascending order.  Other ASN.1 code genreation tools work perfectly
fine under such conditions.

The decode error happens in the COL_INFO:  The numeric value of the
choice is mapped to a wrong entry in the string table, resulting in
the wrong message type being shown in the INFO column.

We apply this patch to the ASN.1 source of the RSPRO protocol definition
to  fix the decode.
This commit is contained in:
Harald Welte 2021-12-08 19:44:09 +01:00
parent 8fddbe2c16
commit 88782ea431
2 changed files with 24 additions and 24 deletions

View File

@ -325,9 +325,6 @@ RsproPDUchoice ::= CHOICE {
removeMappingRes [7] RemoveMappingRes,
configClientIdReq [8] ConfigClientIdReq,
configClientIdRes [9] ConfigClientIdRes,
configClientBankReq [17] ConfigClientBankReq,
configClientBankRes [18] ConfigClientBankRes,
errorInd [16] ErrorInd,
-- APDUs etc.
setAtrReq [10] SetAtrReq,
setAtrRes [11] SetAtrRes,
@ -335,6 +332,9 @@ RsproPDUchoice ::= CHOICE {
tpduCardToModem [13] TpduCardToModem,
clientSlotStatusInd [14] ClientSlotStatusInd,
bankSlotStatusInd [15] BankSlotStatusInd,
configClientBankReq [17] ConfigClientBankReq,
configClientBankRes [18] ConfigClientBankRes,
errorInd [16] ErrorInd,
...
}

View File

@ -102,15 +102,15 @@ static int hf_rspro_removeMappingReq = -1; /* RemoveMappingReq */
static int hf_rspro_removeMappingRes = -1; /* RemoveMappingRes */
static int hf_rspro_configClientIdReq = -1; /* ConfigClientIdReq */
static int hf_rspro_configClientIdRes = -1; /* ConfigClientIdRes */
static int hf_rspro_configClientBankReq = -1; /* ConfigClientBankReq */
static int hf_rspro_configClientBankRes = -1; /* ConfigClientBankRes */
static int hf_rspro_errorInd = -1; /* ErrorInd */
static int hf_rspro_setAtrReq = -1; /* SetAtrReq */
static int hf_rspro_setAtrRes = -1; /* SetAtrRes */
static int hf_rspro_tpduModemToCard = -1; /* TpduModemToCard */
static int hf_rspro_tpduCardToModem = -1; /* TpduCardToModem */
static int hf_rspro_clientSlotStatusInd = -1; /* ClientSlotStatusInd */
static int hf_rspro_bankSlotStatusInd = -1; /* BankSlotStatusInd */
static int hf_rspro_configClientBankReq = -1; /* ConfigClientBankReq */
static int hf_rspro_configClientBankRes = -1; /* ConfigClientBankRes */
static int hf_rspro_errorInd = -1; /* ErrorInd */
static int hf_rspro_version = -1; /* INTEGER_0_32 */
static int hf_rspro_tag = -1; /* OperationTag */
static int hf_rspro_msg = -1; /* RsproPDUchoice */
@ -779,15 +779,15 @@ static const value_string rspro_RsproPDUchoice_vals[] = {
{ 7, "removeMappingRes" },
{ 8, "configClientIdReq" },
{ 9, "configClientIdRes" },
{ 17, "configClientBankReq" },
{ 18, "configClientBankRes" },
{ 16, "errorInd" },
{ 10, "setAtrReq" },
{ 11, "setAtrRes" },
{ 12, "tpduModemToCard" },
{ 13, "tpduCardToModem" },
{ 14, "clientSlotStatusInd" },
{ 15, "bankSlotStatusInd" },
{ 17, "configClientBankReq" },
{ 18, "configClientBankRes" },
{ 16, "errorInd" },
{ 0, NULL }
};
@ -802,15 +802,15 @@ static const ber_choice_t RsproPDUchoice_choice[] = {
{ 7, &hf_rspro_removeMappingRes, BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_rspro_RemoveMappingRes },
{ 8, &hf_rspro_configClientIdReq, BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, dissect_rspro_ConfigClientIdReq },
{ 9, &hf_rspro_configClientIdRes, BER_CLASS_CON, 9, BER_FLAGS_IMPLTAG, dissect_rspro_ConfigClientIdRes },
{ 17, &hf_rspro_configClientBankReq, BER_CLASS_CON, 17, BER_FLAGS_IMPLTAG, dissect_rspro_ConfigClientBankReq },
{ 18, &hf_rspro_configClientBankRes, BER_CLASS_CON, 18, BER_FLAGS_IMPLTAG, dissect_rspro_ConfigClientBankRes },
{ 16, &hf_rspro_errorInd , BER_CLASS_CON, 16, BER_FLAGS_IMPLTAG, dissect_rspro_ErrorInd },
{ 10, &hf_rspro_setAtrReq , BER_CLASS_CON, 10, BER_FLAGS_IMPLTAG, dissect_rspro_SetAtrReq },
{ 11, &hf_rspro_setAtrRes , BER_CLASS_CON, 11, BER_FLAGS_IMPLTAG, dissect_rspro_SetAtrRes },
{ 12, &hf_rspro_tpduModemToCard, BER_CLASS_CON, 12, BER_FLAGS_IMPLTAG, dissect_rspro_TpduModemToCard },
{ 13, &hf_rspro_tpduCardToModem, BER_CLASS_CON, 13, BER_FLAGS_IMPLTAG, dissect_rspro_TpduCardToModem },
{ 14, &hf_rspro_clientSlotStatusInd, BER_CLASS_CON, 14, BER_FLAGS_IMPLTAG, dissect_rspro_ClientSlotStatusInd },
{ 15, &hf_rspro_bankSlotStatusInd, BER_CLASS_CON, 15, BER_FLAGS_IMPLTAG, dissect_rspro_BankSlotStatusInd },
{ 17, &hf_rspro_configClientBankReq, BER_CLASS_CON, 17, BER_FLAGS_IMPLTAG, dissect_rspro_ConfigClientBankReq },
{ 18, &hf_rspro_configClientBankRes, BER_CLASS_CON, 18, BER_FLAGS_IMPLTAG, dissect_rspro_ConfigClientBankRes },
{ 16, &hf_rspro_errorInd , BER_CLASS_CON, 16, BER_FLAGS_IMPLTAG, dissect_rspro_ErrorInd },
{ 0, NULL, 0, 0, 0, NULL }
};
@ -1123,18 +1123,6 @@ void proto_register_rspro(void) {
{ "configClientIdRes", "rspro.configClientIdRes_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_configClientBankReq,
{ "configClientBankReq", "rspro.configClientBankReq_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_configClientBankRes,
{ "configClientBankRes", "rspro.configClientBankRes_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_errorInd,
{ "errorInd", "rspro.errorInd_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_setAtrReq,
{ "setAtrReq", "rspro.setAtrReq_element",
FT_NONE, BASE_NONE, NULL, 0,
@ -1159,6 +1147,18 @@ void proto_register_rspro(void) {
{ "bankSlotStatusInd", "rspro.bankSlotStatusInd_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_configClientBankReq,
{ "configClientBankReq", "rspro.configClientBankReq_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_configClientBankRes,
{ "configClientBankRes", "rspro.configClientBankRes_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_errorInd,
{ "errorInd", "rspro.errorInd_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rspro_version,
{ "version", "rspro.version",
FT_UINT32, BASE_DEC, NULL, 0,