diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:33 +0000 |
commit | 9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch) | |
tree | 2784370cda9bbf2da9114d70f05399c0b229d28c /epan/dissectors/packet-wifi-nan.c | |
parent | Adding debian version 4.2.6-1. (diff) | |
download | wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-wifi-nan.c')
-rw-r--r-- | epan/dissectors/packet-wifi-nan.c | 1702 |
1 files changed, 1212 insertions, 490 deletions
diff --git a/epan/dissectors/packet-wifi-nan.c b/epan/dissectors/packet-wifi-nan.c index cea457a2..e1ecd03b 100644 --- a/epan/dissectors/packet-wifi-nan.c +++ b/epan/dissectors/packet-wifi-nan.c @@ -55,286 +55,347 @@ static dissector_table_t ie_handle_table; #define NAN_SECURITY_CONTEXT_INFO_MIN_LENGTH 4 #define NAN_PUBLIC_AVAIL_MIN_LENGTH 4 #define NAN_VENDOR_SPECIFIC_MIN_LENGTH 3 +#define NAN_DEVICE_CAPABILITY_EXTENSION_MIN_LENGTH 2 +#define NAN_IDENTITY_RESOLUTION_MIN_LEN 1 +#define NAN_PAIRING_BOOTSTRAPPING_LEN 5 #define NAN_UNALIGNED_SCH_BAND_ID_EXIST 0 #define NAN_UNALIGNED_SCH_CHANNEL_ENTRY_EXIST 1 #define NAN_UNALIGNED_SCH_CHANNEL_ENTRY_W_AUX_EXIST 2 -static int proto_nan = -1; - -static expert_field ei_nan_elem_len_invalid = EI_INIT; -static expert_field ei_nan_unknown_attr_id = EI_INIT; -static expert_field ei_nan_unknown_op_class = EI_INIT; -static expert_field ei_nan_unknown_beacon_type = EI_INIT; - -static gint ett_nan = -1; -static gint ett_attributes = -1; -static gint ett_map_control = -1; -static gint ett_type_status = -1; -static gint ett_time_bitmap_ctrl = -1; -static gint ett_non_nan_op_channel = -1; -static gint ett_non_nan_beacon = -1; -static gint ett_cluster_anchor_master_info = -1; -static gint ett_sda_service_ctr = -1; -static gint ett_sda_srf_ctr = -1; -static gint ett_sdea_ctr = -1; -static gint ett_sdea_range_limit = -1; -static gint ett_sdea_service_info = -1; -static gint ett_connection_cap_field = -1; -static gint ett_further_av_map_entry_ctrl = -1; -static gint ett_device_cap_map_id = -1; -static gint ett_device_cap_committed_dw = -1; -static gint ett_device_cap_supported_bands = -1; -static gint ett_device_cap_op_mode = -1; -static gint ett_device_cap_antennas = -1; -static gint ett_device_cap_capabilities = -1; -static gint ett_ndp_control = -1; -static gint ett_ndpe_tlv = -1; -static gint ett_availability_ctr = -1; -static gint ett_availability_entry = -1; -static gint ett_availability_entry_ctr = -1; -static gint ett_availability_entry_entries = -1; -static gint ett_availability_entry_entries_channel = -1; -static gint ett_ndc_ctr = -1; -static gint ett_ndc_entries = -1; -static gint ett_device_ndc_map_id = -1; -static gint ett_ndl_control = -1; -static gint ett_ndl_schedule_entries = -1; -static gint ett_unaligned_sch_ctrl = -1; -static gint ett_unaligned_sch_ulw_overwrite = -1; -static gint ett_unaligned_sch_ulw_ctrl = -1; -static gint ett_ranging_setup_ftm_params = -1; -static gint ett_ranging_setup_ctrl = -1; -static gint ett_ranging_setup_schedule_entries = -1; -static gint ett_ranging_info_location_info_availability = -1; -static gint ett_p2p_device_role = -1; -static gint ett_cipher_suite_info_list = -1; -static gint ett_security_context_identifiers = -1; -static gint ett_public_availability_sch_entries = -1; -static gint ett_ie_tree = -1; -static gint ett_availability_op_class = -1; - -static int hf_nan_attribute_type = -1; -static int hf_nan_attribute_len = -1; -static int hf_nan_action_subtype = -1; -static int hf_nan_instance_id = -1; -static int hf_nan_service_id = -1; -static int hf_nan_map_id = -1; -static int hf_nan_oui = -1; -static int hf_nan_type_status = -1; -static int hf_nan_reason_code = -1; -static int hf_nan_status_1 = -1; -static int hf_nan_status_2 = -1; -static int hf_nan_bss_id = -1; -static int hf_nan_availability_intervals_bitmap = -1; -static int hf_nan_mac_address = -1; -static int hf_nan_publish_id = -1; -static int hf_nan_dialog_tokens = -1; -static int hf_nan_time_bitmap = -1; -static int hf_nan_time_bitmap_len = -1; -static int hf_nan_time_bitmap_ctrl = -1; -static int hf_nan_time_bitmap_ctrl_bit_duration = -1; -static int hf_nan_time_bitmap_ctrl_period = -1; -static int hf_nan_time_bitmap_ctrl_start_offset = -1; -static int hf_nan_map_ctrl_map_id = -1; -static int hf_nan_map_ctrl_availability_interval_duration = -1; -static int hf_nan_map_ctrl_repeat = -1; -static int hf_nan_map_ctrl_field = -1; -static int hf_nan_non_op_channel_global_op_class = -1; -static int hf_nan_non_op_channel_channel = -1; -static int hf_nan_non_op_channel_center_freq = -1; -static int hf_nan_non_beacon_tbtt_offset = -1; -static int hf_nan_non_beacon_interval = -1; -static int hf_nan_attr_master_preference = -1; -static int hf_nan_attr_master_random_factor = -1; -static int hf_nan_attr_cluster_anchor_master_rank = -1; -static int hf_nan_attr_cluster_hop_count = -1; -static int hf_nan_attr_cluster_beacon_transmission_time = -1; -static int hf_nan_attr_sda_requestor_instance_id = -1; -static int hf_nan_attr_sda_sc = -1; -static int hf_nan_attr_sda_sc_type = -1; -static int hf_nan_attr_sda_sc_matching_filter = -1; -static int hf_nan_attr_sda_sc_service_response = -1; -static int hf_nan_attr_sda_sc_service_info = -1; -static int hf_nan_attr_sda_sc_discovery_range = -1; -static int hf_nan_attr_sda_sc_binding_bitmap = -1; -static int hf_nan_attr_sda_binding_bitmap = -1; -static int hf_nan_attr_sda_matching_filter_len = -1; -static int hf_nan_attr_sda_matching_filter_val = -1; -static int hf_nan_attr_sda_service_response_filter_len = -1; -static int hf_nan_attr_sda_srf_ctr = -1; -static int hf_nan_attr_sda_srf_ctr_type = -1; -static int hf_nan_attr_sda_srf_ctr_include = -1; -static int hf_nan_attr_sda_srf_ctr_bloom_filter_index = -1; -static int hf_nan_attr_sda_srf_address_set = -1; -static int hf_nan_attr_sda_service_info_len = -1; -static int hf_nan_attr_sda_service_info = -1; -static int hf_nan_attr_sdea_ctr = -1; -static int hf_nan_attr_sdea_ctr_fsd = -1; -static int hf_nan_attr_sdea_ctr_fsd_w_gas = -1; -static int hf_nan_attr_sdea_ctr_data_path = -1; -static int hf_nan_attr_sdea_ctr_data_path_type = -1; -static int hf_nan_attr_sdea_ctr_reserved_multicast_type = -1; -static int hf_nan_attr_sdea_ctr_qos = -1; -static int hf_nan_attr_sdea_ctr_security = -1; -static int hf_nan_attr_sdea_ctr_ranging = -1; -static int hf_nan_attr_sdea_ctr_range_limit = -1; -static int hf_nan_attr_sdea_ctr_service_update_indicator = -1; -static int hf_nan_attr_sdea_ingress_range_limit = -1; -static int hf_nan_attr_sdea_egress_range_limit = -1; -static int hf_nan_attr_sdea_service_update_indicator = -1; -static int hf_nan_attr_sdea_service_info_length = -1; -static int hf_nan_attr_sdea_service_info_protocol_type = -1; -static int hf_nan_attr_sdea_service_info_specific = -1; -static int hf_nan_attr_connection_cap_bitmap = -1; -static int hf_nan_attr_connection_cap_wifi_direct = -1; -static int hf_nan_attr_connection_cap_p2ps = -1; -static int hf_nan_attr_connection_cap_tdls = -1; -static int hf_nan_attr_connection_cap_wlan_infra = -1; -static int hf_nan_attr_connection_cap_ibss = -1; -static int hf_nan_attr_connection_cap_mesh = -1; -static int hf_nan_attr_wlan_infra_device_role = -1; -static int hf_nan_attr_p2p_device_role_device = -1; -static int hf_nan_attr_p2p_device_role_group_owner = -1; -static int hf_nan_attr_p2p_device_role_client = -1; -static int hf_nan_attr_p2p_device_role = -1; -static int hf_nan_attr_mesh_id = -1; -static int hf_nan_attr_further_av_map_entry_av_interval_duration = -1; -static int hf_nan_attr_further_av_map_op_class = -1; -static int hf_nan_attr_further_av_map_channel_num = -1; -static int hf_nan_attr_further_av_map_entry_ctrl = -1; -static int hf_nan_attr_further_av_map_id = -1; -static int hf_nan_attr_country_code = -1; -static int hf_nan_attr_ranging_protocol = -1; -static int hf_nan_attr_cluster_disc_id = -1; -static int hf_nan_attr_cluster_disc_time_offset = -1; -static int hf_nan_attr_cluster_disc_anchor_master_rank = -1; -static int hf_nan_attr_device_cap_map_id_apply_to = -1; -static int hf_nan_attr_device_cap_map_id_associated_maps = -1; -static int hf_nan_attr_device_cap_committed_dw = -1; -static int hf_nan_attr_device_cap_committed_dw_24ghz = -1; -static int hf_nan_attr_device_cap_committed_dw_5ghz = -1; -static int hf_nan_attr_device_cap_committed_dw_24ghz_overwrite = -1; -static int hf_nan_attr_device_cap_committed_dw_5ghz_overwrite = -1; -static int hf_nan_attr_device_cap_supported_bands = -1; -static int hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces = -1; -static int hf_nan_attr_device_cap_supported_bands_sub_1ghz = -1; -static int hf_nan_attr_device_cap_supported_bands_24ghz = -1; -static int hf_nan_attr_device_cap_supported_bands_reserved_36ghz = -1; -static int hf_nan_attr_device_cap_supported_bands_5ghz = -1; -static int hf_nan_attr_device_cap_supported_bands_reserved_60ghz = -1; -static int hf_nan_attr_device_cap_op_mode = -1; -static int hf_nan_attr_device_cap_op_mode_phy = -1; -static int hf_nan_attr_device_cap_op_mode_vht8080 = -1; -static int hf_nan_attr_device_cap_op_mode_vht160 = -1; -static int hf_nan_attr_device_cap_op_mode_reserved_paging_ndl = -1; -static int hf_nan_attr_device_cap_antennas = -1; -static int hf_nan_attr_device_cap_antennas_tx = -1; -static int hf_nan_attr_device_cap_antennas_rx = -1; -static int hf_nan_attr_device_cap_max_channel_switch_time = -1; -static int hf_nan_attr_device_cap_capabilities = -1; -static int hf_nan_attr_device_cap_capabilities_dfs_master = -1; -static int hf_nan_attr_device_cap_capabilities_extended_key_id = -1; -static int hf_nan_attr_device_cap_capabilities_simul_ndp_reception = -1; -static int hf_nan_attr_device_cap_capabilities_ndpe_attr_support = -1; -static int hf_nan_attr_ndp_type = -1; -static int hf_nan_attr_ndp_initiator = -1; -static int hf_nan_attr_ndp_id = -1; -static int hf_nan_attr_ndp_ctrl_confirm = -1; -static int hf_nan_attr_ndp_ctrl_security_pres = -1; -static int hf_nan_attr_ndp_ctrl_publish_id_pres = -1; -static int hf_nan_attr_ndp_ctrl_responder_ndi_pres = -1; -static int hf_nan_attr_ndp_ctrl_sepcific_info_pres = -1; -static int hf_nan_attr_ndp_control = -1; -static int hf_nan_attr_ndp_responder_ndi = -1; -static int hf_nan_attr_ndp_specific_info = -1; -static int hf_nan_attr_ndpe_tlv_type = -1; -static int hf_nan_attr_ndpe_tlv_len = -1; -static int hf_nan_attr_ndpe_tlv_ipv6_interface_identifier = -1; -static int hf_nan_attr_availability_sequence_id = -1; -static int hf_nan_attr_availability_ctr = -1; -static int hf_nan_attr_availability_map_id = -1; -static int hf_nan_attr_availability_committed_changed = -1; -static int hf_nan_attr_availability_potential_changed = -1; -static int hf_nan_attr_availability_public_availability_changed = -1; -static int hf_nan_attr_availability_ndc_changed = -1; -static int hf_nan_attr_availability_reserved_multicast_schedule_changed = -1; -static int hf_nan_attr_availability_reserved_multicast_schedule_change_changed = -1; -static int hf_nan_attr_availability_entry_len = -1; -static int hf_nan_attr_availability_entry_ctr = -1; -static int hf_nan_attr_availability_entry_ctr_type = -1; -static int hf_nan_attr_availability_entry_ctr_pref = -1; -static int hf_nan_attr_availability_entry_ctr_utilization = -1; -static int hf_nan_attr_availability_entry_ctr_rx_nss = -1; -static int hf_nan_attr_availability_entry_ctr_time_bitmap = -1; -static int hf_nan_attr_availability_entry_entries_type = -1; -static int hf_nan_attr_availability_entry_entries_non_contiguous_bw = -1; -static int hf_nan_attr_availability_entry_entries_num_entries = -1; -static int hf_nan_attr_availability_entry_entries_band = -1; -static int hf_nan_attr_availability_entry_entries_channel_op_class = -1; -static int hf_nan_attr_availability_entry_entries_channel_bitmap = -1; -static int hf_nan_attr_availability_entry_entries_primary_channel_bitmap = -1; -static int hf_nan_attr_availability_entry_entries_aux_channel_bitmap = -1; -static int hf_nan_attr_availability_entry_entries_channel_set = -1; -static int hf_nan_attr_availability_entry_entries_start_freq = -1; -static int hf_nan_attr_availability_entry_entries_bandwidth = -1; -static int hf_nan_attr_ndc_id = -1; -static int hf_nan_attr_ndc_ctrl = -1; -static int hf_nan_attr_ndc_ctrl_selected = -1; -static int hf_nan_attr_ndc_map_id_related_sch = -1; -static int hf_nan_attr_ndl_type = -1; -static int hf_nan_attr_ndl_control = -1; -static int hf_nan_attr_ndl_ctrl_peer_id = -1; -static int hf_nan_attr_ndl_ctrl_immutable_schedule_pres = -1; -static int hf_nan_attr_ndl_ctrl_ndc_pres = -1; -static int hf_nan_attr_ndl_ctrl_qos = -1; -static int hf_nan_attr_ndl_ctrl_type = -1; -static int hf_nan_attr_ndl_ctrl_setup_reason = -1; -static int hf_nan_attr_ndl_ctrl_max_idle_pres = -1; -static int hf_nan_attr_ndl_reserved_peer_id = -1; -static int hf_nan_attr_ndl_max_idle = -1; -static int hf_nan_attr_ndlqos_min_time_slots = -1; -static int hf_nan_attr_ndlqos_max_latency = -1; -static int hf_nan_attr_unaligned_sch_ctrl = -1; -static int hf_nan_attr_unaligned_sch_ctrl_schedule_id = -1; -static int hf_nan_attr_unaligned_sch_ctrl_seq_id = -1; -static int hf_nan_attr_unaligned_sch_starting_time = -1; -static int hf_nan_attr_unaligned_sch_duration = -1; -static int hf_nan_attr_unaligned_sch_period = -1; -static int hf_nan_attr_unaligned_sch_count_down = -1; -static int hf_nan_attr_unaligned_sch_ulw_overwrite = -1; -static int hf_nan_attr_unaligned_sch_ulw_overwrite_all = -1; -static int hf_nan_attr_unaligned_sch_ulw_overwrite_map_id = -1; -static int hf_nan_attr_unaligned_sch_ulw_ctrl = -1; -static int hf_nan_attr_unaligned_sch_ulw_ctrl_type = -1; -static int hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av = -1; -static int hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss = -1; -static int hf_nan_attr_ranging_info_location_info_avail = -1; -static int hf_nan_attr_ranging_info_location_info_avail_lci = -1; -static int hf_nan_attr_ranging_info_location_info_avail_geospatial = -1; -static int hf_nan_attr_ranging_info_location_info_avail_civic_location = -1; -static int hf_nan_attr_ranging_info_location_info_avail_last_movement_pres = -1; -static int hf_nan_attr_ranging_info_last_movement_indication = -1; -static int hf_nan_attr_ranging_setup_type = -1; -static int hf_nan_attr_ranging_setup_ctrl = -1; -static int hf_nan_attr_ranging_setup_ctrl_report_req = -1; -static int hf_nan_attr_ranging_setup_ctrl_ftm_params = -1; -static int hf_nan_attr_ranging_setup_ctrl_entry_list = -1; -static int hf_nan_attr_ranging_setup_ftm_params = -1; -static int hf_nan_attr_ranging_setup_ftm_max_per_burst = -1; -static int hf_nan_attr_ranging_setup_ftm_min_delta = -1; -static int hf_nan_attr_ranging_setup_ftm_max_burst_duration = -1; -static int hf_nan_attr_ranging_setup_ftm_format_bw = -1; -static int hf_nan_attr_ftm_range_report = -1; -static int hf_nan_attr_cipher_suite_capabilities = -1; -static int hf_nan_attr_cipher_suite_id = -1; -static int hf_nan_attr_security_context_identifier = -1; -static int hf_nan_attr_security_context_identifier_len = -1; -static int hf_nan_attr_security_context_identifier_type = -1; -static int hf_nan_attr_shared_key_rsna_descriptor = -1; -static int hf_nan_attr_vendor_specific_body = -1; -static int hf_nan_attr_container_element_id = -1; -static int hf_nan_attr_container_element_len = -1; +static int proto_nan; + +static expert_field ei_nan_elem_len_invalid; +static expert_field ei_nan_unknown_attr_id; +static expert_field ei_nan_unknown_op_class; +static expert_field ei_nan_unknown_beacon_type; +static expert_field ei_nan_invalid_channel_num_for_op_class; +static expert_field ei_nan_invalid_channel_count; + +static int ett_nan; +static int ett_attributes; +static int ett_map_control; +static int ett_type_status; +static int ett_time_bitmap_ctrl; +static int ett_non_nan_op_channel; +static int ett_non_nan_beacon; +static int ett_cluster_anchor_master_info; +static int ett_sda_service_ctr; +static int ett_sda_srf_ctr; +static int ett_sdea_ctr; +static int ett_sdea_range_limit; +static int ett_sdea_service_info; +static int ett_connection_cap_field; +static int ett_further_av_map_entry_ctrl; +static int ett_device_cap_map_id; +static int ett_device_cap_committed_dw; +static int ett_device_cap_supported_bands; +static int ett_device_cap_op_mode; +static int ett_device_cap_antennas; +static int ett_device_cap_capabilities; +static int ett_ndp_control; +static int ett_ndpe_tlv; +static int ett_availability_ctr; +static int ett_availability_entry; +static int ett_availability_entry_ctr; +static int ett_availability_entry_entries; +static int ett_availability_entry_entries_channel; +static int ett_ndc_ctr; +static int ett_ndc_entries; +static int ett_device_ndc_map_id; +static int ett_ndl_control; +static int ett_ndl_schedule_entries; +static int ett_unaligned_sch_ctrl; +static int ett_unaligned_sch_ulw_overwrite; +static int ett_unaligned_sch_ulw_ctrl; +static int ett_ranging_setup_ftm_params; +static int ett_ranging_setup_ctrl; +static int ett_ranging_setup_schedule_entries; +static int ett_ranging_info_location_info_availability; +static int ett_p2p_device_role; +static int ett_cipher_suite_info_list; +static int ett_security_context_identifiers; +static int ett_public_availability_sch_entries; +static int ett_ie_tree; +static int ett_availability_op_class; +static int ett_device_capability_extension; +static int ett_nan_pairing_bootstrapping_type_status; +static int ett_nan_pairing_bootstrapping_method; +static int ett_nan_cipher_suite_capabilities; + +static int hf_nan_attribute_type; +static int hf_nan_attribute_len; +static int hf_nan_action_subtype; +static int hf_nan_instance_id; +static int hf_nan_service_id; +static int hf_nan_map_id; +static int hf_nan_oui; +static int hf_nan_type_status; +static int hf_nan_reason_code; +static int hf_nan_status_1; +static int hf_nan_status_2; +static int hf_nan_bss_id; +static int hf_nan_availability_intervals_bitmap; +static int hf_nan_mac_address; +static int hf_nan_publish_id; +static int hf_nan_dialog_tokens; +static int hf_nan_time_bitmap; +static int hf_nan_time_bitmap_len; +static int hf_nan_time_bitmap_ctrl; +static int hf_nan_time_bitmap_ctrl_bit_duration; +static int hf_nan_time_bitmap_ctrl_period; +static int hf_nan_time_bitmap_ctrl_start_offset; +static int hf_nan_map_ctrl_map_id; +static int hf_nan_map_ctrl_availability_interval_duration; +static int hf_nan_map_ctrl_repeat; +static int hf_nan_map_ctrl_field; +static int hf_nan_non_op_channel_global_op_class; +static int hf_nan_non_op_channel_channel; +static int hf_nan_non_op_channel_center_freq; +static int hf_nan_non_beacon_tbtt_offset; +static int hf_nan_non_beacon_interval; +static int hf_nan_attr_master_preference; +static int hf_nan_attr_master_random_factor; +static int hf_nan_attr_cluster_anchor_master_rank; +static int hf_nan_attr_cluster_hop_count; +static int hf_nan_attr_cluster_beacon_transmission_time; +static int hf_nan_attr_sda_requestor_instance_id; +static int hf_nan_attr_sda_sc; +static int hf_nan_attr_sda_sc_type; +static int hf_nan_attr_sda_sc_matching_filter; +static int hf_nan_attr_sda_sc_service_response; +static int hf_nan_attr_sda_sc_service_info; +static int hf_nan_attr_sda_sc_discovery_range; +static int hf_nan_attr_sda_sc_binding_bitmap; +static int hf_nan_attr_sda_binding_bitmap; +static int hf_nan_attr_sda_matching_filter_len; +static int hf_nan_attr_sda_matching_filter_val; +static int hf_nan_attr_sda_service_response_filter_len; +static int hf_nan_attr_sda_srf_ctr; +static int hf_nan_attr_sda_srf_ctr_type; +static int hf_nan_attr_sda_srf_ctr_include; +static int hf_nan_attr_sda_srf_ctr_bloom_filter_index; +static int hf_nan_attr_sda_srf_address_set; +static int hf_nan_attr_sda_service_info_len; +static int hf_nan_attr_sda_service_info; +static int hf_nan_attr_sdea_ctr; +static int hf_nan_attr_sdea_ctr_fsd; +static int hf_nan_attr_sdea_ctr_fsd_w_gas; +static int hf_nan_attr_sdea_ctr_data_path; +static int hf_nan_attr_sdea_ctr_data_path_type; +static int hf_nan_attr_sdea_ctr_reserved_multicast_type; +static int hf_nan_attr_sdea_ctr_qos; +static int hf_nan_attr_sdea_ctr_security; +static int hf_nan_attr_sdea_ctr_ranging; +static int hf_nan_attr_sdea_ctr_range_limit; +static int hf_nan_attr_sdea_ctr_service_update_indicator; +static int hf_nan_attr_sdea_ingress_range_limit; +static int hf_nan_attr_sdea_egress_range_limit; +static int hf_nan_attr_sdea_service_update_indicator; +static int hf_nan_attr_sdea_service_info_length; +static int hf_nan_attr_sdea_service_info_protocol_type; +static int hf_nan_attr_sdea_service_info_specific; +static int hf_nan_attr_connection_cap_bitmap; +static int hf_nan_attr_connection_cap_wifi_direct; +static int hf_nan_attr_connection_cap_p2ps; +static int hf_nan_attr_connection_cap_tdls; +static int hf_nan_attr_connection_cap_wlan_infra; +static int hf_nan_attr_connection_cap_ibss; +static int hf_nan_attr_connection_cap_mesh; +static int hf_nan_attr_wlan_infra_device_role; +static int hf_nan_attr_p2p_device_role_device; +static int hf_nan_attr_p2p_device_role_group_owner; +static int hf_nan_attr_p2p_device_role_client; +static int hf_nan_attr_p2p_device_role; +static int hf_nan_attr_mesh_id; +static int hf_nan_attr_further_av_map_entry_av_interval_duration; +static int hf_nan_attr_further_av_map_op_class; +static int hf_nan_attr_further_av_map_channel_num; +static int hf_nan_attr_further_av_map_entry_ctrl; +static int hf_nan_attr_further_av_map_id; +static int hf_nan_attr_country_code; +static int hf_nan_attr_ranging_protocol; +static int hf_nan_attr_cluster_disc_id; +static int hf_nan_attr_cluster_disc_time_offset; +static int hf_nan_attr_cluster_disc_anchor_master_rank; +static int hf_nan_attr_device_cap_map_id_apply_to; +static int hf_nan_attr_device_cap_map_id_associated_maps; +static int hf_nan_attr_device_cap_committed_dw; +static int hf_nan_attr_device_cap_committed_dw_24ghz; +static int hf_nan_attr_device_cap_committed_dw_5ghz; +static int hf_nan_attr_device_cap_committed_dw_24ghz_overwrite; +static int hf_nan_attr_device_cap_committed_dw_5ghz_overwrite; +static int hf_nan_attr_device_cap_supported_bands; +static int hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces; +static int hf_nan_attr_device_cap_supported_bands_sub_1ghz; +static int hf_nan_attr_device_cap_supported_bands_24ghz; +static int hf_nan_attr_device_cap_supported_bands_reserved_36ghz; +static int hf_nan_attr_device_cap_supported_bands_5ghz; +static int hf_nan_attr_device_cap_supported_bands_reserved_60ghz; +static int hf_nan_attr_device_cap_supported_bands_reserved_45ghz; +static int hf_nan_attr_device_cap_supported_bands_6ghz; +static int hf_nan_attr_device_cap_op_mode; +static int hf_nan_attr_device_cap_op_mode_phy_vht; +static int hf_nan_attr_device_cap_op_mode_phy_he; +static int hf_nan_attr_device_cap_op_mode_phy_he_vht8080; +static int hf_nan_attr_device_cap_op_mode_phy_he_vht160; +static int hf_nan_attr_device_cap_op_mode_reserved_paging_ndl; +static int hf_nan_attr_device_cap_antennas; +static int hf_nan_attr_device_cap_antennas_tx; +static int hf_nan_attr_device_cap_antennas_rx; +static int hf_nan_attr_device_cap_max_channel_switch_time; +static int hf_nan_attr_device_cap_capabilities; +static int hf_nan_attr_device_cap_capabilities_dfs_master; +static int hf_nan_attr_device_cap_capabilities_extended_key_id; +static int hf_nan_attr_device_cap_capabilities_simul_ndp_reception; +static int hf_nan_attr_device_cap_capabilities_ndpe_attr_support; +static int hf_nan_attr_device_cap_capabilities_s3_capable; +static int hf_nan_attr_ndp_type; +static int hf_nan_attr_ndp_initiator; +static int hf_nan_attr_ndp_id; +static int hf_nan_attr_ndp_ctrl_confirm; +static int hf_nan_attr_ndp_ctrl_security_pres; +static int hf_nan_attr_ndp_ctrl_publish_id_pres; +static int hf_nan_attr_ndp_ctrl_responder_ndi_pres; +static int hf_nan_attr_ndp_ctrl_sepcific_info_pres; +static int hf_nan_attr_ndpe_ctrl_confirm; +static int hf_nan_attr_ndpe_ctrl_security_pres; +static int hf_nan_attr_ndpe_ctrl_publish_id_pres; +static int hf_nan_attr_ndpe_ctrl_responder_ndi_pres; +static int hf_nan_attr_ndpe_ctrl_gtk_requried; +static int hf_nan_attr_ndp_control; +static int hf_nan_attr_ndpe_control; +static int hf_nan_attr_ndp_responder_ndi; +static int hf_nan_attr_ndp_specific_info; +static int hf_nan_attr_ndpe_tlv_type; +static int hf_nan_attr_ndpe_tlv_len; +static int hf_nan_attr_ndpe_tlv_ipv6_interface_identifier; +static int hf_nan_attr_availability_sequence_id; +static int hf_nan_attr_availability_ctr; +static int hf_nan_attr_availability_map_id; +static int hf_nan_attr_availability_committed_changed; +static int hf_nan_attr_availability_potential_changed; +static int hf_nan_attr_availability_public_availability_changed; +static int hf_nan_attr_availability_ndc_changed; +static int hf_nan_attr_availability_reserved_multicast_schedule_changed; +static int hf_nan_attr_availability_reserved_multicast_schedule_change_changed; +static int hf_nan_attr_availability_entry_len; +static int hf_nan_attr_availability_entry_ctr; +static int hf_nan_attr_availability_entry_ctr_type; +static int hf_nan_attr_availability_entry_ctr_pref; +static int hf_nan_attr_availability_entry_ctr_utilization; +static int hf_nan_attr_availability_entry_ctr_rx_nss; +static int hf_nan_attr_availability_entry_ctr_time_bitmap; +static int hf_nan_attr_availability_entry_entries_type; +static int hf_nan_attr_availability_entry_entries_non_contiguous_bw; +static int hf_nan_attr_availability_entry_entries_num_entries; +static int hf_nan_attr_availability_entry_entries_band; +static int hf_nan_attr_availability_entry_entries_channel_op_class; +static int hf_nan_attr_availability_entry_entries_channel_bitmap; +static int hf_nan_attr_availability_entry_entries_primary_channel_bitmap; +static int hf_nan_attr_availability_entry_entries_aux_channel_bitmap; +static int hf_nan_attr_availability_entry_entries_channel_set; +static int hf_nan_attr_availability_entry_entries_start_channel_number; +static int hf_nan_attr_availability_entry_entries_number_of_ch_included; +static int hf_nan_attr_availability_entry_entries_start_freq; +static int hf_nan_attr_availability_entry_entries_bandwidth; +static int hf_nan_attr_ndc_id; +static int hf_nan_attr_ndc_ctrl; +static int hf_nan_attr_ndc_ctrl_selected; +static int hf_nan_attr_ndc_map_id_related_sch; +static int hf_nan_attr_ndl_type; +static int hf_nan_attr_ndl_control; +static int hf_nan_attr_ndl_ctrl_peer_id; +static int hf_nan_attr_ndl_ctrl_immutable_schedule_pres; +static int hf_nan_attr_ndl_ctrl_ndc_pres; +static int hf_nan_attr_ndl_ctrl_qos; +static int hf_nan_attr_ndl_ctrl_type; +static int hf_nan_attr_ndl_ctrl_setup_reason; +static int hf_nan_attr_ndl_ctrl_max_idle_pres; +static int hf_nan_attr_ndl_reserved_peer_id; +static int hf_nan_attr_ndl_max_idle; +static int hf_nan_attr_ndlqos_min_time_slots; +static int hf_nan_attr_ndlqos_max_latency; +static int hf_nan_attr_unaligned_sch_ctrl; +static int hf_nan_attr_unaligned_sch_ctrl_schedule_id; +static int hf_nan_attr_unaligned_sch_ctrl_seq_id; +static int hf_nan_attr_unaligned_sch_starting_time; +static int hf_nan_attr_unaligned_sch_duration; +static int hf_nan_attr_unaligned_sch_period; +static int hf_nan_attr_unaligned_sch_count_down; +static int hf_nan_attr_unaligned_sch_ulw_overwrite; +static int hf_nan_attr_unaligned_sch_ulw_overwrite_all; +static int hf_nan_attr_unaligned_sch_ulw_overwrite_map_id; +static int hf_nan_attr_unaligned_sch_ulw_ctrl; +static int hf_nan_attr_unaligned_sch_ulw_ctrl_type; +static int hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av; +static int hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss; +static int hf_nan_attr_ranging_info_location_info_avail; +static int hf_nan_attr_ranging_info_location_info_avail_lci; +static int hf_nan_attr_ranging_info_location_info_avail_geospatial; +static int hf_nan_attr_ranging_info_location_info_avail_civic_location; +static int hf_nan_attr_ranging_info_location_info_avail_last_movement_pres; +static int hf_nan_attr_ranging_info_last_movement_indication; +static int hf_nan_attr_ranging_setup_type; +static int hf_nan_attr_ranging_setup_ctrl; +static int hf_nan_attr_ranging_setup_ctrl_report_req; +static int hf_nan_attr_ranging_setup_ctrl_ftm_params; +static int hf_nan_attr_ranging_setup_ctrl_entry_list; +static int hf_nan_attr_ranging_setup_ftm_params; +static int hf_nan_attr_ranging_setup_ftm_max_per_burst; +static int hf_nan_attr_ranging_setup_ftm_min_delta; +static int hf_nan_attr_ranging_setup_ftm_max_burst_duration; +static int hf_nan_attr_ranging_setup_ftm_format_bw; +static int hf_nan_attr_ftm_range_report; +static int hf_nan_attr_cipher_suite_capabilities; +static int hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters; +static int hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support; +static int hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters; +static int hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher; +static int hf_nan_attr_cipher_suite_id; +static int hf_nan_attr_security_context_identifier; +static int hf_nan_attr_security_context_identifier_len; +static int hf_nan_attr_security_context_identifier_type; +static int hf_nan_attr_shared_key_rsna_descriptor; +static int hf_nan_attr_vendor_specific_body; +static int hf_nan_attr_container_element_id; +static int hf_nan_attr_container_element_len; +/* Device Capability Extension attribute, Capability Info field */ +static int hf_nan_attr_device_capability_extension; +static int hf_nan_attr_device_capability_extension_6g_regulatory_info_presented; +static int hf_nan_attr_device_capability_extension_6g_regulatory_info; +static int hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved; +static int hf_nan_attr_device_capability_extension_paring_setup_enabled; +static int hf_nan_attr_device_capability_extension_npk_nik_cache_enabled; +/* NAN Identity Resolution attribute */ +static int hf_nan_attr_identity_cipher_version; +static int hf_nan_attr_identity_resolution_nonce; +static int hf_nan_attr_identity_resolution_tag; + +/* NAN Pairing Bootstrapping attribute */ +static int hf_nan_attr_pairing_bootstrapping_dialog_token; +static int hf_nan_attr_pairing_bootstrapping_type_status; +static int hf_nan_attr_pairing_bootstrapping_type; +static int hf_nan_attr_pairing_bootstrapping_status; +static int hf_nan_attr_pairing_bootstrapping_resaon_code; +static int hf_nan_attr_pairing_bootstrapping_comeback_after; +static int hf_nan_attr_pairing_bootstrapping_comeback_cookie_len; +static int hf_nan_attr_pairing_bootstrapping_comeback_cookie; +static int hf_nan_attr_pairing_bootstrapping_methods; +static int hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping; +static int hf_nan_attr_pairing_bootstrapping_method_pin_code_display; +static int hf_nan_attr_pairing_bootstrapping_method_passphrase_display; +static int hf_nan_attr_pairing_bootstrapping_method_qr_code_display; +static int hf_nan_attr_pairing_bootstrapping_method_nfc_tag; +static int hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only; +static int hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase; +static int hf_nan_attr_pairing_bootstrapping_method_qr_code_scan; +static int hf_nan_attr_pairing_bootstrapping_method_nfc_reader; +static int hf_nan_attr_pairing_bootstrapping_method_reserved; +static int hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping; +static int hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped; + +static int hf_nan_attr_reserved; enum { NAN_ATTR_MASTER_INDICATION = 0x00, @@ -379,6 +440,9 @@ enum { NAN_ATTR_PUBLIC_AVAILABILITY = 0x27, NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST = 0x28, NAN_ATTR_NDP_EXTENSION = 0x29, + NAN_ATTR_DEVICE_CAPABILITY_EXTENSION = 0x2a, + NAN_ATTR_IDENTITY_RESOLUTION = 0x2b, + NAN_ATTR_PAIRING_BOOTSTRAPPING = 0x2c, NAN_ATTR_VENDOR_SPECIFIC = 0xDD }; @@ -425,6 +489,9 @@ static const value_string attribute_types[] = { { NAN_ATTR_PUBLIC_AVAILABILITY, "Public Availability Attribute" }, { NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST, "Subscribe Service ID List Attribute" }, { NAN_ATTR_NDP_EXTENSION, "NDP Extension Attribute" }, + { NAN_ATTR_DEVICE_CAPABILITY_EXTENSION, "Device Capability Extension"}, + { NAN_ATTR_IDENTITY_RESOLUTION, "NAN Identity Resolution"}, + { NAN_ATTR_PAIRING_BOOTSTRAPPING, "NAN Pairing Bootstrapping"}, { NAN_ATTR_VENDOR_SPECIFIC, "Vendor Specific Attribute" }, { 0, NULL } }; @@ -469,9 +536,14 @@ static const true_false_string device_cap_map_id_apply_to_flags = { "All maps" }; -static const true_false_string device_cap_op_mode_phy_flags = { +static const true_false_string device_cap_op_mode_phy_flags_vht = { "VHT", - "HT only" + "HT" +}; + +static const true_false_string device_cap_op_mode_phy_flags_he = { + "HE", + "HE Not Supported" }; static const true_false_string availability_entry_entries_type_flags = { @@ -547,7 +619,9 @@ static const range_string availability_entry_entries_band_type[] = { { 3, 3, "Reserved (for 3.6 GHz)" }, { 4, 4, "4.9 and 5 GHz" }, { 5, 5, "Reserved (for 60 GHz)" }, - { 6, 255, "Reserved" }, + { 6, 6, "Reserved (for 45 GHz)" }, + { 7, 7, "6 Ghz" }, + { 8, 255, "Reserved" }, { 0, 0, NULL } }; @@ -618,21 +692,21 @@ static const range_string reason_code_values[] = { }; static const range_string action_frame_type_values[] = { - { 0, 0, "Reserved " }, - { 1, 1, "Ranging Request " }, - { 2, 2, "Ranging Response " }, - { 3, 3, "Ranging Termination " }, - { 4, 4, "Ranging Report " }, - { 5, 5, "Data Path Request " }, - { 6, 6, "Data Path Response " }, - { 7, 7, "Data Path Confirm " }, - { 8, 8, "Data Path Key Installment " }, - { 9, 9, "Data Path Termination " }, - { 10, 10, "Schedule Request " }, - { 11, 11, "Schedule Response " }, - { 12, 12, "Schedule Confirm " }, - { 13, 13, "Schedule Update Notification " }, - { 14, 255, "Reserved " }, + { 0, 0, "Reserved" }, + { 1, 1, "Ranging Request" }, + { 2, 2, "Ranging Response" }, + { 3, 3, "Ranging Termination" }, + { 4, 4, "Ranging Report" }, + { 5, 5, "Data Path Request" }, + { 6, 6, "Data Path Response" }, + { 7, 7, "Data Path Confirm" }, + { 8, 8, "Data Path Key Installment" }, + { 9, 9, "Data Path Termination" }, + { 10, 10, "Schedule Request" }, + { 11, 11, "Schedule Response" }, + { 12, 12, "Schedule Confirm" }, + { 13, 13, "Schedule Update Notification" }, + { 14, 255, "Reserved" }, { 0, 0, NULL } }; @@ -660,7 +734,7 @@ static const value_string unaligned_sch_ulw_type[] = { static const range_string security_context_iden_type[] = { { 0, 0, "Reserved" }, - { 1, 1, "PMKID" }, + { 1, 1, "ND-PMKID" }, { 2, 255, "Reserved" }, { 0, 0, NULL } }; @@ -678,16 +752,73 @@ static const range_string furth_av_map_id[] = { {0, 0, NULL} }; +static const value_string device_capability_extension_6g_regulatoty_info[] = { + { 0, "Indoor AP" }, + { 1, "Standard Power AP" }, + { 2, "Very Low Power AP" }, + { 3, "Indoor Enabled AP" }, + { 4, "Indoor Standard Power AP" }, + { 0, NULL } +}; + +static const range_string nan_identity_resolution_cipher_version[] = { + {0, 0, "128-bit NIK, 64-bit Nonce, 64-bit Tag, HMAC-SHA-256"}, + {1, 255, "Reserved"}, + {0, 0, NULL } +}; + +static const value_string nan_pairing_bootstrapping_pairing_bootstrapping_type[] = { + { 0, "Advertise" }, + { 1, "Request" }, + { 2, "Response" }, + { 0, NULL } /* Reserved for other value */ +}; + +static const value_string nan_pairing_bootstrapping_pairing_bootstrapping_status[] = { + { 0, "Accepted" }, + { 1, "Rejected" }, + { 2, "Comeback" }, + { 0, NULL } /* Reserved for other value */ +}; + +static const value_string cipher_suite_capabilities_nd_nm_tksa_replay_counters[] = { + { 0, "4 ND-TKSA and NM-TKSA (if applicable) replay counters" }, + { 1, "16 ND-TKSA and NM-TKSA (if applicable) replay counters" }, + { 0, NULL } +}; + +static const value_string cipher_suite_capabilities_group_and_integrity_sa_support[] = { + { 0, "GTKSA, IGTKSA, BIGTKSA are not supported" }, + { 1, "GTKSA and IGTKSA are supported, and BIGTKSA is not supported" }, + { 2, "GTKSA, IGTKSA, and BIGTKSA are supported" }, + { 3, "Reserved" }, + { 0, NULL } +}; + +static const value_string cipher_suite_capabilities_gtksa_replay_counters[] = { + { 0, "4 GTKSA replay counters" }, + { 1, "16 GTKSA replay counters" }, + { 0, NULL } +}; + +static const value_string cipher_suite_capabilities_integrity_sa_ciphers[] = { + { 0, "NCS-BIP-128 (BIP-CMAC-128)" }, + { 1, "NCS-BIP_256 (BIP-GMAC-256)" }, + { 0, NULL } +}; + +#define PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN (64) + typedef struct _range_channel_set { - guint32 value_min; - guint32 value_max; - const gint channel_set[16]; + uint32_t value_min; + uint32_t value_max; + const int channel_set[PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN]; } range_channel_set; -static const gint * -rval_to_channel_set(const guint32 val, const range_channel_set* ra) +static const int * +rval_to_channel_set(const uint32_t val, const range_channel_set* ra) { - gint i = 0; + int i = 0; if (ra) { while (*ra[i].channel_set) /* no such thing as channel 0 - end of list */ @@ -702,6 +833,19 @@ rval_to_channel_set(const guint32 val, const range_channel_set* ra) return NULL; } +static unsigned int channel_number_valid(const uint8_t channel_number, const int *const channel_set) +{ + for (unsigned int i = 0; i < PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN; i++) + { + if (channel_set[i] == channel_number) + { + return i; + } + } + + return PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN; +} + // TODO: this table corresponds to the 802.11 global operating classes. // it's probably in the 802.11 dissector somewhere and ideally this // should be used instead... @@ -749,7 +893,14 @@ static const range_channel_set op_class_channel[] = { {128, 128, {42, 58, 106, 122, 138, 155}}, {129, 129, {50, 114}}, {130, 130, {42, 58, 106, 122, 138, 155}}, - {131, 179, {-1}}, + {131, 131, {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233}}, + {132, 132, {3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, 179, 187, 195, 203, 211, 219, 227}}, + {133, 133, {7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215}}, + {134, 134, {15, 47, 79, 111, 143, 175, 207}}, + {135, 135, {7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215}}, + {137, 137, {31, 63, 95, 127, 159, 191}}, + {138, 179, {-1}}, + {137, 179, {-1}}, {180, 180, {1, 2, 3, 4, 5, 6}}, {181, 191, {-1}}, {192, 254, {-2}}, @@ -793,7 +944,14 @@ static const range_string op_channel_spacing[] = { {128, 128, "80"}, {129, 129, "160"}, {130, 130, "80"}, - {131, 179, "Reserved"}, + {131, 131, "20"}, + {132, 132, "40"}, + {133, 133, "80"}, + {134, 134, "160"}, + {135, 135, "80"}, + {136, 136, "20"}, + {137, 137, "320"}, + {138, 179, "Reserved"}, {180, 180, "2160"}, {181, 191, "Reserved"}, {255, 255, "Reserved"}, @@ -821,7 +979,10 @@ static const range_string op_starting_freq[] = { {112, 113, "5"}, {114, 114, "5.0025"}, {115, 130, "5"}, - {131, 179, "Reserved"}, + {131, 135, "5.950"}, + {136, 136, "5.925"}, + {137, 137, "5.950"}, + {138, 179, "Reserved"}, {180, 180, "56.16"}, {181, 191, "Reserved"}, {255, 255, "Reserved"}, @@ -829,7 +990,7 @@ static const range_string op_starting_freq[] = { }; static void -dissect_attr_master_indication(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_master_indication(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_MASTER_IND_LENGTH) { @@ -844,7 +1005,7 @@ dissect_attr_master_indication(proto_tree* attr_tree, tvbuff_t* tvb, gint offset } static void -dissect_attr_cluster(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_cluster(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_CLUSTER_LENGTH) { @@ -863,7 +1024,7 @@ dissect_attr_cluster(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 } static void -dissect_attr_service_id_list(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_service_id_list(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len % 6 != 0 || attr_len == 0) { @@ -881,7 +1042,7 @@ dissect_attr_service_id_list(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, } static void -dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_SDA_MIN_LENGTH) { @@ -910,15 +1071,15 @@ dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr proto_tree_add_bitmask(attr_tree, tvb, offset, hf_nan_attr_sda_sc, ett_sda_service_ctr, service_ctr_fields, ENC_LITTLE_ENDIAN); - guint8 service_ctr_byte = tvb_get_guint8(tvb, offset); + uint8_t service_ctr_byte = tvb_get_uint8(tvb, offset); offset += 1; - const guint8 BITMASK_TYPE_SUBSCRIBE = 0x01; - const guint8 BITMASK_TYPE_FOLLOW_UP = 0x02; - const guint8 BITMASK_MATCHING_FILTER_PRESENT = 0x04; - const guint8 BITMASK_SERVICE_RESPONSE_FILTER_PRESENT = 0x08; - const guint8 BITMASK_SERVICE_INFO_PRESENT = 0x10; - const guint8 BITMASK_BITMAP_PRESENT = 0x40; + const uint8_t BITMASK_TYPE_SUBSCRIBE = 0x01; + const uint8_t BITMASK_TYPE_FOLLOW_UP = 0x02; + const uint8_t BITMASK_MATCHING_FILTER_PRESENT = 0x04; + const uint8_t BITMASK_SERVICE_RESPONSE_FILTER_PRESENT = 0x08; + const uint8_t BITMASK_SERVICE_INFO_PRESENT = 0x10; + const uint8_t BITMASK_BITMAP_PRESENT = 0x40; if (service_ctr_byte & BITMASK_TYPE_SUBSCRIBE) { @@ -944,12 +1105,12 @@ dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr { proto_tree_add_item(attr_tree, hf_nan_attr_sda_matching_filter_len, tvb, offset, 1, ENC_LITTLE_ENDIAN); - gint mf_len = tvb_get_guint8(tvb, offset); - gint dissected_mf_len = 0; + int mf_len = tvb_get_uint8(tvb, offset); + int dissected_mf_len = 0; offset += 1; while (dissected_mf_len < mf_len) { - gint filter_len = tvb_get_guint8(tvb, offset); + int filter_len = tvb_get_uint8(tvb, offset); proto_tree_add_item(attr_tree, hf_nan_attr_sda_matching_filter_val, tvb, offset + 1, filter_len, ENC_NA); offset += filter_len + 1; @@ -961,7 +1122,7 @@ dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr { proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_response_filter_len, tvb, offset, 1, ENC_LITTLE_ENDIAN); - gint srf_len = tvb_get_guint8(tvb, offset); + int srf_len = tvb_get_uint8(tvb, offset); static int* const srf_ctr_fields[] = { &hf_nan_attr_sda_srf_ctr_type, @@ -979,7 +1140,7 @@ dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr if (service_ctr_byte & BITMASK_SERVICE_INFO_PRESENT) { - guint32 service_info_len; + uint32_t service_info_len; /* XXX - use FT_UINT_BYTES? */ proto_tree_add_item_ret_uint(attr_tree, hf_nan_attr_sda_service_info_len, tvb, @@ -991,7 +1152,7 @@ dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr } static void -dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_SDEA_MIN_LENGTH) { @@ -1002,7 +1163,7 @@ dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att proto_tree_add_item(attr_tree, hf_nan_instance_id, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN); offset += 4; - guint16 dissected_len = 1; + uint16_t dissected_len = 1; static int* const sdea_ctr_fields[] = { &hf_nan_attr_sdea_ctr_fsd, @@ -1021,7 +1182,7 @@ dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att proto_tree_add_bitmask(attr_tree, tvb, offset, hf_nan_attr_sdea_ctr, ett_sdea_ctr, sdea_ctr_fields, ENC_LITTLE_ENDIAN); - guint16 sdea_ctr_byte = tvb_get_letohs(tvb, offset); + uint16_t sdea_ctr_byte = tvb_get_letohs(tvb, offset); offset += 2; dissected_len += 2; @@ -1062,7 +1223,7 @@ dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att } static void -dissect_attr_connection_capability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_connection_capability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_CONNECTION_CAP_LENGTH) { @@ -1085,7 +1246,7 @@ dissect_attr_connection_capability(proto_tree* attr_tree, tvbuff_t* tvb, gint of } static void -dissect_attr_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_WLAN_INFRA_MIN_LENGTH) { @@ -1093,7 +1254,7 @@ dissect_attr_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN); sub_offset += 6; proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); @@ -1101,14 +1262,14 @@ dissect_attr_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field, ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN); sub_offset++; - gint bitmap_length = attr_len - 14; + int bitmap_length = attr_len - 14; proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA); sub_offset += bitmap_length; proto_tree_add_item(attr_tree, hf_nan_attr_wlan_infra_device_role, tvb, sub_offset, 1, ENC_BIG_ENDIAN); } static void -dissect_attr_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_P2P_OP_MIN_LENGTH) { @@ -1116,7 +1277,7 @@ dissect_attr_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; static int* const p2p_bitmap_fields[] = { &hf_nan_attr_p2p_device_role_device, &hf_nan_attr_p2p_device_role_group_owner, @@ -1136,7 +1297,7 @@ dissect_attr_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu } static void -dissect_attr_ibss(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ibss(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_IBSS_MIN_LENGTH) { @@ -1144,7 +1305,7 @@ dissect_attr_ibss(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN); sub_offset += 6; proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); @@ -1156,7 +1317,7 @@ dissect_attr_ibss(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att } static void -dissect_attr_mesh(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_mesh(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_MESH_MIN_LENGTH) { @@ -1164,12 +1325,12 @@ dissect_attr_mesh(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); sub_offset += 6; - guint8 duration = tvb_get_bits8(tvb, sub_offset * 8 + 5, 2); - guint bitmap_length; + uint8_t duration = tvb_get_bits8(tvb, sub_offset * 8 + 5, 2); + unsigned bitmap_length; switch (duration) { case 0: bitmap_length = 4; @@ -1193,20 +1354,20 @@ dissect_attr_mesh(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att } static void -dissect_attr_further_service_discovery(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len) +dissect_attr_further_service_discovery(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field, ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN); sub_offset++; - gint bitmap_length = attr_len - 1; + int bitmap_length = attr_len - 1; proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA); } static void -dissect_attr_further_availability_map(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) +dissect_attr_further_availability_map(proto_tree* attr_tree, tvbuff_t* tvb, int offset) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; @@ -1226,14 +1387,14 @@ dissect_attr_further_availability_map(proto_tree* attr_tree, tvbuff_t* tvb, gint } static void -dissect_attr_country_code(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) +dissect_attr_country_code(proto_tree* attr_tree, tvbuff_t* tvb, int offset) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_attr_country_code, tvb, sub_offset, 2, ENC_ASCII); } static void -dissect_attr_ranging(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ranging(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_RANGING_MIN_LENGTH) { @@ -1241,7 +1402,7 @@ dissect_attr_ranging(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); sub_offset += 6; proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field, @@ -1253,7 +1414,7 @@ dissect_attr_ranging(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 } static void -dissect_attr_cluter_discovery(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_cluter_discovery(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_CLUSTER_DISC_LENGTH) { @@ -1261,7 +1422,7 @@ dissect_attr_cluter_discovery(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN); sub_offset += 6; proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_time_offset, tvb, sub_offset, 8, ENC_LITTLE_ENDIAN); @@ -1270,7 +1431,7 @@ dissect_attr_cluter_discovery(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, } static void -dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_DEVICE_CAP_LENGTH) { @@ -1297,13 +1458,16 @@ dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset &hf_nan_attr_device_cap_supported_bands_reserved_36ghz, &hf_nan_attr_device_cap_supported_bands_5ghz, &hf_nan_attr_device_cap_supported_bands_reserved_60ghz, + &hf_nan_attr_device_cap_supported_bands_reserved_45ghz, + &hf_nan_attr_device_cap_supported_bands_6ghz, NULL }; static int* const device_cap_op_mode_fields[] = { - &hf_nan_attr_device_cap_op_mode_phy, - &hf_nan_attr_device_cap_op_mode_vht8080, - &hf_nan_attr_device_cap_op_mode_vht160, + &hf_nan_attr_device_cap_op_mode_phy_vht, + &hf_nan_attr_device_cap_op_mode_phy_he_vht8080, + &hf_nan_attr_device_cap_op_mode_phy_he_vht160, &hf_nan_attr_device_cap_op_mode_reserved_paging_ndl, + &hf_nan_attr_device_cap_op_mode_phy_he, NULL }; static int* const device_cap_antennas_fields[] = { @@ -1316,6 +1480,7 @@ dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset &hf_nan_attr_device_cap_capabilities_extended_key_id, &hf_nan_attr_device_cap_capabilities_simul_ndp_reception, &hf_nan_attr_device_cap_capabilities_ndpe_attr_support, + &hf_nan_attr_device_cap_capabilities_s3_capable, NULL }; @@ -1336,7 +1501,7 @@ dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset } static void -dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_NDP_MIN_LENGTH) { @@ -1344,7 +1509,7 @@ dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; @@ -1365,9 +1530,9 @@ dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status, ett_type_status, ndp_type_status_fields, ENC_LITTLE_ENDIAN); - guint8 bits_type = tvb_get_bits8(tvb, sub_offset * 8 + 4, 4); - guint8 bit_offset = (sub_offset * 8) + 4; - guint8 bits_status = tvb_get_bits8(tvb, bit_offset, 4); + uint8_t bits_type = tvb_get_bits8(tvb, sub_offset * 8 + 4, 4); + uint8_t bit_offset = (sub_offset * 8) + 4; + uint8_t bits_status = tvb_get_bits8(tvb, bit_offset, 4); sub_offset++; proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; @@ -1378,8 +1543,8 @@ dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ndp_control, ett_ndp_control, ndp_control_fields, ENC_LITTLE_ENDIAN); - guint8 bits_ndp_info = tvb_get_bits8(tvb, (sub_offset * 8) + 2, 1); - guint8 bits_publish_id = tvb_get_bits8(tvb, (sub_offset * 8) + 4, 1); + uint8_t bits_ndp_info = tvb_get_bits8(tvb, (sub_offset * 8) + 2, 1); + uint8_t bits_publish_id = tvb_get_bits8(tvb, (sub_offset * 8) + 4, 1); sub_offset++; if (bits_publish_id == 1 && bits_type == 0) @@ -1399,7 +1564,7 @@ dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr } static void -dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_NDPE_MIN_LENGTH) { @@ -1412,34 +1577,35 @@ dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att &hf_nan_status_1, NULL }; - static int* const ndp_control_fields[] = { - &hf_nan_attr_ndp_ctrl_confirm, - &hf_nan_attr_ndp_ctrl_security_pres, - &hf_nan_attr_ndp_ctrl_publish_id_pres, - &hf_nan_attr_ndp_ctrl_responder_ndi_pres, + static int* const ndpe_control_fields[] = { + &hf_nan_attr_ndpe_ctrl_confirm, + &hf_nan_attr_ndpe_ctrl_security_pres, + &hf_nan_attr_ndpe_ctrl_publish_id_pres, + &hf_nan_attr_ndpe_ctrl_responder_ndi_pres, + &hf_nan_attr_ndpe_ctrl_gtk_requried, NULL }; - gint dissected_len = 0; + int dissected_len = 0; proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, offset + 3, 1, ENC_BIG_ENDIAN); proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_type_status, ett_type_status, ndp_type_status_fields, ENC_LITTLE_ENDIAN); offset += 4; dissected_len += 4; - guint8 bits_type = tvb_get_bits8(tvb, offset * 8 + 4, 4); - guint32 bit_offset = (offset * 8) + 4; - guint8 bits_status = tvb_get_bits8(tvb, bit_offset, 4); + uint8_t bits_type = tvb_get_bits8(tvb, offset * 8 + 4, 4); + uint32_t bit_offset = (offset * 8) + 4; + uint8_t bits_status = tvb_get_bits8(tvb, bit_offset, 4); proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, offset + 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(attr_tree, hf_nan_attr_ndp_initiator, tvb, offset + 2, 6, ENC_NA); proto_tree_add_item(attr_tree, hf_nan_attr_ndp_id, tvb, offset + 8, 1, ENC_BIG_ENDIAN); - proto_tree_add_bitmask(attr_tree, tvb, offset + 9, hf_nan_attr_ndp_control, - ett_ndp_control, ndp_control_fields, ENC_LITTLE_ENDIAN); + proto_tree_add_bitmask(attr_tree, tvb, offset + 9, hf_nan_attr_ndpe_control, + ett_ndp_control, ndpe_control_fields, ENC_LITTLE_ENDIAN); offset += 9; dissected_len += 9; - guint8 bits_publish_id = tvb_get_bits8(tvb, (offset * 8) + 4, 1); + uint8_t bits_publish_id = tvb_get_bits8(tvb, (offset * 8) + 4, 1); offset++; dissected_len++; @@ -1458,8 +1624,8 @@ dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att while (dissected_len < attr_len) { - guint8 tlv_type = tvb_get_guint8(tvb, offset); - guint16 tlv_len = tvb_get_letohs(tvb, offset + 1); + uint8_t tlv_type = tvb_get_uint8(tvb, offset); + uint16_t tlv_len = tvb_get_letohs(tvb, offset + 1); proto_tree* tlv_tree = proto_tree_add_subtree(attr_tree, tvb, offset, tlv_len + 3, ett_ndpe_tlv, NULL, "TLV entry"); proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_type, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1488,7 +1654,7 @@ dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 att } static void -dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_AVAILABILITY_MIN_LENGTH) { @@ -1521,17 +1687,17 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui ett_device_cap_capabilities, availability_ctr_fields, ENC_LITTLE_ENDIAN); offset += 6; - gint dissected_len = 3; + int dissected_len = 3; while (dissected_len < attr_len) { - guint16 entry_len = tvb_get_letohs(tvb, offset); - guint8 entry_type = tvb_get_bits8(tvb, offset * 8 + 21, 3); - guint8 hdr_len = 2; - guint32 time_bitmap_len = 0; - guint64 avail_entry; - const gchar* entry_type_msg = val_to_str(entry_type, availability_entry_type, + uint16_t entry_len = tvb_get_letohs(tvb, offset); + uint8_t entry_type = tvb_get_bits8(tvb, offset * 8 + 21, 3); + uint8_t hdr_len = 2; + uint32_t time_bitmap_len = 0; + uint64_t avail_entry; + const char* entry_type_msg = val_to_str(entry_type, availability_entry_type, "Unknown type (%u)"); - gchar* info_msg = wmem_strconcat(pinfo->pool, "Availability Type : ", entry_type_msg, NULL); + char* info_msg = wmem_strconcat(pinfo->pool, "Availability Type : ", entry_type_msg, NULL); proto_tree* entry_tree = proto_tree_add_subtree(attr_tree, tvb, offset, entry_len + 2, ett_availability_entry, NULL, info_msg); proto_tree_add_item(entry_tree, hf_nan_attr_availability_entry_len, tvb, @@ -1540,7 +1706,7 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui ett_availability_entry_ctr, availability_entry_ctr_fields, ENC_LITTLE_ENDIAN, &avail_entry); offset += 4; - gboolean time_bitmap_present = avail_entry & (1 << 12); + bool time_bitmap_present = avail_entry & (1 << 12); if (time_bitmap_present) { proto_tree_add_bitmask(entry_tree, tvb, offset, @@ -1554,11 +1720,11 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui offset += 3 + time_bitmap_len; } - gint entries_len = entry_len - hdr_len - time_bitmap_len; + int entries_len = entry_len - hdr_len - time_bitmap_len; proto_tree* entries_tree = proto_tree_add_subtree(entry_tree, tvb, offset, entries_len, ett_availability_entry_entries, NULL, "Band/Channel Entries"); - guint64 entries_type, non_contiguous_bw, num_entries; + uint64_t entries_type, non_contiguous_bw, num_entries; proto_tree_add_bits_ret_val(entries_tree, hf_nan_attr_availability_entry_entries_type, tvb, offset * 8, 1, &entries_type, ENC_LITTLE_ENDIAN); proto_tree_add_bits_ret_val(entries_tree, @@ -1568,7 +1734,7 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui tvb, offset * 8 + 4, 4, &num_entries, ENC_LITTLE_ENDIAN); offset += 1; - for (guint8 i = 0; i < num_entries; i++) + for (uint8_t i = 0; i < num_entries; i++) { switch (entries_type) { case 0: @@ -1583,44 +1749,90 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui int channel_entry_len = (non_contiguous_bw == 0) ? 4 : 6; proto_tree* channel_tree = proto_tree_add_subtree(entries_tree, tvb, offset, channel_entry_len, ett_availability_entry_entries_channel, NULL, "Channel Entry"); - guint8 op_class = tvb_get_guint8(tvb, offset); - guint16 bitmap = tvb_get_guint16(tvb, offset + 1, ENC_LITTLE_ENDIAN); + uint8_t op_class = tvb_get_uint8(tvb, offset); + uint16_t bitmap = tvb_get_uint16(tvb, offset + 1, ENC_LITTLE_ENDIAN); proto_tree* op_class_tree = proto_tree_add_subtree(channel_tree, tvb, offset, 1, ett_availability_op_class, NULL, "Operating Class"); proto_tree_add_item(op_class_tree, hf_nan_attr_availability_entry_entries_start_freq, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(op_class_tree, hf_nan_attr_availability_entry_entries_bandwidth, tvb, offset, 1, ENC_LITTLE_ENDIAN); wmem_strbuf_t* str; str = wmem_strbuf_new(pinfo->pool, ""); - for(unsigned i_bitmap = 0; i_bitmap < 16; ++i_bitmap) + if (op_class < 131) + { + for(unsigned i_bitmap = 0; i_bitmap < 16; ++i_bitmap) + { + if (bitmap & (1u << i_bitmap)) + { + + const int *channel_set = rval_to_channel_set(op_class, op_class_channel); + if (channel_set == NULL) + { + expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class); + break; + } + int channel = channel_set[i_bitmap]; + + switch (channel) + { + // TODO: replace these magic numbers (or use 802.11 dissector for this) + case -3: + wmem_strbuf_append_printf(str, "%s", "Derived from regulation "); + break; + case -2: + wmem_strbuf_append_printf(str, "%s", "Vendor Specific "); + break; + case -1: + wmem_strbuf_append_printf(str, "%s", "Reserved "); + break; + default: + wmem_strbuf_append_printf(str, "%d ", channel); + } + } + } + + proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str)); + } + else { - if (bitmap & (1u << i_bitmap)) + /* This is the new and standard rules for mapping channels for 6G channels introduced in NAN R4. + * Some vendors may have already implemetned a different approach to support NAN 6G before + * the introduction of standard 6G NAN operation. And hence, in this case, the availability + * may not be correct. */ + uint8_t start_ch_number = bitmap & 0xff; + uint8_t number_of_chs = (bitmap & 0xff00) >> 8; + + const int *channel_set_higher_op_class = rval_to_channel_set(op_class, op_class_channel); + if (channel_set_higher_op_class) { + unsigned int start_ch_number_idx = channel_number_valid(start_ch_number, channel_set_higher_op_class); + if (start_ch_number_idx == PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN) + { + /* The given channel number does not belong to this operating class */ + expert_add_info(pinfo, channel_tree, &ei_nan_invalid_channel_num_for_op_class); + } - const gint *channel_set = rval_to_channel_set(op_class, op_class_channel); - if (channel_set == NULL) + if (!number_of_chs || number_of_chs > PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN) { - expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class); - break; + /* Number of channel should at least be one and should not exceed the maximum */ + expert_add_info(pinfo, channel_tree, &ei_nan_invalid_channel_count); } - gint channel = channel_set[i_bitmap]; - switch (channel) + uint8_t number_of_chs_max = + (number_of_chs + start_ch_number_idx < PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN) ? + (number_of_chs + start_ch_number_idx) : PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN; + for (uint8_t num_ch = start_ch_number_idx; num_ch < number_of_chs_max; num_ch++) { - // TODO: replace these magic numbers (or use 802.11 dissector for this) - case -3: - wmem_strbuf_append_printf(str, "%s", "Derived from regulation "); - break; - case -2: - wmem_strbuf_append_printf(str, "%s", "Vendor Specific "); - break; - case -1: - wmem_strbuf_append_printf(str, "%s", "Reserved "); - break; - default: - wmem_strbuf_append_printf(str, "%d ", channel); + wmem_strbuf_append_printf(str, "%d ", channel_set_higher_op_class[num_ch]); } } + else + { + expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class); + } + proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_start_channel_number, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_number_of_ch_included, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN); + + proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str)); } - proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str)); proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_primary_channel_bitmap, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN); @@ -1641,7 +1853,7 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui } static void -dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_NDC_MIN_LENGTH) { @@ -1664,10 +1876,10 @@ dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr ett_ndc_ctr, ndc_ctr_fields, ENC_LITTLE_ENDIAN); offset += 10; - gint dissected_len = 7; + int dissected_len = 7; while (dissected_len < attr_len) { - guint8 time_bitmap_len = tvb_get_guint8(tvb, offset + 3); + uint8_t time_bitmap_len = tvb_get_uint8(tvb, offset + 3); proto_tree* entry_tree = proto_tree_add_subtree(attr_tree, tvb, offset, time_bitmap_len + 4, ett_ndc_entries, NULL, "Schedule Entry"); proto_tree_add_bitmask(entry_tree, tvb, offset, hf_nan_map_id, @@ -1686,7 +1898,7 @@ dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr } static void -dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_NDL_MIN_LENGTH) { @@ -1694,8 +1906,8 @@ dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr return; } - guint sub_offset = offset + 3; - guint dissected_len = 0; + unsigned sub_offset = offset + 3; + unsigned dissected_len = 0; proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; @@ -1723,9 +1935,9 @@ dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ndl_control, ett_ndl_control, ndl_control_fields, ENC_LITTLE_ENDIAN); - guint8 peer_id_pres = tvb_get_bits8(tvb, sub_offset * 8 + 7, 1); - guint8 immutable_sched_pres = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1); - guint8 idle_per = tvb_get_bits8(tvb, sub_offset * 8 + 3, 1); + uint8_t peer_id_pres = tvb_get_bits8(tvb, sub_offset * 8 + 7, 1); + uint8_t immutable_sched_pres = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1); + uint8_t idle_per = tvb_get_bits8(tvb, sub_offset * 8 + 3, 1); sub_offset++; dissected_len += 4; @@ -1753,7 +1965,7 @@ dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl, time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN); sub_offset += 2; - guint field_length = tvb_get_guint8(tvb, sub_offset); + unsigned field_length = tvb_get_uint8(tvb, sub_offset); proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA); @@ -1764,7 +1976,7 @@ dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr } static void -dissect_attr_ndl_qos(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ndl_qos(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_NDL_QOS_LENGTH) { @@ -1772,14 +1984,14 @@ dissect_attr_ndl_qos(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_attr_ndlqos_min_time_slots, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; proto_tree_add_item(attr_tree, hf_nan_attr_ndlqos_max_latency, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN); } static void -dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_UNALIGNED_SCH_MIN_LENGTH) { @@ -1787,8 +1999,8 @@ dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, gint offse return; } - guint sub_offset = offset + 3; - guint dissected_len = 0; + unsigned sub_offset = offset + 3; + unsigned dissected_len = 0; static int* const control_fields[] = { &hf_nan_attr_unaligned_sch_ctrl_schedule_id, &hf_nan_attr_unaligned_sch_ctrl_seq_id, @@ -1830,7 +2042,7 @@ dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, gint offse proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ulw_ctrl, ett_unaligned_sch_ulw_ctrl, ulw_control_fields, ENC_LITTLE_ENDIAN); - guint8 entry_type = tvb_get_bits8(tvb, sub_offset * 8 + 6, 2); + uint8_t entry_type = tvb_get_bits8(tvb, sub_offset * 8 + 6, 2); sub_offset++; switch (entry_type) @@ -1876,9 +2088,9 @@ dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, gint offse } static void -dissect_attr_ranging_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) +dissect_attr_ranging_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; static int* const location_info_availability_fields[] = { &hf_nan_attr_ranging_info_location_info_avail_lci, &hf_nan_attr_ranging_info_location_info_avail_geospatial, @@ -1889,7 +2101,7 @@ dissect_attr_ranging_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_info_location_info_avail, ett_ranging_info_location_info_availability, location_info_availability_fields, ENC_LITTLE_ENDIAN); - gboolean loc_exists = tvb_get_bits8(tvb, sub_offset * 8 + 4, 1); + bool loc_exists = tvb_get_bits8(tvb, sub_offset * 8 + 4, 1); sub_offset++; if (loc_exists) { @@ -1898,7 +2110,7 @@ dissect_attr_ranging_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) } static void -dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_RANGING_SETUP_MIN_LENGTH) { @@ -1906,8 +2118,8 @@ dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu return; } - guint sub_offset = offset + 3; - guint dissected_len = 0; + unsigned sub_offset = offset + 3; + unsigned dissected_len = 0; proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; @@ -1930,8 +2142,8 @@ dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu sub_offset++; proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_setup_ctrl, ett_ranging_setup_ctrl, ranging_setup_ctrl_fields, ENC_LITTLE_ENDIAN); - guint8 ftm_check = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1); - guint8 ranging_entry_check = tvb_get_bits8(tvb, sub_offset * 8 + 5, 1); + uint8_t ftm_check = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1); + uint8_t ranging_entry_check = tvb_get_bits8(tvb, sub_offset * 8 + 5, 1); sub_offset++; dissected_len += 4; @@ -1963,7 +2175,7 @@ dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl, time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN); sub_offset += 2; - guint field_length = tvb_get_guint8(tvb, sub_offset); + unsigned field_length = tvb_get_uint8(tvb, sub_offset); proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA); @@ -1974,16 +2186,16 @@ dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu } static void -dissect_attr_ftm_report(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) +dissect_attr_ftm_report(proto_tree* attr_tree, tvbuff_t* tvb, int offset) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_attr_ftm_range_report, tvb, sub_offset, -1, ENC_NA); } static void -dissect_attr_element_container(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_element_container(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; // Some header fields and trees are reused. static int* const container_map_id_fields[] = { @@ -1994,12 +2206,12 @@ dissect_attr_element_container(proto_tree* attr_tree, tvbuff_t* tvb, gint offset proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_id, ett_device_cap_map_id, container_map_id_fields, ENC_LITTLE_ENDIAN); sub_offset += 1; - guint dissected_length = 1; + unsigned dissected_length = 1; proto_tree* sub_tree; while (dissected_length < attr_len) { - guint element_id = tvb_get_guint8(tvb, sub_offset); - guint element_len = tvb_get_guint8(tvb, sub_offset + 1); + unsigned element_id = tvb_get_uint8(tvb, sub_offset); + unsigned element_len = tvb_get_uint8(tvb, sub_offset + 1); const char* msg = val_to_str(element_id, ie_tag_num_vals, "Unknown element ID (%u)"); sub_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, element_len + 2, ett_ie_tree, NULL, msg); @@ -2011,14 +2223,14 @@ dissect_attr_element_container(proto_tree* attr_tree, tvbuff_t* tvb, gint offset ieee80211_tagged_field_data_t field_data = { 0 }; tvbuff_t* ie_tvb = tvb_new_subset_length(tvb, sub_offset, element_len); field_data.item_tag = sub_tree; - dissector_try_uint_new(ie_handle_table, element_id, ie_tvb, pinfo, sub_tree, TRUE, &field_data); + dissector_try_uint_new(ie_handle_table, element_id, ie_tvb, pinfo, sub_tree, true, &field_data); sub_offset += element_len; dissected_length += element_len + 2; } } static void -dissect_attr_extended_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_extended_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_EXTENDED_WLAN_INFRA_LENGTH) { @@ -2026,7 +2238,7 @@ dissect_attr_extended_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, gint offs return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN); sub_offset += 6; proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); @@ -2054,7 +2266,7 @@ dissect_attr_extended_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, gint offs } static void -dissect_attr_extended_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_extended_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_EXTENDED_P2P_OP_LENGTH) { @@ -2062,7 +2274,7 @@ dissect_attr_extended_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, gint o return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; static int* const ext_p2p_bitmap_fields[] = { &hf_nan_attr_p2p_device_role_device, &hf_nan_attr_p2p_device_role_group_owner, @@ -2096,7 +2308,7 @@ dissect_attr_extended_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, gint o } static void -dissect_attr_extended_ibss(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_extended_ibss(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len != NAN_EXTENDED_IBSS_LENGTH) { @@ -2104,7 +2316,7 @@ dissect_attr_extended_ibss(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN); sub_offset += 6; proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); @@ -2130,7 +2342,7 @@ dissect_attr_extended_ibss(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu } static void -dissect_attr_extended_mesh(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_extended_mesh(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_EXTENDED_MESH_MIN_LENGTH) { @@ -2138,8 +2350,8 @@ dissect_attr_extended_mesh(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu return; } - guint sub_offset = offset + 3; - guint length = tvb_get_guint16(tvb, sub_offset - 2, ENC_LITTLE_ENDIAN); + unsigned sub_offset = offset + 3; + unsigned length = tvb_get_uint16(tvb, sub_offset - 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA); sub_offset += 6; @@ -2165,7 +2377,7 @@ dissect_attr_extended_mesh(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gu } static void -dissect_attr_cipher_suite_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_cipher_suite_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_CIPHER_SUITE_INFO_MIN_LENGTH) { @@ -2173,9 +2385,15 @@ dissect_attr_cipher_suite_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset return; } - guint sub_offset = offset + 3; - guint dissected_len = 0; - proto_tree_add_item(attr_tree, hf_nan_attr_cipher_suite_capabilities, tvb, sub_offset, 1, ENC_BIG_ENDIAN); + unsigned sub_offset = offset + 3; + unsigned dissected_len = 0; + + proto_tree* caps_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 1, ett_nan_cipher_suite_capabilities, NULL, "Capabilities"); + proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN); + sub_offset++; dissected_len++; @@ -2194,7 +2412,7 @@ dissect_attr_cipher_suite_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset } static void -dissect_attr_security_context_info(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_security_context_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_CIPHER_SUITE_INFO_MIN_LENGTH) { @@ -2202,12 +2420,12 @@ dissect_attr_security_context_info(proto_tree* attr_tree, tvbuff_t* tvb, gint of return; } - guint sub_offset = offset + 3; - guint dissected_len = 0; + unsigned sub_offset = offset + 3; + unsigned dissected_len = 0; while (dissected_len < attr_len) { - guint field_length = tvb_get_guint16(tvb, sub_offset, ENC_LITTLE_ENDIAN); + unsigned field_length = tvb_get_uint16(tvb, sub_offset, ENC_LITTLE_ENDIAN); proto_item* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, field_length + 4, ett_attributes, NULL, "Security Context Identifier"); proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier_len, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN); @@ -2223,16 +2441,16 @@ dissect_attr_security_context_info(proto_tree* attr_tree, tvbuff_t* tvb, gint of } static void -dissect_attr_shared_key_descriptor(proto_tree* attr_tree, tvbuff_t* tvb, gint offset) +dissect_attr_shared_key_descriptor(proto_tree* attr_tree, tvbuff_t* tvb, int offset) { - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset += 1; proto_tree_add_item(attr_tree, hf_nan_attr_shared_key_rsna_descriptor, tvb, sub_offset, -1, ENC_NA); } static void -dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_PUBLIC_AVAIL_MIN_LENGTH) { @@ -2240,8 +2458,8 @@ dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offs return; } - guint sub_offset = offset + 3; - guint dissected_len = 0; + unsigned sub_offset = offset + 3; + unsigned dissected_len = 0; proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len, ett_public_availability_sch_entries, NULL, "Public Availability Schedule Entry List"); @@ -2252,7 +2470,7 @@ dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offs proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl, time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN); sub_offset += 2; - guint field_length = tvb_get_guint8(tvb, sub_offset); + unsigned field_length = tvb_get_uint8(tvb, sub_offset); proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN); sub_offset++; proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA); @@ -2262,7 +2480,7 @@ dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offs } static void -dissect_attr_vendor_specific(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo) +dissect_attr_vendor_specific(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) { if (attr_len < NAN_VENDOR_SPECIFIC_MIN_LENGTH) { @@ -2270,15 +2488,168 @@ dissect_attr_vendor_specific(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, return; } - guint sub_offset = offset + 3; + unsigned sub_offset = offset + 3; tvbuff_t* ie_tvb = tvb_new_subset_length(tvb, sub_offset, -1); ieee80211_tagged_field_data_t field_data = { 0 }; field_data.item_tag = attr_tree; - dissector_try_uint_new(ie_handle_table, TAG_VENDOR_SPECIFIC_IE, ie_tvb, pinfo, attr_tree, TRUE, &field_data); + dissector_try_uint_new(ie_handle_table, TAG_VENDOR_SPECIFIC_IE, ie_tvb, pinfo, attr_tree, true, &field_data); +} + +static void +dissect_attr_device_capability_extension(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) +{ + if (attr_len < NAN_DEVICE_CAPABILITY_EXTENSION_MIN_LENGTH) + { + /* At least has 9 bits defined in NAN-R4 spec */ + expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid); + return; + } + + static int* const capability_info_fields[] = { + &hf_nan_attr_device_capability_extension_6g_regulatory_info_presented, + &hf_nan_attr_device_capability_extension_6g_regulatory_info, + &hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved, + &hf_nan_attr_device_capability_extension_paring_setup_enabled, + &hf_nan_attr_device_capability_extension_npk_nik_cache_enabled, + NULL + }; + + proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_attr_device_capability_extension, + ett_device_capability_extension, capability_info_fields, ENC_LITTLE_ENDIAN); } static void -find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, guint tvb_len, guint* offset, packet_info* pinfo) +dissect_attr_nan_identity_resolution(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) +{ + if (attr_len < NAN_IDENTITY_RESOLUTION_MIN_LEN) + { + /* At least 1 byte: Cipher version */ + expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid); + return; + } + + proto_tree_add_item(attr_tree, hf_nan_attr_identity_cipher_version, tvb, + offset + 3, 1, ENC_LITTLE_ENDIAN); + + uint8_t cipher_version = tvb_get_uint8(tvb, offset + 3); + switch (cipher_version) + { + case 0: + proto_tree_add_item(attr_tree, hf_nan_attr_identity_resolution_nonce, tvb, + offset + 4, 8, ENC_NA); + proto_tree_add_item(attr_tree, hf_nan_attr_identity_resolution_tag, tvb, + offset + 12, 8, ENC_NA); + break; + default: + proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb, + offset + 3, attr_len - 1, ENC_NA); + } +} + +static void +dissect_attr_nan_pairing_bootstrapping(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo) +{ + if (attr_len < NAN_PAIRING_BOOTSTRAPPING_LEN) + { + /* At least 5 bytes: Dialog Token(1) + Type and Status(1) + Reason Code(1) + Pairing Bootstrapping Method(2) */ + expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid); + return; + } + int npba_local_offset = offset + 3; + + /* Dialog Token */ + proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_dialog_token, tvb, + npba_local_offset, 1, ENC_LITTLE_ENDIAN); + npba_local_offset += 1; + + /* Type and Status */ + uint8_t type_status = tvb_get_uint8(tvb, npba_local_offset); + uint8_t type = type_status & 0x0f; + uint8_t status = (type_status & 0xf0) >> 4; + + static int* const type_and_status_fields[] = { + &hf_nan_attr_pairing_bootstrapping_type, + &hf_nan_attr_pairing_bootstrapping_status, + NULL + }; + proto_tree_add_bitmask(attr_tree, tvb, npba_local_offset, hf_nan_attr_pairing_bootstrapping_type_status, + ett_nan_pairing_bootstrapping_type_status, type_and_status_fields, ENC_LITTLE_ENDIAN); + npba_local_offset += 1; + + /* Resaon code + * Indicate the reject reason when Type = 2 (Response) and Status = 1 (Rejected); otherwise, reserved */ + if ((type == 2) && (status == 1)) + { + proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_resaon_code, tvb, + npba_local_offset, 1, ENC_LITTLE_ENDIAN); + } + else + { + proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb, + npba_local_offset, 1, ENC_NA); + } + npba_local_offset += 1; + + /* Comeback, if any. Presetned if, + * a) type is 2 and status is 2, or + * b) type is 1 and status is 2, and cookie is requried (based on attribute length) + */ + bool comeback_presented = (attr_len > NAN_PAIRING_BOOTSTRAPPING_LEN); + + bool comeback_after_presented = comeback_presented && ((type == 2) && (status == 2)); + + if (comeback_after_presented) + { + proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_after, tvb, + npba_local_offset, 2, ENC_LITTLE_ENDIAN); + npba_local_offset += 2; + } + + if (comeback_presented) + { + uint8_t cookie_len = tvb_get_uint8(tvb, npba_local_offset); + proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_cookie_len, tvb, + npba_local_offset, 1, ENC_LITTLE_ENDIAN); + npba_local_offset += 1; + + if (cookie_len) + { + proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_cookie, tvb, + npba_local_offset, cookie_len, ENC_NA); + npba_local_offset += cookie_len; + } + } + + /* Pairing Bootstrapping Method */ + static int* const pairing_bootstrapping_method[] = { + &hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping, + &hf_nan_attr_pairing_bootstrapping_method_pin_code_display, + &hf_nan_attr_pairing_bootstrapping_method_passphrase_display, + &hf_nan_attr_pairing_bootstrapping_method_qr_code_display, + &hf_nan_attr_pairing_bootstrapping_method_nfc_tag, + &hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only, + &hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase, + &hf_nan_attr_pairing_bootstrapping_method_qr_code_scan, + &hf_nan_attr_pairing_bootstrapping_method_nfc_reader, + &hf_nan_attr_pairing_bootstrapping_method_reserved, + &hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping, + &hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped, + NULL + }; + if (type == 2 && status) + { + proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb, + npba_local_offset, 2, ENC_NA); + } + else + { + proto_tree_add_bitmask(attr_tree, tvb, npba_local_offset, hf_nan_attr_pairing_bootstrapping_methods, + ett_nan_pairing_bootstrapping_method, pairing_bootstrapping_method, ENC_LITTLE_ENDIAN); + } +} + +static void +find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, unsigned tvb_len, unsigned* offset, packet_info* pinfo) { if ((tvb_len - *offset) < 3) { @@ -2288,8 +2659,8 @@ find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, guint tvb_len, guint* return; } - gint attr_id = tvb_get_guint8(tvb, *offset); - guint16 attr_len = tvb_get_letohs(tvb, *offset + 1); + int attr_id = tvb_get_uint8(tvb, *offset); + uint16_t attr_len = tvb_get_letohs(tvb, *offset + 1); if ((*offset + 3 + attr_len) > tvb_len) { @@ -2415,6 +2786,15 @@ find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, guint tvb_len, guint* case NAN_ATTR_NDL: dissect_attr_ndl(attr_tree, tvb, *offset, attr_len, pinfo); break; + case NAN_ATTR_DEVICE_CAPABILITY_EXTENSION: + dissect_attr_device_capability_extension(attr_tree, tvb, *offset, attr_len, pinfo); + break; + case NAN_ATTR_IDENTITY_RESOLUTION: + dissect_attr_nan_identity_resolution(attr_tree, tvb, *offset, attr_len, pinfo); + break; + case NAN_ATTR_PAIRING_BOOTSTRAPPING: + dissect_attr_nan_pairing_bootstrapping(attr_tree, tvb, *offset, attr_len, pinfo); + break; default: expert_add_info(pinfo, attr_tree, &ei_nan_unknown_attr_id); } @@ -2425,7 +2805,7 @@ find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, guint tvb_len, guint* static int dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { - guint offset = 0; + unsigned offset = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN"); @@ -2437,7 +2817,7 @@ dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* da // field value be provided to it by the calling dissector, so we can't // just ask for "wlan.fixed.beacon". // - // Fortunaely, we are currently putting the Discovery vs. Sync information + // Fortunately, we are currently putting the Discovery vs. Sync information // only in the Info column, and the beacon interval is put at the end // of the Info column, as "BI={interval}", by the 802.11 dissector, so // we can just fetch the Info column string and, if it's present, extract @@ -2447,7 +2827,7 @@ dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* da // beacon, and an interval of 512, meaning .524288 seconds, means // it's a Sync beacon. // - const gchar* info_text = col_get_text(pinfo->cinfo, COL_INFO); + const char* info_text = col_get_text(pinfo->cinfo, COL_INFO); if (info_text != NULL && g_str_has_suffix(info_text, "100")) { col_prepend_fstr(pinfo->cinfo, COL_INFO, "Discovery "); @@ -2465,7 +2845,7 @@ dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* da proto_item* ti = proto_tree_add_item(tree, proto_nan, tvb, 0, -1, ENC_NA); proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan); - guint tvb_len = tvb_reported_length(tvb); + unsigned tvb_len = tvb_reported_length(tvb); while (offset < tvb_len) { find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo); @@ -2476,7 +2856,7 @@ dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* da static int dissect_nan_action(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { - guint offset = 0; + unsigned offset = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN"); @@ -2484,15 +2864,15 @@ dissect_nan_action(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* da proto_item* ti = proto_tree_add_item(upper_tree, proto_nan, tvb, 0, -1, ENC_NA); proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan); - guint8 subtype = tvb_get_guint8(tvb, offset); - const gchar* subtype_text = rval_to_str(subtype, action_frame_type_values, "Unknown type (%u)"); + uint8_t subtype = tvb_get_uint8(tvb, offset); + const char* subtype_text = rval_to_str(subtype, action_frame_type_values, "Unknown type (%u)"); proto_item_set_text(ti, "%s", subtype_text); proto_tree_add_item(nan_tree, hf_nan_action_subtype, tvb, offset, 1, ENC_BIG_ENDIAN); col_prepend_fstr(pinfo->cinfo, COL_INFO, "%s", subtype_text); offset++; - guint tvb_len = tvb_reported_length(tvb); + unsigned tvb_len = tvb_reported_length(tvb); while (offset < tvb_len) { find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo); @@ -2503,12 +2883,12 @@ dissect_nan_action(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* da static int dissect_nan_service_discovery(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { - guint offset = 0; + unsigned offset = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN"); proto_item* ti = proto_tree_add_item(tree, proto_nan, tvb, 0, -1, ENC_NA); proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan); - guint tvb_len = tvb_reported_length(tvb); + unsigned tvb_len = tvb_reported_length(tvb); while (offset < tvb_len) { find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo); @@ -3285,6 +3665,20 @@ proto_register_nan(void) FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } }, + { &hf_nan_attr_device_cap_supported_bands_reserved_45ghz, + { + "Reserved (for 45 GHz)", + "wifi_nan.device_cap.supported_bands.reserved_45ghz", + FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL + } + }, + { &hf_nan_attr_device_cap_supported_bands_6ghz, + { + "6GHz", + "wifi_nan.device_cap.supported_bands.6ghz", + FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL + } + }, { &hf_nan_attr_device_cap_op_mode, { "Operation Mode", @@ -3292,23 +3686,30 @@ proto_register_nan(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, - { &hf_nan_attr_device_cap_op_mode_phy, + { &hf_nan_attr_device_cap_op_mode_phy_vht, { - "PHY Mode", - "wifi_nan.device_cap.op_mode.phy", - FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags), 0x01, NULL, HFILL + "PHY Mode (VHT/HT)", + "wifi_nan.device_cap.op_mode.phy.vht", + FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags_vht), 0x01, NULL, HFILL } }, - { &hf_nan_attr_device_cap_op_mode_vht8080, + { &hf_nan_attr_device_cap_op_mode_phy_he, { - "VHT 80+80", + "PHY Mode (HE)", + "wifi_nan.device_cap.op_mode.phy.he", + FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags_he), 0x10, NULL, HFILL + } + }, + { &hf_nan_attr_device_cap_op_mode_phy_he_vht8080, + { + "HE/VHT 80+80", "wifi_nan.device_cap.op_mode.vht8080", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } }, - { &hf_nan_attr_device_cap_op_mode_vht160, + { &hf_nan_attr_device_cap_op_mode_phy_he_vht160, { - "VHT 160", + "HE/VHT 160", "wifi_nan.device_cap.op_mode.vht160", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } @@ -3383,6 +3784,13 @@ proto_register_nan(void) FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, + { &hf_nan_attr_device_cap_capabilities_s3_capable, + { + "S3 Capable", + "wifi_nan.device_cap.capabilities.s3_capable", + FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL + } + }, { &hf_nan_attr_ndp_type, { "Type", @@ -3439,6 +3847,41 @@ proto_register_nan(void) FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } }, + { &hf_nan_attr_ndpe_ctrl_confirm, + { + "Confirm Required", + "wifi_nan.ndpe.ctrl.confirm", + FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL + } + }, + { &hf_nan_attr_ndpe_ctrl_security_pres, + { + "Security Present", + "wifi_nan.ndpe.ctrl.security_pres", + FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL + } + }, + { &hf_nan_attr_ndpe_ctrl_publish_id_pres, + { + "Publish ID Present", + "wifi_nan.ndpe.ctrl.publish_id_pres", + FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL + } + }, + { &hf_nan_attr_ndpe_ctrl_responder_ndi_pres, + { + "Responder NDI Present", + "wifi_nan.ndpe.ctrl.responder_ndi_pres", + FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL + } + }, + { &hf_nan_attr_ndpe_ctrl_gtk_requried, + { + "GTK Required", + "wifi_nan.ndpe.ctrl.gtk_required", + FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL + } + }, { &hf_nan_attr_ndp_control, { "NDP Control", @@ -3446,6 +3889,13 @@ proto_register_nan(void) FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_nan_attr_ndpe_control, + { + "NDPE Control", + "wifi_nan.ndpe.ctrl", + FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL + } + }, { &hf_nan_attr_ndp_responder_ndi, { "Responder NDI", @@ -3597,14 +4047,14 @@ proto_register_nan(void) { "Type", "wifi_nan.availability.entry.entries.type", - FT_BOOLEAN, 8, TFS(&availability_entry_entries_type_flags), 0x0, NULL, HFILL + FT_BOOLEAN, BASE_NONE, TFS(&availability_entry_entries_type_flags), 0x0, NULL, HFILL } }, { &hf_nan_attr_availability_entry_entries_non_contiguous_bw, { "Non-contiguous Bandwidth", "wifi_nan.availability.entry.entries.non_contiguous_bw", - FT_BOOLEAN, 8, NULL, 0x0, NULL, HFILL + FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_nan_attr_availability_entry_entries_num_entries, @@ -3656,6 +4106,20 @@ proto_register_nan(void) FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + { &hf_nan_attr_availability_entry_entries_start_channel_number, + { + "Start Channel Number", + "wifi_nan.availability.entry.entries.channel.start_channel_number", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_availability_entry_entries_number_of_ch_included, + { + "Number of Channels Included", + "wifi_nan.availability.entry.entries.channel.num_of_channel", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, { &hf_nan_attr_availability_entry_entries_start_freq, { "Starting Frequency", @@ -4013,6 +4477,34 @@ proto_register_nan(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters, + { + "ND-TKSA and NM-TKSA Replay Counters", + "wifi_nan.cipher_suite.capabilities.replay_counters.ndtksa", + FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_nd_nm_tksa_replay_counters), 0x01, NULL, HFILL + } + }, + { &hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support, + { + "GTKSA, IGTKSA, and BIGTKSA Support", + "wifi_nan.cipher_suite.capabilities.group_key_support", + FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_group_and_integrity_sa_support), 0x06, NULL, HFILL + } + }, + { &hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters, + { + "GTKSA Replay Counters", + "wifi_nan.cipher_suite.capabilities.replay_counters.gtksa", + FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_gtksa_replay_counters), 0x08, NULL, HFILL + } + }, + { &hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher, + { + "IGTKSA and BIGTKSA Cipher", + "wifi_nan.cipher_suite.capabilities.integrity_key_cipher", + FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_integrity_sa_ciphers), 0x10, NULL, HFILL + } + }, { &hf_nan_attr_cipher_suite_id, { "Cipher Suite ID", @@ -4069,9 +4561,219 @@ proto_register_nan(void) FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_nan_attr_device_capability_extension, + { + "Capability Extension", + "wifi_nan.device_capability_extension.capability_info", + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_device_capability_extension_6g_regulatory_info_presented, + { + "6GHz Regulatory Info Presented", + "wifi_nan.device_capability_extension.6g_regulatory_presented", + FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL + } + }, + { &hf_nan_attr_device_capability_extension_6g_regulatory_info, + { + "6GHz Regulatory Info", + "wifi_nan.device_capability_extension.6g_regulatory", + FT_UINT16, BASE_HEX_DEC, VALS(device_capability_extension_6g_regulatoty_info), 0x000e, NULL, HFILL + } + }, + { &hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved, + { + "Reserved for 6GHz Regulatory Info", + "wifi_nan.device_capability_extension.6g_regulatory_reserved", + FT_UINT16, BASE_HEX_DEC, NULL, 0x00f0, NULL, HFILL + } + }, + { &hf_nan_attr_device_capability_extension_paring_setup_enabled, + { + "Paring Enable", + "wifi_nan.device_capability_extension.paring_enable", + FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL + } + }, + { &hf_nan_attr_device_capability_extension_npk_nik_cache_enabled, + { + "NPK/NIK Caching Enable", + "wifi_nan.device_capability_extension.npk_nik_caching_enable", + FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL + } + }, + { &hf_nan_attr_identity_cipher_version, + { + "Cipher Version", + "wifi_nan.identity_resolution.cipher_version", + FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(nan_identity_resolution_cipher_version), 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_identity_resolution_nonce, + { + "Nonce", + "wifi_nan.identity_resolution.nonce", + FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_identity_resolution_tag, + { + "Tag", + "wifi_nan.identity_resolution.tag", + FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_reserved, + { + "Reserved", + "wifi_nan.reserved", + FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_dialog_token, + { + "Dialog Token", + "wifi_nan.nan_pairing_bootstrapping.dialog_token", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_type_status, + { + "Type and Status", + "wifi_nan.nan_pairing_bootstrapping.type_status", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_type, + { + "Type", + "wifi_nan.nan_pairing_bootstrapping.type", + FT_UINT8, BASE_HEX_DEC, VALS(nan_pairing_bootstrapping_pairing_bootstrapping_type), 0x0f, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_status, + { + "Status", + "wifi_nan.nan_pairing_bootstrapping.status", + FT_UINT8, BASE_HEX_DEC, VALS(nan_pairing_bootstrapping_pairing_bootstrapping_status), 0xf0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_comeback_after, + { + "Comeback after (TU)", + "wifi_nan.nan_pairing_bootstrapping.comeback_after", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_comeback_cookie_len, + { + "Cookie Length", + "wifi_nan.nan_pairing_bootstrapping.cookie_len", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_comeback_cookie, + { + "Cookie", + "wifi_nan.nan_pairing_bootstrapping.cookie", + FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_methods, + { + "Bootstrapping Methods", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods", + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping, + { + "Opportunistic Bootstrapping", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.opportunistic", + FT_UINT16, BASE_HEX, NULL, 0x0001, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_pin_code_display, + { + "Pin Code (Display)", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.pin_code_display", + FT_UINT16, BASE_HEX, NULL, 0x0002, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_passphrase_display, + { + "Passphrase (Display)", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.passphrase_display", + FT_UINT16, BASE_HEX, NULL, 0x0004, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_qr_code_display, + { + "QR Code (Display)", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.qr_code_display", + FT_UINT16, BASE_HEX, NULL, 0x0008, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_nfc_tag, + { + "NFC Tag", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.nfc_tag", + FT_UINT16, BASE_HEX, NULL, 0x0010, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only, + { + "Pin Code Only (Keypad)", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.pin_code_keypad", + FT_UINT16, BASE_HEX, NULL, 0x0020, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase, + { + "Passphrase (Keypad)", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.passphrase_keypad", + FT_UINT16, BASE_HEX, NULL, 0x0040, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_qr_code_scan, + { + "QR Code (Scan)", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.qr_code_scan", + FT_UINT16, BASE_HEX, NULL, 0x0080, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_nfc_reader, + { + "NFC Reader", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.nfc_reader", + FT_UINT16, BASE_HEX, NULL, 0x0100, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_reserved, + { + "Reserved", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.reserved", + FT_UINT16, BASE_HEX, NULL, 0x3e00, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping, + { + "Service Managed", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.service_managed", + FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL + } + }, + { &hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped, + { + "Bootstrapping Handshakes Skipped", + "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.bootstrapping_handshakes_skipped", + FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL + } + }, }; - static gint* ett[] = { + static int* ett[] = { &ett_nan, &ett_attributes, &ett_type_status, @@ -4118,6 +4820,10 @@ proto_register_nan(void) &ett_security_context_identifiers, &ett_public_availability_sch_entries, &ett_ie_tree, + &ett_device_capability_extension, + &ett_nan_pairing_bootstrapping_type_status, + &ett_nan_pairing_bootstrapping_method, + &ett_nan_cipher_suite_capabilities }; static ei_register_info ei[] = { @@ -4153,6 +4859,22 @@ proto_register_nan(void) EXPFILL } }, + { &ei_nan_invalid_channel_num_for_op_class, + { + "wifi_nan.expert.invalid_ch_num", + PI_PROTOCOL, PI_WARN, + "Invalid Channel number for given operation class", + EXPFILL + } + }, + { &ei_nan_invalid_channel_count, + { + "wifi_nan.expert.invalid_ch_count", + PI_PROTOCOL, PI_WARN, + "Invalid Channel count", + EXPFILL + } + }, }; proto_nan = proto_register_protocol("Wi-Fi Neighbor Awareness Networking (NAN)", "Wi-Fi NAN", "wifi_nan"); |