aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorAmit Cohen <amcohen@nvidia.com>2021-02-07 18:14:35 +0200
committerAndersBroman <a.broman58@gmail.com>2021-02-08 09:28:59 +0000
commit1684ff0b4a5b858fc31834033c19cc91e7f2fd65 (patch)
tree84e6d42683b959970a77503153b259331e7ea1cd /epan/dissectors
parentd28021cacb860722663e6402fe6aea37cd0de8a6 (diff)
packet-netlink-net_dm: Fix timestamp handling
Commit f582c85623bb ("netlink: use value retrieval with proper encoding") changed the conversion of timestamp field and with it the field is displayed incorrectly. In the kernel the timestamp field is encoded in nanoseconds using 64 bits. Change the code to the way it was written before which is compatible with kernel coding. Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-netlink-net_dm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/epan/dissectors/packet-netlink-net_dm.c b/epan/dissectors/packet-netlink-net_dm.c
index d69d68bd01..4e863751ba 100644
--- a/epan/dissectors/packet-netlink-net_dm.c
+++ b/epan/dissectors/packet-netlink-net_dm.c
@@ -309,7 +309,8 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
{
enum ws_net_dm_attrs type = (enum ws_net_dm_attrs) nla_type & NLA_TYPE_MASK;
struct netlink_net_dm_info *info = (struct netlink_net_dm_info *) data;
- guint64 pc;
+ guint64 pc, timestamp;
+ nstime_t ts_nstime;
guint32 value;
tvbuff_t *next_tvb;
const guint8 *str;
@@ -331,7 +332,10 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
return dissect_netlink_attributes(tvb, &hfi_net_dm_attrs_port, ett_net_dm_attrs_in_port, info, nl_data, tree, offset, len,
dissect_net_dm_attrs_port);
case WS_NET_DM_ATTR_TIMESTAMP:
- proto_tree_add_item(tree, &hfi_net_dm_timestamp, tvb, offset, 8, ENC_TIME_SECS_NSECS | nl_data->encoding);
+ timestamp = tvb_get_guint64(tvb, offset, nl_data->encoding);
+ ts_nstime.secs = timestamp / 1000000000;
+ ts_nstime.nsecs = timestamp % 1000000000;
+ proto_tree_add_time(tree, &hfi_net_dm_timestamp, tvb, offset, 8, &ts_nstime);
return 1;
case WS_NET_DM_ATTR_PROTO:
info->protocol = tvb_get_guint16(tvb, offset, nl_data->encoding);