aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-nas_eps.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal@wireshark.org>2021-01-20 14:39:09 +0100
committerPascal Quantin <pascal@wireshark.org>2021-01-20 14:39:09 +0100
commitb794e4798a4e076e6d79d358a6fb7085e8f6427b (patch)
tree6de6c0324973c0858cfe99e813ea284cf9a33234 /epan/dissectors/packet-nas_eps.c
parent3aa64fe819d912d17dbfd3d6be9899023a4c6090 (diff)
NAS EPS: fix display of IPv6 interface identifier
Do not use FT_IPV6 as an interface identifier could be wrongly identified as an IPv4-Compatible IPv6 Address format by inet_ntop() and displayed as such.
Diffstat (limited to 'epan/dissectors/packet-nas_eps.c')
-rw-r--r--epan/dissectors/packet-nas_eps.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/epan/dissectors/packet-nas_eps.c b/epan/dissectors/packet-nas_eps.c
index 23c881203a..6578ad84f3 100644
--- a/epan/dissectors/packet-nas_eps.c
+++ b/epan/dissectors/packet-nas_eps.c
@@ -23,6 +23,7 @@
#include <epan/to_str.h>
#include <epan/proto_data.h>
#include <wsutil/pow2.h>
+#include <wsutil/pint.h>
#include "packet-gsm_map.h"
#include "packet-gsm_a_common.h"
#include "packet-e212.h"
@@ -3478,9 +3479,8 @@ de_esm_pdn_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
{
guint32 curr_offset;
guint8 pdn_type;
- ws_in6_addr interface_id;
+ guint8 interface_id[8];
- memset(&interface_id, 0, sizeof(interface_id));
curr_offset = offset;
pdn_type = tvb_get_guint8(tvb, offset) & 0x7;
@@ -3500,8 +3500,10 @@ de_esm_pdn_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
* contains an IPv6 interface identifier. Bit 8 of octet 4 represents the most significant bit
* of the IPv6 interface identifier and bit 1 of octet 11 the least significant bit.
*/
- tvb_memcpy(tvb, (guint8*)&interface_id.bytes[8], curr_offset, 8);
- proto_tree_add_ipv6(tree, hf_nas_eps_esm_pdn_ipv6_if_id, tvb, curr_offset, 8, &interface_id);
+ tvb_memcpy(tvb, interface_id, curr_offset, 8);
+ proto_tree_add_bytes_format_value(tree, hf_nas_eps_esm_pdn_ipv6_if_id, tvb, curr_offset, 8, NULL,
+ "::%x:%x:%x:%x", pntoh16(&interface_id[0]), pntoh16(&interface_id[2]),
+ pntoh16(&interface_id[4]), pntoh16(&interface_id[6]));
curr_offset+=8;
break;
case 3:
@@ -3512,8 +3514,10 @@ de_esm_pdn_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
* significant bit. Bit 8 of octet 12 represents the most significant bit of the IPv4 address
* and bit 1 of octet 15 the least significant bit.
*/
- tvb_memcpy(tvb, (guint8*)&interface_id.bytes[8], curr_offset, 8);
- proto_tree_add_ipv6(tree, hf_nas_eps_esm_pdn_ipv6_if_id, tvb, curr_offset, 8, &interface_id);
+ tvb_memcpy(tvb, interface_id, curr_offset, 8);
+ proto_tree_add_bytes_format_value(tree, hf_nas_eps_esm_pdn_ipv6_if_id, tvb, curr_offset, 8, NULL,
+ "::%x:%x:%x:%x", pntoh16(&interface_id[0]), pntoh16(&interface_id[2]),
+ pntoh16(&interface_id[4]), pntoh16(&interface_id[6]));
curr_offset+=8;
proto_tree_add_item(tree, hf_nas_eps_esm_pdn_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
curr_offset+=4;
@@ -8087,7 +8091,7 @@ proto_register_nas_eps(void)
},
{ &hf_nas_eps_esm_pdn_ipv6_if_id,
{"PDN IPv6 if id", "nas_eps.esm.pdn_ipv6_if_id",
- FT_IPv6, BASE_NONE, NULL, 0x0,
+ FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL}
},
{ &hf_nas_eps_esm_eplmnc,