aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-12-08 19:44:09 +0100
committerHarald Welte <laforge@osmocom.org>2022-02-21 08:23:35 +0100
commit02f2bbeb135ceb8d6c241842e595106f8e87c7d8 (patch)
treebc8e3a80df83a7503f0c39a5fa460006ce40bd70
parentb4b20309ad6606aba7cf43c2cc640ddbd185a061 (diff)
rspro: re-order ASN1 choice members to work around wireshark asn.1 buglaforge/rspro
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.
-rw-r--r--epan/dissectors/asn1/rspro/RSPRO.asn6
-rw-r--r--epan/dissectors/packet-rspro.c42
2 files changed, 24 insertions, 24 deletions
diff --git a/epan/dissectors/asn1/rspro/RSPRO.asn b/epan/dissectors/asn1/rspro/RSPRO.asn
index 6141c534a6..f32211b58c 100644
--- a/epan/dissectors/asn1/rspro/RSPRO.asn
+++ b/epan/dissectors/asn1/rspro/RSPRO.asn
@@ -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,
...
}
diff --git a/epan/dissectors/packet-rspro.c b/epan/dissectors/packet-rspro.c
index 5dd114d58a..184824edcd 100644
--- a/epan/dissectors/packet-rspro.c
+++ b/epan/dissectors/packet-rspro.c
@@ -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,