aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ppi-gps.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2018-06-04 14:52:26 +0200
committerAnders Broman <a.broman58@gmail.com>2018-06-05 04:16:24 +0000
commit447ffdf042e0eebf87ea9d33a9823e6d24345a0e (patch)
tree808092498e2ff9ae1fac4a5f216f5a3ee069b325 /epan/dissectors/packet-ppi-gps.c
parent8e7396edb4b4ac9580cdddb4feb0903da071905f (diff)
Correctly handle the PPI GPS timestamp fraction
The timestamp and timestamp fraction are processed in one step, since this creates a proper timestamp interpretation. There are two fixes to this code to deal with erroneous packets. One is that when taking into account the timestamp fragment the available data must be 8 bytes in total, not just 4. The other is that when the mask indicates that there's only a timestamp fraction, nothing was shown. Change-Id: I4a0a65229f322ad56673a26ff6b3e769e994062d Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/28007 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ppi-gps.c')
-rw-r--r--epan/dissectors/packet-ppi-gps.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-ppi-gps.c b/epan/dissectors/packet-ppi-gps.c
index f421587dc7..0cb5d2fef2 100644
--- a/epan/dissectors/packet-ppi-gps.c
+++ b/epan/dissectors/packet-ppi-gps.c
@@ -68,7 +68,7 @@ static int hf_ppi_gps_lat = -1;
static int hf_ppi_gps_alt = -1;
static int hf_ppi_gps_alt_gnd = -1;
static int hf_ppi_gps_gpstime = -1;
-/* static int hf_ppi_gps_fractime = -1; */
+static int hf_ppi_gps_fractime = -1;
static int hf_ppi_gps_eph = -1;
static int hf_ppi_gps_epv = -1;
static int hf_ppi_gps_ept = -1;
@@ -295,7 +295,7 @@ dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
/* This is somewhat tricky, inside the GPSTIME case we test if the optional fractional time */
/* is present. If so, we pull it out, and combine it with GPSTime. */
/* If we do this, we set already_processed_fractime to avoid hitting it below */
- if (length_remaining < 4 && (present & PPI_GPS_MASK_FRACTIME))
+ if (length_remaining < 8 && (present & PPI_GPS_MASK_FRACTIME))
break;
else if (present & PPI_GPS_MASK_FRACTIME) {
gps_timestamp.nsecs = tvb_get_letohl(tvb, offset + 4); /* manually offset seconds */
@@ -311,6 +311,9 @@ dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
break;
if (already_processed_fractime)
break;
+ proto_tree_add_item(ppi_gps_tree, hf_ppi_gps_fractime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+ offset += 4;
+ length_remaining -= 4;
break;
case PPI_GEOTAG_EPH:
if (length_remaining < 4)
@@ -504,12 +507,10 @@ proto_register_ppi_gps(void) {
{ "GPSTimestamp", "ppi_gps.gpstime",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
"GPSTimestamp packet was received at", HFILL } },
-#if 0
{ &hf_ppi_gps_fractime,
{ "fractional Timestamp", "ppi_gps.fractime",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "fractional GPSTimestamp packet was received at", HFILL } },
-#endif
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ "Fractional of GPSTimestamp packet was received at", HFILL } },
{ &hf_ppi_gps_eph,
{ "Horizontal Error (m)", "ppi_gps.eph",
FT_DOUBLE, BASE_NONE, NULL, 0x0,