GSM MAP: Fix decoding of IPv6 addresses

From 3GPP 23.003

The GSN Address is composed of the following elements:
1) The Address Type, which is a fixed length code (of 2 bits) identifying the type of address that is used in the
Address field.
2) The Address Length, which is a fixed length code (of 6 bits) identifying the length of the Address field.
3) The Address, which is a variable length field which contains either an IPv4 address or an IPv6 address.
Address Type 0 and Address Length 4 are used when Address is an IPv4 address.
Address Type 1 and Address Length 16 are used when Address is an IPv6 address.
The IP v4 address structure is defined in RFC 791 [14].
The IP v6 address structure is defined in RFC 2373 [15].

Currently the Wireshark decodes IPv6 addresses as IPv4

This commit reverts parts of commit 1cdef1d98a

Change-Id: I4905d4cf559abcb42b9dfe3652667d2ff96dd444
Reviewed-on: https://code.wireshark.org/review/8984
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Vasil Velichckov 2015-06-19 19:24:53 +03:00 committed by Anders Broman
parent e8a238fce2
commit eb2dffa56c
3 changed files with 24 additions and 14 deletions

View File

@ -644,10 +644,10 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
octet = tvb_get_guint8(parameter_tvb,0);
switch(octet){
case 0x04: /* IPv4 */
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_reported_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, 4, ENC_BIG_ENDIAN);
break;
case 0x50: /* IPv4 */
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_reported_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN);
case 0x50: /* IPv6 */
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv6, parameter_tvb, 1, 16, ENC_NA);
break;
default:
break;

View File

@ -111,6 +111,7 @@ static int hf_gsm_map_qos_transfer_delay = -1;
static int hf_gsm_map_guaranteed_max_brate_ulink = -1;
static int hf_gsm_map_guaranteed_max_brate_dlink = -1;
static int hf_gsm_map_GSNAddress_IPv4 = -1;
static int hf_gsm_map_GSNAddress_IPv6 = -1;
static int hf_gsm_map_ranap_service_Handover = -1;
static int hf_gsm_map_IntegrityProtectionInformation = -1;
static int hf_gsm_map_EncryptionInformation = -1;
@ -2749,6 +2750,10 @@ void proto_register_gsm_map(void) {
{ "GSN-Address IPv4", "gsm_map.gsnaddress_ipv4",
FT_IPv4, BASE_NONE, NULL, 0,
"IPAddress IPv4", HFILL }},
{ &hf_gsm_map_GSNAddress_IPv6,
{ "GSN Address IPv6", "gsm_map.gsnaddress_ipv6",
FT_IPv6, BASE_NONE, NULL, 0,
"IPAddress IPv6", HFILL }},
{ &hf_gsm_map_ranap_service_Handover,
{ "service-Handover", "gsm_map.ranap.service_Handover",
FT_UINT32, BASE_DEC, VALS(ranap_Service_Handover_vals), 0,

View File

@ -119,6 +119,7 @@ static int hf_gsm_map_qos_transfer_delay = -1;
static int hf_gsm_map_guaranteed_max_brate_ulink = -1;
static int hf_gsm_map_guaranteed_max_brate_dlink = -1;
static int hf_gsm_map_GSNAddress_IPv4 = -1;
static int hf_gsm_map_GSNAddress_IPv6 = -1;
static int hf_gsm_map_ranap_service_Handover = -1;
static int hf_gsm_map_IntegrityProtectionInformation = -1;
static int hf_gsm_map_EncryptionInformation = -1;
@ -1890,7 +1891,7 @@ static int hf_NokiaMAP_Extensions_AccessSubscriptionListExt_item = -1; /* Acces
static int hf_NokiaMAP_Extensions_AllowedServiceData_amr_wb_allowed = -1;
/*--- End of included file: packet-gsm_map-hf.c ---*/
#line 149 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 150 "../../asn1/gsm_map/packet-gsm_map-template.c"
/* Initialize the subtree pointers */
static gint ett_gsm_map = -1;
@ -2599,7 +2600,7 @@ static gint ett_NokiaMAP_Extensions_AccessSubscriptionListExt = -1;
static gint ett_NokiaMAP_Extensions_AllowedServiceData = -1;
/*--- End of included file: packet-gsm_map-ett.c ---*/
#line 181 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 182 "../../asn1/gsm_map/packet-gsm_map-template.c"
static expert_field ei_gsm_map_unknown_sequence3 = EI_INIT;
static expert_field ei_gsm_map_unknown_sequence = EI_INIT;
@ -3812,10 +3813,10 @@ dissect_gsm_map_GSN_Address(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
octet = tvb_get_guint8(parameter_tvb,0);
switch(octet){
case 0x04: /* IPv4 */
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_reported_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, 4, ENC_BIG_ENDIAN);
break;
case 0x50: /* IPv4 */
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_reported_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN);
case 0x50: /* IPv6 */
proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv6, parameter_tvb, 1, 16, ENC_NA);
break;
default:
break;
@ -20279,7 +20280,7 @@ dissect_NokiaMAP_Extensions_AllowedServiceData(gboolean implicit_tag _U_, tvbuff
/*--- End of included file: packet-gsm_map-fn.c ---*/
#line 828 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 829 "../../asn1/gsm_map/packet-gsm_map-template.c"
/* Specific translation for MAP V3 */
const value_string gsm_map_V1V2_opr_code_strings[] = {
@ -20501,7 +20502,7 @@ const value_string gsm_map_opr_code_strings[] = {
/* Unknown or empty loop list OPERATION */
/*--- End of included file: packet-gsm_map-table.c ---*/
#line 839 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 840 "../../asn1/gsm_map/packet-gsm_map-template.c"
{ 0, NULL }
};
@ -20718,7 +20719,7 @@ static const value_string gsm_map_err_code_string_vals[] = {
/* Unknown or empty loop list OPERATION */
/*--- End of included file: packet-gsm_map-table.c ---*/
#line 845 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 846 "../../asn1/gsm_map/packet-gsm_map-template.c"
{ 0, NULL }
};
#endif
@ -22626,6 +22627,10 @@ void proto_register_gsm_map(void) {
{ "GSN-Address IPv4", "gsm_map.gsnaddress_ipv4",
FT_IPv4, BASE_NONE, NULL, 0,
"IPAddress IPv4", HFILL }},
{ &hf_gsm_map_GSNAddress_IPv6,
{ "GSN Address IPv6", "gsm_map.gsnaddress_ipv6",
FT_IPv6, BASE_NONE, NULL, 0,
"IPAddress IPv6", HFILL }},
{ &hf_gsm_map_ranap_service_Handover,
{ "service-Handover", "gsm_map.ranap.service_Handover",
FT_UINT32, BASE_DEC, VALS(ranap_Service_Handover_vals), 0,
@ -29542,7 +29547,7 @@ void proto_register_gsm_map(void) {
NULL, HFILL }},
/*--- End of included file: packet-gsm_map-hfarr.c ---*/
#line 2899 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 2904 "../../asn1/gsm_map/packet-gsm_map-template.c"
};
/* List of subtrees */
@ -30253,7 +30258,7 @@ void proto_register_gsm_map(void) {
&ett_NokiaMAP_Extensions_AllowedServiceData,
/*--- End of included file: packet-gsm_map-ettarr.c ---*/
#line 2933 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 2938 "../../asn1/gsm_map/packet-gsm_map-template.c"
};
static ei_register_info ei[] = {
@ -30357,7 +30362,7 @@ void proto_register_gsm_map(void) {
/*--- End of included file: packet-gsm_map-dis-tab.c ---*/
#line 2971 "../../asn1/gsm_map/packet-gsm_map-template.c"
#line 2976 "../../asn1/gsm_map/packet-gsm_map-template.c"
oid_add_from_string("ericsson-gsm-Map-Ext","1.2.826.0.1249.58.1.0" );
oid_add_from_string("accessTypeNotAllowed-id","1.3.12.2.1107.3.66.1.2");
/*oid_add_from_string("map-ac networkLocUp(1) version3(3)","0.4.0.0.1.0.1.3" );