forked from osmocom/wireshark
ntp: make ntp.precision an uint8.
Change-Id: I7ee0c7fbe5bab90bd1109b2f39feaec033b95621 Reviewed-on: https://code.wireshark.org/review/29178 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
parent
16e6c12f90
commit
77b4b938e3
|
@ -945,8 +945,8 @@ dissect_ntp_std(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ntp_tree)
|
|||
* local clock, in seconds to the nearest power of two.
|
||||
*/
|
||||
precision = tvb_get_guint8(tvb, 3);
|
||||
proto_tree_add_int_format_value(ntp_tree, hf_ntp_precision, tvb, 3, 1,
|
||||
precision, "%8.6f seconds", pow(2, precision));
|
||||
proto_tree_add_uint_format_value(ntp_tree, hf_ntp_precision, tvb, 3, 1,
|
||||
(guint8)precision, "%8.6f seconds", pow(2, precision));
|
||||
|
||||
/* Root Delay is a 32-bit signed fixed-point number indicating
|
||||
* the total roundtrip delay to the primary reference source,
|
||||
|
@ -1448,7 +1448,7 @@ proto_register_ntp(void)
|
|||
"Peer Polling Interval", "ntp.ppoll", FT_UINT8, BASE_DEC,
|
||||
NULL, 0, "Maximum interval between successive messages", HFILL }},
|
||||
{ &hf_ntp_precision, {
|
||||
"Peer Clock Precision", "ntp.precision", FT_INT8, BASE_DEC,
|
||||
"Peer Clock Precision", "ntp.precision", FT_UINT8, BASE_DEC,
|
||||
NULL, 0, "The precision of the system clock", HFILL }},
|
||||
{ &hf_ntp_rootdelay, {
|
||||
"Root Delay", "ntp.rootdelay", FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING,
|
||||
|
|
|
@ -87,51 +87,51 @@ class case_integer(dfiltertest.DFTestCase):
|
|||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_s_gt_1(self):
|
||||
dfilter = "ntp.precision > -12"
|
||||
dfilter = "ntp.precision > 244"
|
||||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_s_gt_2(self):
|
||||
dfilter = "ntp.precision > -11"
|
||||
dfilter = "ntp.precision > 245"
|
||||
self.assertDFilterCount(dfilter, 0)
|
||||
|
||||
def test_s_gt_3(self):
|
||||
dfilter = "ntp.precision > -10"
|
||||
dfilter = "ntp.precision > 246"
|
||||
self.assertDFilterCount(dfilter, 0)
|
||||
|
||||
def test_s_ge_1(self):
|
||||
dfilter = "ntp.precision >= -12"
|
||||
dfilter = "ntp.precision >= 244"
|
||||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_s_ge_2(self):
|
||||
dfilter = "ntp.precision >= -11"
|
||||
dfilter = "ntp.precision >= 245"
|
||||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_s_ge_3(self):
|
||||
dfilter = "ntp.precision >= -10"
|
||||
dfilter = "ntp.precision >= 246"
|
||||
self.assertDFilterCount(dfilter, 0)
|
||||
|
||||
def test_s_lt_1(self):
|
||||
dfilter = "ntp.precision < -12"
|
||||
dfilter = "ntp.precision < 244"
|
||||
self.assertDFilterCount(dfilter, 0)
|
||||
|
||||
def test_s_lt_2(self):
|
||||
dfilter = "ntp.precision < -11"
|
||||
dfilter = "ntp.precision < 245"
|
||||
self.assertDFilterCount(dfilter, 0)
|
||||
|
||||
def test_s_lt_3(self):
|
||||
dfilter = "ntp.precision < -10"
|
||||
dfilter = "ntp.precision < 246"
|
||||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_s_le_1(self):
|
||||
dfilter = "ntp.precision <= -12"
|
||||
dfilter = "ntp.precision <= 244"
|
||||
self.assertDFilterCount(dfilter, 0)
|
||||
|
||||
def test_s_le_2(self):
|
||||
dfilter = "ntp.precision <= -11"
|
||||
dfilter = "ntp.precision <= 245"
|
||||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_s_le_3(self):
|
||||
dfilter = "ntp.precision <= -10"
|
||||
dfilter = "ntp.precision <= 246"
|
||||
self.assertDFilterCount(dfilter, 1)
|
||||
|
||||
def test_bool_eq_1(self):
|
||||
|
|
Loading…
Reference in New Issue