diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2021-07-23 22:33:34 +0100 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2021-07-24 10:58:15 +0000 |
commit | a975ef72037346c6f4d30acf36649ea414e1f33b (patch) | |
tree | aba09cd70d51c82c635c31c2a37812078613595a | |
parent | c8fa2c461f1593f54904b1680496d0d7ebbf6fd6 (diff) |
check_typed_item_calls.py: Add a check for all-zeroes mask
When the mask value is 0x0, it effectively means there is no
mask, and that all bits count.
Fix found instances and replace them with 0x0.
-rw-r--r-- | epan/dissectors/packet-btavdtp.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-docsis-macmgmt.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_a_rr.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-homeplug-av.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee8021cb.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-turbocell.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-audio.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-usbll.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-vxlan.c | 10 | ||||
-rwxr-xr-x | tools/check_typed_item_calls.py | 8 |
10 files changed, 52 insertions, 44 deletions
diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index 5533fa214e..a9654aa823 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -2349,7 +2349,7 @@ proto_register_btavdtp(void) }, { &hf_btavdtp_content_protection_type, { "Type", "btavdtp.content_protection_type", - FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0000, + FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0, NULL, HFILL } }, { &hf_btavdtp_media_codec_media_type, @@ -3594,7 +3594,7 @@ proto_register_bta2dp(void) }, { &hf_bta2dp_content_protection, { "Content Protection", "bta2dp.content_protection", - FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0000, + FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0, NULL, HFILL } }, { &hf_bta2dp_stream_start_in_frame, @@ -3827,7 +3827,7 @@ proto_register_btvdp(void) }, { &hf_btvdp_content_protection, { "Content Protection", "btvdp.content_protection", - FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0000, + FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0, NULL, HFILL } }, { &hf_btvdp_stream_start_in_frame, diff --git a/epan/dissectors/packet-docsis-macmgmt.c b/epan/dissectors/packet-docsis-macmgmt.c index 9592f5fdb4..72f28d4d2f 100644 --- a/epan/dissectors/packet-docsis-macmgmt.c +++ b/epan/dissectors/packet-docsis-macmgmt.c @@ -8120,12 +8120,12 @@ proto_register_docsis_mgmt (void) }, {&hf_docsis_rngrsp_trans_eq_enc_coef_real, {"Coefficient (real)", "docsis_rngrsp.tlv.trans_eq_enc_coef_real", - FT_INT16, BASE_CUSTOM, CF_FUNC(two_compl_frac), 0x000, + FT_INT16, BASE_CUSTOM, CF_FUNC(two_compl_frac), 0x0, NULL, HFILL} }, {&hf_docsis_rngrsp_trans_eq_enc_coef_imag, {"Coefficient (imag)", "docsis_rngrsp.tlv.trans_eq_enc_coef_imag", - FT_INT16, BASE_CUSTOM, CF_FUNC(two_compl_frac), 0x000, + FT_INT16, BASE_CUSTOM, CF_FUNC(two_compl_frac), 0x0, NULL, HFILL} }, {&hf_docsis_rngrsp_commanded_power_data, diff --git a/epan/dissectors/packet-gsm_a_rr.c b/epan/dissectors/packet-gsm_a_rr.c index 9a954683d1..1537fc6ba5 100644 --- a/epan/dissectors/packet-gsm_a_rr.c +++ b/epan/dissectors/packet-gsm_a_rr.c @@ -12348,17 +12348,17 @@ proto_register_gsm_a_rr(void) }, { &hf_gsm_a_rr_range_lower, { "Range Lower","gsm_a.rr.range_lower", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, "ARFCN used as the lower limit of a range of frequencies to be used by the mobile station in cell selection (Range Lower)", HFILL } }, { &hf_gsm_a_rr_range_higher, { "Range Higher","gsm_a.rr.range_higher", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, "ARFCN used as the higher limit of a range of frequencies to be used by the mobile station in cell selection (Range Higher)", HFILL } }, { &hf_gsm_a_rr_ba_freq, { "BA Freq","gsm_a.rr.ba_freq", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, "ARFCN indicating a single frequency to be used by the mobile station in cell selection and reselection (BA Freq)", HFILL } }, { &hf_gsm_a_rr_ho_ref_val, @@ -13024,72 +13024,72 @@ proto_register_gsm_a_rr(void) }, { &hf_gsm_a_rr_fdd_uarfcn, { "FDD UARFCN", "gsm_a.rr.fdd_uarfcn", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_bandwidth_fdd, { "Bandwidth FDD", "gsm_a.rr.bandwidth_fdd", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_tdd_uarfcn, { "TDD UARFCN", "gsm_a.rr.tdd_uarfcn", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_bandwidth_tdd, { "Bandwidth TDD", "gsm_a.rr.bandwidth_tdd", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_arfcn, { "ARFCN", "gsm_a.rr.arfcn", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, "Absolute Radio Frequency Channel Number (ARFCN)", HFILL } }, { &hf_gsm_a_rr_bsic, { "BSIC", "gsm_a.rr.bsic", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, "Base Station Identify Code (BSIC)", HFILL } }, { &hf_gsm_a_rr_qsearch_i, { "Qsearch I", "gsm_a.rr.qsearch_i", - FT_UINT8, BASE_DEC, VALS(gsm_a_rr_qsearch_x_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_rr_qsearch_x_vals), 0x0, "Search for 3G cells if signal level is below (0 7) or above (8 15) threshold (Qsearch I)", HFILL } }, { &hf_gsm_a_rr_fdd_qoffset, { "FDD Qoffset", "gsm_a.rr.fdd_qoffset", - FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xdd_qoffset_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xdd_qoffset_vals), 0x0, "Offset to RLA_C for cell re selection to FDD access technology (FDD Qoffset)", HFILL } }, { &hf_gsm_a_rr_fdd_qmin, { "FDD Qmin", "gsm_a.rr.fdd_qmin", - FT_UINT8, BASE_DEC, VALS(gsm_a_rr_fdd_qmin_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_rr_fdd_qmin_vals), 0x0, "Minimum threshold for Ec/No for UTRAN FDD cell re-selection (FDD Qmin)", HFILL } }, { &hf_gsm_a_rr_tdd_qoffset, { "TDD Qoffset", "gsm_a.rr.tdd_qoffset", - FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xdd_qoffset_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xdd_qoffset_vals), 0x0, "Offset to RLA_C for cell re selection to TDD access technology (TDD Qoffset)", HFILL } }, { &hf_gsm_a_rr_fdd_qmin_offset, { "FDD Qmin Offset", "gsm_a.rr.fdd_qmin_offset", - FT_UINT8, BASE_DEC, VALS(gsm_a_rr_fdd_qmin_offset_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_rr_fdd_qmin_offset_vals), 0x0, "Offset to FDD Qmin value (FDD Qmin Offset)", HFILL } }, { &hf_gsm_a_rr_fdd_rscpmin, { "FDD RSCPmin", "gsm_a.rr.fdd_rscpmin", - FT_UINT8, BASE_DEC, VALS(gsm_a_rr_fdd_rscpmin_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_rr_fdd_rscpmin_vals), 0x0, "Minimum threshold of RSCP for UTRAN FDD cell re-selection (FDD RSCPmin)", HFILL } }, { &hf_gsm_a_rr_3g_ba_ind, { "3G BA-IND", "gsm_a.rr.3g_ba_ind", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, "3G BCCH Allocation Indication (3G BA-IND)", HFILL } }, { &hf_gsm_a_rr_mp_change_mark, { "Measurement Parameter Change Mark", "gsm_a.rr.mp_change_mark", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_si2quater_index, @@ -13981,12 +13981,12 @@ proto_register_gsm_a_rr(void) }, { &hf_gsm_a_rr_utran_csg_fdd_uarfcn, { "CSG FDD UARFCN", "gsm_a.rr.utran_csg_fdd_uarfcn", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_utran_csg_tdd_uarfcn, { "CSG TDD UARFCN", "gsm_a.rr.utran_csg_tdd_uarfcn", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_csg_earfcn, diff --git a/epan/dissectors/packet-homeplug-av.c b/epan/dissectors/packet-homeplug-av.c index 65f4fdb909..f096220ca3 100644 --- a/epan/dissectors/packet-homeplug-av.c +++ b/epan/dissectors/packet-homeplug-av.c @@ -6039,7 +6039,7 @@ proto_register_homeplug_av(void) }, { &hf_homeplug_av_mmhdr_fmi, { "Fragmentation Info", "homeplug_av.mmhdr.fmi", - FT_UINT16, BASE_HEX, NULL, 0x0000, "Reserved", HFILL }, + FT_UINT16, BASE_HEX, NULL, 0x0, "Reserved", HFILL }, }, /* Public MME */ { &hf_homeplug_av_public, diff --git a/epan/dissectors/packet-ieee8021cb.c b/epan/dissectors/packet-ieee8021cb.c index ad4a943875..25b9079357 100644 --- a/epan/dissectors/packet-ieee8021cb.c +++ b/epan/dissectors/packet-ieee8021cb.c @@ -115,7 +115,7 @@ proto_register_ieee8021cb(void) static hf_register_info hf_1cb[] = { { &hf_ieee8021cb_res, { "Reserved", "ieee8021cb.reserved", FT_UINT16, BASE_HEX, - NULL, 0x0000, NULL, HFILL }}, + NULL, 0x0, NULL, HFILL }}, { &hf_ieee8021cb_seq, { "SEQ", "ieee8021cb.seq", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-turbocell.c b/epan/dissectors/packet-turbocell.c index 4027505478..ab7d5a5e39 100644 --- a/epan/dissectors/packet-turbocell.c +++ b/epan/dissectors/packet-turbocell.c @@ -279,7 +279,7 @@ void proto_register_turbocell(void) static hf_register_info aggregate_fields[] = { { &hf_turbocell_aggregate_msdu_header_text, {"MAC Service Data Unit (MSDU)", "turbocell_aggregate.msduheader", - FT_UINT16, BASE_DEC, 0, 0x0000, NULL, HFILL } + FT_UINT16, BASE_DEC, 0, 0x0, NULL, HFILL } }, { &hf_turbocell_aggregate_msdu_len, {"MSDU length", "turbocell_aggregate.msdulen", diff --git a/epan/dissectors/packet-usb-audio.c b/epan/dissectors/packet-usb-audio.c index 1e963fc603..8e70b6db1b 100644 --- a/epan/dissectors/packet-usb-audio.c +++ b/epan/dissectors/packet-usb-audio.c @@ -2242,7 +2242,7 @@ proto_register_usb_audio(void) FT_UINT16, BASE_HEX, NULL, 0xF000, NULL, HFILL }}, { &hf_ac_if_input_bmchannelconfig, { "Channel Config", "usbaudio.ac_if_input.bmChannelConfig", - FT_UINT32, BASE_HEX, NULL, 0x00000000, "bmChannelConfig", HFILL }}, + FT_UINT32, BASE_HEX, NULL, 0x0, "bmChannelConfig", HFILL }}, { &hf_ac_if_input_bmchannelconfig_d0, { "Front Left", "usbaudio.ac_if_input.bmChannelConfig.d0", FT_BOOLEAN, 32, NULL, (1u << 0), NULL, HFILL }}, @@ -2335,7 +2335,7 @@ proto_register_usb_audio(void) FT_UINT8, BASE_DEC, NULL, 0x00, "iChannelNames", HFILL }}, { &hf_ac_if_input_controls, { "Controls", "usbaudio.ac_if_input.bmControls", - FT_UINT16, BASE_HEX, NULL, 0x0000, "bmControls", HFILL }}, + FT_UINT16, BASE_HEX, NULL, 0x0, "bmControls", HFILL }}, { &hf_ac_if_input_controls_copy, { "Copy Protect Control", "usbaudio.ac_if_input.bmControls.copy", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &controls_capabilities_vals_ext, 0x0003, NULL, HFILL }}, @@ -2368,16 +2368,16 @@ proto_register_usb_audio(void) BASE_HEX|BASE_EXT_STRING, &terminal_types_vals_ext, 0x00, "wTerminalType", HFILL }}, { &hf_ac_if_output_assocterminal, { "Assoc Terminal", "usbaudio.ac_if_output.bAssocTerminal", - FT_UINT8, BASE_DEC, NULL, 0x00, "bAssocTerminal", HFILL }}, + FT_UINT8, BASE_DEC, NULL, 0x0, "bAssocTerminal", HFILL }}, { &hf_ac_if_output_sourceid, { "Source ID", "usbaudio.ac_if_output.bSourceID", - FT_UINT8, BASE_DEC, NULL, 0x00, "bSourceID", HFILL }}, + FT_UINT8, BASE_DEC, NULL, 0x0, "bSourceID", HFILL }}, { &hf_ac_if_output_clk_sourceid, { "Connected Clock Entity", "usbaudio.ac_if_output.bCSourceID", - FT_UINT8, BASE_DEC, NULL, 0x00, "bCSourceID", HFILL }}, + FT_UINT8, BASE_DEC, NULL, 0x0, "bCSourceID", HFILL }}, { &hf_ac_if_output_controls, { "Controls", "usbaudio.ac_if_output.bmControls", - FT_UINT16, BASE_HEX, NULL, 0x0000, "bmControls", HFILL }}, + FT_UINT16, BASE_HEX, NULL, 0x0, "bmControls", HFILL }}, { &hf_ac_if_output_controls_copy, { "Copy Protect Control", "usbaudio.ac_if_output.bmControls.copy", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &controls_capabilities_vals_ext, 0x0003, NULL, HFILL }}, @@ -2452,7 +2452,7 @@ proto_register_usb_audio(void) FT_BYTES, BASE_NONE, NULL, 0x00, "bmaControls", HFILL }}, { &hf_ac_if_fu_control_v2, { "Control", "usbaudio.ac_if_fu.bmaControl_v2", - FT_UINT32, BASE_HEX, NULL, 0x00000000, "bmaControls", HFILL }}, + FT_UINT32, BASE_HEX, NULL, 0x0, "bmaControls", HFILL }}, { &hf_ac_if_fu_controls_v2_d0, { "Mute", "usbaudio.ac_if_fu.bmaControls_v2.d0", FT_UINT32, BASE_HEX|BASE_EXT_STRING, &controls_capabilities_vals_ext, (3u << 0), NULL, HFILL }}, @@ -2674,7 +2674,7 @@ proto_register_usb_audio(void) FT_UINT8, BASE_DEC, NULL, 0x00, "bFormatType", HFILL }}, { &hf_as_if_gen_formats, { "Formats", "usbaudio.as_if_gen.bmFormats", - FT_UINT32, BASE_HEX, NULL, 0x00000000, "bmFormats", HFILL }}, + FT_UINT32, BASE_HEX, NULL, 0x0, "bmFormats", HFILL }}, { &hf_as_if_gen_formats_i_d0, { "PCM", "usbaudio.as_if_gen.bmFormats.d0", @@ -2835,7 +2835,7 @@ proto_register_usb_audio(void) FT_UINT8, BASE_DEC, NULL, 0x00, "bNrChannels", HFILL }}, { &hf_as_if_gen_bmchannelconfig, { "Channel Config", "usbaudio.as_if_gen.bmChannelConfig", - FT_UINT32, BASE_HEX, NULL, 0x00000000, "bmChannelConfig", HFILL }}, + FT_UINT32, BASE_HEX, NULL, 0x0, "bmChannelConfig", HFILL }}, { &hf_as_if_gen_bmchannelconfig_d0, { "Front Left", "usbaudio.as_if_gen.bmChannelConfig.d0", FT_BOOLEAN, 32, NULL, (1u << 0), NULL, HFILL }}, @@ -2998,11 +2998,11 @@ proto_register_usb_audio(void) FT_UINT8, BASE_DEC, VALS(lock_delay_unit_vals), 0x00, NULL, HFILL }}, { &hf_as_ep_gen_lockdelay, { "Lock Delay", "usbaudio.as_ep_gen.wLockDelay", - FT_UINT16, BASE_DEC, NULL, 0x0000, NULL, HFILL }}, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ms_if_desc_subtype, { "Subtype", "usbaudio.ms_if_subtype", FT_UINT8, BASE_HEX|BASE_EXT_STRING, - &ms_if_subtype_vals_ext, 0x00, "bDescriptorSubtype", HFILL }}, + &ms_if_subtype_vals_ext, 0x0, "bDescriptorSubtype", HFILL }}, { &hf_ms_if_hdr_ver, { "Version", "usbaudio.ms_if_hdr.bcdADC", FT_DOUBLE, BASE_NONE, NULL, 0, "bcdADC", HFILL }}, diff --git a/epan/dissectors/packet-usbll.c b/epan/dissectors/packet-usbll.c index 68ddf07927..72bd033e9f 100644 --- a/epan/dissectors/packet-usbll.c +++ b/epan/dissectors/packet-usbll.c @@ -1386,7 +1386,7 @@ proto_register_usbll(void) NULL, HFILL }}, { &hf_usbll_data_crc, { "CRC", "usbll.crc16", - FT_UINT16, BASE_HEX, NULL, 0x0000, + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_usbll_data_crc_status, { "CRC Status", "usbll.crc16.status", diff --git a/epan/dissectors/packet-vxlan.c b/epan/dissectors/packet-vxlan.c index cba25405e2..b9244841a5 100644 --- a/epan/dissectors/packet-vxlan.c +++ b/epan/dissectors/packet-vxlan.c @@ -226,31 +226,31 @@ proto_register_vxlan(void) }, { &hf_vxlan_gbp, { "Group Policy ID", "vxlan.gbp", - FT_UINT16, BASE_DEC, NULL, 0x00, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }, }, { &hf_vxlan_vni, { "VXLAN Network Identifier (VNI)", "vxlan.vni", - FT_UINT24, BASE_DEC, NULL, 0x00, + FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }, }, { &hf_vxlan_reserved_8, { "Reserved", "vxlan.reserved8", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }, }, { &hf_vxlan_gpe_reserved_16, { "Reserved", "vxlan.reserved_16", - FT_UINT16, BASE_DEC, NULL, 0x0000, + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }, }, { &hf_vxlan_next_proto, { "Next Protocol", "vxlan.next_proto", - FT_UINT8, BASE_DEC, VALS(vxlan_next_protocols), 0x00, + FT_UINT8, BASE_DEC, VALS(vxlan_next_protocols), 0x0, NULL, HFILL }, }, diff --git a/tools/check_typed_item_calls.py b/tools/check_typed_item_calls.py index 746771bdf1..dae201959f 100755 --- a/tools/check_typed_item_calls.py +++ b/tools/check_typed_item_calls.py @@ -226,6 +226,7 @@ class Item: self.check_contiguous_bits(mask) self.check_mask_too_long(mask) self.check_num_digits(mask) + self.check_digits_all_zeros(mask) def set_mask_value(self): @@ -336,6 +337,13 @@ class Item: print('Warning: ', self.filename, 'filter=', self.filter, ' - item has type', self.item_type, 'but mask set:', mask) issues_found += 1 + def check_digits_all_zeros(self, mask): + if mask.startswith('0x') and len(mask) > 3: + if mask[2:] == '0'*(len(mask)-2): + print('Warning: ', self.filename, 'filter=', self.filter, ' - item has all zeros - this is confusing! :', mask) + global issues_found + issues_found += 1 + |