aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2014-01-30 08:44:35 +0100
committerEvan Huus <eapache@gmail.com>2014-02-04 13:15:55 +0000
commit19873060150648c91fcc19b099f332f7d9f119e3 (patch)
tree04c018f5f9f17093eb5c27b7e3163dca5a1340ef
parent4ba8609d10a7fea83c681c59212824594b1a2a4d (diff)
Bluetooth: btle: Make RxAdd field reserved in some cases
Specification: "If the TxAdd or RxAdd fields are not defined as used in a given PDU then they shall be considered Reserved for Future Use." Change-Id: I767c0df0366afe789624046cda2d49c9875ffe60 Reviewed-on: https://code.wireshark.org/review/103 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
-rw-r--r--epan/dissectors/packet-btle.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 07741af7a0..606199fd7f 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -45,6 +45,7 @@ static int hf_advertising_header_pdu_type = -1;
static int hf_advertising_header_rfu_1 = -1;
static int hf_advertising_header_randomized_tx = -1;
static int hf_advertising_header_randomized_rx = -1;
+static int hf_advertising_header_reserved = -1;
static int hf_advertising_header_length = -1;
static int hf_advertising_header_rfu_2 = -1;
static int hf_advertising_address = -1;
@@ -256,11 +257,20 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
advertising_header_item = proto_tree_add_item(btle_tree, hf_advertising_header, tvb, offset, 2, ENC_LITTLE_ENDIAN);
advertising_header_tree = proto_item_add_subtree(advertising_header_item, ett_advertising_header);
+ pdu_type = tvb_get_guint8(tvb, offset) & 0x0F;
proto_tree_add_item(advertising_header_tree, hf_advertising_header_rfu_1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(advertising_header_tree, hf_advertising_header_randomized_tx, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(advertising_header_tree, hf_advertising_header_randomized_rx, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ switch (pdu_type) {
+ case 0x00: /* ADV_IND */
+ case 0x02: /* ADV_NONCONN_IND */
+ case 0x04: /* SCAN_RSP */
+ case 0x06: /* ADV_SCAN_IND */
+ proto_tree_add_item(advertising_header_tree, hf_advertising_header_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ break;
+ default:
+ proto_tree_add_item(advertising_header_tree, hf_advertising_header_randomized_rx, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ }
proto_tree_add_item(advertising_header_tree, hf_advertising_header_pdu_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- pdu_type = tvb_get_guint8(tvb, offset) & 0x0F;
proto_item_append_text(advertising_header_item, " (PDU Type: %s, TxAdd=%s, RxAdd=%s)",
val_to_str_ext_const(pdu_type, &pdu_type_vals_ext, "Unknown"),
(tvb_get_guint8(tvb, offset) & 0x20) ? "true" : "false",
@@ -635,6 +645,11 @@ proto_register_btle(void)
FT_BOOLEAN, 8, NULL, 0x10,
NULL, HFILL }
},
+ { &hf_advertising_header_reserved,
+ { "Reserved", "btle.advertising_header.reserved",
+ FT_BOOLEAN, 8, NULL, 0x10,
+ NULL, HFILL }
+ },
{ &hf_advertising_header_length,
{ "Length", "btle.advertising_header.length",
FT_UINT8, BASE_DEC, NULL, 0x03f,