1 /* packet-btmesh-proxy.c
2 * Routines for Bluetooth mesh Proxy PDU dissection
4 * Copyright 2019, Piotr Winiarczyk <wino45@gmail.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
12 * Ref: Mesh Profile v1.0
13 * https://www.bluetooth.com/specifications/mesh-specifications
18 #include <epan/packet.h>
19 #include <epan/prefs.h>
20 #include <epan/reassemble.h>
21 #include <epan/tvbuff-int.h>
22 #include <epan/expert.h>
23 #include <wsutil/wsgcrypt.h>
25 #include "packet-btmesh.h"
27 #define PROXY_COMPLETE_MESSAGE 0x00
28 #define PROXY_FIRST_SEGMENT 0x01
29 #define PROXY_CONTINUATION_SEGMENT 0x02
30 #define PROXY_LAST_SEGMENT 0x03
32 #define PROXY_PDU_NETWORK 0x00
33 #define PROXY_PDU_MESH_BEACON 0x01
34 #define PROXY_PDU_CONFIGURATION 0x02
35 #define PROXY_PDU_PROVISIONING 0x03
37 #define PROXY_SET_FILTER_TYPE 0x00
38 #define PROXY_ADD_ADDRESSES_TO_FILTER 0x01
39 #define PROXY_REMOVE_ADDRESSES_FROM_FILTER 0x02
40 #define PROXY_FILTER_STATUS 0x03
42 #define UNICAST_ADDRESS_MASK 0x8000
44 void proto_register_btmesh_proxy(void);
45 void proto_reg_handoff_btmesh_proxy(void);
47 static int proto_btmesh_proxy
;
49 static int hf_btmesh_proxy_type
;
50 static int hf_btmesh_proxy_sar
;
51 static int hf_btmesh_proxy_data
;
52 static int hf_btmesh_proxy_data_fragment
;
53 static int hf_btmesh_proxy_fragments
;
54 static int hf_btmesh_proxy_fragment
;
55 static int hf_btmesh_proxy_fragment_overlap
;
56 static int hf_btmesh_proxy_fragment_overlap_conflict
;
57 static int hf_btmesh_proxy_fragment_multiple_tails
;
58 static int hf_btmesh_proxy_fragment_too_long_fragment
;
59 static int hf_btmesh_proxy_fragment_error
;
60 static int hf_btmesh_proxy_fragment_count
;
61 static int hf_btmesh_proxy_reassembled_length
;
62 static int hf_btmesh_proxy_ivi
;
63 static int hf_btmesh_proxy_nid
;
64 static int hf_btmesh_proxy_ctl
;
65 static int hf_btmesh_proxy_ttl
;
66 static int hf_btmesh_proxy_seq
;
67 static int hf_btmesh_proxy_src
;
68 static int hf_btmesh_proxy_dst
;
69 static int hf_btmesh_proxy_transport_pdu
;
70 static int hf_btmesh_proxy_netmic
;
71 static int hf_btmesh_proxy_control_opcode
;
72 static int hf_btmesh_proxy_control_parameters
;
73 static int hf_btmesh_proxy_control_filter_type
;
74 static int hf_btmesh_proxy_control_list_size
;
75 static int hf_btmesh_proxy_control_list_item
;
77 static int ett_btmesh_proxy
;
78 static int ett_btmesh_proxy_network_pdu
;
79 static int ett_btmesh_proxy_transport_pdu
;
80 static int ett_btmesh_proxy_fragments
;
81 static int ett_btmesh_proxy_fragment
;
83 static expert_field ei_btmesh_proxy_unknown_opcode
;
84 static expert_field ei_btmesh_proxy_unknown_payload
;
85 static expert_field ei_btmesh_proxy_wrong_ctl
;
86 static expert_field ei_btmesh_proxy_wrong_ttl
;
87 static expert_field ei_btmesh_proxy_wrong_dst
;
88 static expert_field ei_btmesh_proxy_unknown_filter_type
;
89 static expert_field ei_btmesh_proxy_wrong_address_type
;
91 static dissector_handle_t btmesh_handle
;
92 static dissector_handle_t btmesh_provisioning_handle
;
93 static dissector_handle_t btmesh_beacon_handle
;
95 static wmem_tree_t
*connection_info_tree
;
96 static wmem_allocator_t
*pool
;
98 static const value_string btmesh_proxy_type
[] = {
100 { 1, "Mesh Beacon" },
101 { 2, "Proxy Configuration" },
102 { 3, "Provisioning PDU" },
106 static const value_string btmesh_proxy_sar
[] = {
107 { 0, "Data field contains a complete message" },
108 { 1, "Data field contains the first segment of a message" },
109 { 2, "Data field contains a continuation segment of a message" },
110 { 3, "Data field contains the last segment of a message" },
114 static const value_string btmesh_proxy_ctl_vals
[] = {
115 { 0, "Unknown Message" },
116 { 1, "Proxy Message" },
120 static const value_string btmesh_proxy_control_opcode
[] = {
121 { 0, "Set Filter Type" },
122 { 1, "Add Addresses To Filter" },
123 { 2, "Remove Addresses From Filter" },
124 { 3, "Filter Status" },
128 static const value_string btmesh_proxy_control_filter_type
[] = {
129 { 0, "White list filter" },
130 { 1, "Black list filter" },
134 static const fragment_items btmesh_proxy_frag_items
= {
135 &ett_btmesh_proxy_fragments
,
136 &ett_btmesh_proxy_fragment
,
138 &hf_btmesh_proxy_fragments
,
139 &hf_btmesh_proxy_fragment
,
140 &hf_btmesh_proxy_fragment_overlap
,
141 &hf_btmesh_proxy_fragment_overlap_conflict
,
142 &hf_btmesh_proxy_fragment_multiple_tails
,
143 &hf_btmesh_proxy_fragment_too_long_fragment
,
144 &hf_btmesh_proxy_fragment_error
,
145 &hf_btmesh_proxy_fragment_count
,
147 &hf_btmesh_proxy_reassembled_length
,
148 /* Reassembled data field */
153 static reassembly_table proxy_reassembly_table
;
154 static uint32_t sequence_counter
[E_BTMESH_PROXY_SIDE_LAST
];
155 static uint32_t fragment_counter
[E_BTMESH_PROXY_SIDE_LAST
];
156 static bool first_pass
;
159 dissect_btmesh_proxy_configuration_msg(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
161 int32_t enc_data_len
= 0;
162 uint8_t *decrypted_data
= NULL
;
163 tvbuff_t
*de_obf_tvb
;
164 tvbuff_t
*de_cry_tvb
;
165 proto_tree
*sub_tree
, *cntrl_sub_tree
;
166 uint32_t net_mic_size
, seq
, src
, dst
, opcode
, ttl
, bd_address
;
167 uint32_t filter_type
, list_size
;
169 uint32_t decry_off
= 0;
170 network_decryption_ctx_t
*dec_ctx
;
172 proto_tree_add_item(tree
, hf_btmesh_proxy_data
, tvb
, 0, tvb_reported_length(tvb
), ENC_NA
);
174 dec_ctx
= wmem_new(pinfo
->pool
, network_decryption_ctx_t
);
175 dec_ctx
->net_nonce_type
= BTMESH_NONCE_TYPE_PROXY
;
177 de_obf_tvb
= btmesh_network_find_key_and_decrypt(tvb
, pinfo
, &decrypted_data
, &enc_data_len
, dec_ctx
);
179 sub_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_btmesh_proxy_network_pdu
, NULL
, "Proxy Network PDU");
181 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_ivi
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
182 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_nid
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
185 add_new_data_source(pinfo
, de_obf_tvb
, "Deobfuscated data");
187 /* CTL 1 bit Network Control*/
188 proto_tree_add_item_ret_uint(sub_tree
, hf_btmesh_proxy_ctl
, de_obf_tvb
, 0, 1, ENC_BIG_ENDIAN
, &net_mic_size
);
189 if (net_mic_size
!= 1) {
190 proto_tree_add_expert(sub_tree
, pinfo
, &ei_btmesh_proxy_wrong_ctl
, de_obf_tvb
, 0, 1);
192 net_mic_size
= (net_mic_size
+ 1) * 4;
193 /* The TTL field is a 7-bit field */
194 proto_tree_add_item_ret_uint(sub_tree
, hf_btmesh_proxy_ttl
, de_obf_tvb
, 0, 1, ENC_BIG_ENDIAN
, &ttl
);
196 proto_tree_add_expert(sub_tree
, pinfo
, &ei_btmesh_proxy_wrong_ttl
, de_obf_tvb
, 0, 1);
198 /* SEQ field is a 24-bit integer */
199 proto_tree_add_item_ret_uint(sub_tree
, hf_btmesh_proxy_seq
, de_obf_tvb
, 1, 3, ENC_BIG_ENDIAN
, &seq
);
201 /* SRC field is a 16-bit value */
202 proto_tree_add_item_ret_uint(sub_tree
, hf_btmesh_proxy_src
, de_obf_tvb
, 4, 2, ENC_BIG_ENDIAN
, &src
);
203 if (src
& UNICAST_ADDRESS_MASK
) {
204 proto_tree_add_expert(sub_tree
, pinfo
, &ei_btmesh_proxy_wrong_address_type
, de_obf_tvb
, 4, 2);
208 de_cry_tvb
= tvb_new_child_real_data(tvb
, decrypted_data
, enc_data_len
, enc_data_len
);
209 add_new_data_source(pinfo
, de_cry_tvb
, "Decrypted data");
211 proto_tree_add_item_ret_uint(sub_tree
, hf_btmesh_proxy_dst
, de_cry_tvb
, decry_off
, 2, ENC_BIG_ENDIAN
, &dst
);
213 proto_tree_add_expert(sub_tree
, pinfo
, &ei_btmesh_proxy_wrong_dst
, de_cry_tvb
, decry_off
, 2);
218 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_transport_pdu
, de_cry_tvb
, decry_off
, enc_data_len
- 2, ENC_NA
);
219 offset
+= enc_data_len
;
221 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_netmic
, tvb
, offset
, net_mic_size
, ENC_BIG_ENDIAN
);
222 offset
+= net_mic_size
;
224 cntrl_sub_tree
= proto_tree_add_subtree(tree
, de_cry_tvb
, decry_off
, -1, ett_btmesh_proxy_transport_pdu
, NULL
, "Proxy Transport PDU");
226 proto_tree_add_item_ret_uint(cntrl_sub_tree
, hf_btmesh_proxy_control_opcode
, de_cry_tvb
, decry_off
, 1, ENC_BIG_ENDIAN
, &opcode
);
231 case PROXY_SET_FILTER_TYPE
:
232 proto_tree_add_item_ret_uint(cntrl_sub_tree
, hf_btmesh_proxy_control_filter_type
, de_cry_tvb
, decry_off
, 1, ENC_BIG_ENDIAN
, &filter_type
);
233 if (filter_type
> 1) {
234 proto_tree_add_expert(cntrl_sub_tree
, pinfo
, &ei_btmesh_proxy_unknown_filter_type
, de_cry_tvb
, decry_off
, 1);
239 case PROXY_ADD_ADDRESSES_TO_FILTER
:
240 while (decry_off
<= (uint32_t)enc_data_len
- 1) {
241 proto_tree_add_item_ret_uint(cntrl_sub_tree
, hf_btmesh_proxy_control_list_item
, de_cry_tvb
, decry_off
, 2, ENC_BIG_ENDIAN
, &bd_address
);
242 if (bd_address
== 0 ) {
243 proto_tree_add_expert(cntrl_sub_tree
, pinfo
, &ei_btmesh_proxy_wrong_address_type
, de_cry_tvb
, decry_off
, 2);
249 case PROXY_REMOVE_ADDRESSES_FROM_FILTER
:
250 while (decry_off
<= (uint32_t)enc_data_len
- 1) {
251 proto_tree_add_item_ret_uint(cntrl_sub_tree
, hf_btmesh_proxy_control_list_item
, de_cry_tvb
, decry_off
, 2, ENC_BIG_ENDIAN
, &bd_address
);
252 if (bd_address
== 0 ) {
253 proto_tree_add_expert(cntrl_sub_tree
, pinfo
, &ei_btmesh_proxy_wrong_address_type
, de_cry_tvb
, decry_off
, 2);
259 case PROXY_FILTER_STATUS
:
260 proto_tree_add_item_ret_uint(cntrl_sub_tree
, hf_btmesh_proxy_control_filter_type
, de_cry_tvb
, decry_off
, 1, ENC_BIG_ENDIAN
, &filter_type
);
261 if (filter_type
> 1) {
262 proto_tree_add_expert(cntrl_sub_tree
, pinfo
, &ei_btmesh_proxy_unknown_filter_type
, de_cry_tvb
, decry_off
, 1);
266 proto_tree_add_item_ret_uint(cntrl_sub_tree
, hf_btmesh_proxy_control_list_size
, de_cry_tvb
, decry_off
, 2, ENC_BIG_ENDIAN
, &list_size
);
270 proto_tree_add_expert(cntrl_sub_tree
, pinfo
, &ei_btmesh_proxy_unknown_opcode
, de_cry_tvb
, decry_off
-1 , 1);
271 proto_tree_add_item(cntrl_sub_tree
, hf_btmesh_proxy_control_parameters
, de_cry_tvb
, decry_off
, enc_data_len
- 3, ENC_NA
);
272 decry_off
+= enc_data_len
- 3;
274 /* Still some octets left */
275 if (offset
- net_mic_size
!= decry_off
+ 7) {
276 proto_tree_add_expert(cntrl_sub_tree
, pinfo
, &ei_btmesh_proxy_unknown_payload
, de_cry_tvb
, decry_off
, -1);
283 dissect_btmesh_proxy_msg(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *proxy_data
)
286 proto_tree
*sub_tree
;
287 tvbuff_t
*next_tvb
= NULL
;
288 fragment_head
*fd_head
= NULL
;
289 uint32_t *sequence_counter_ptr
;
291 btle_mesh_transport_ctx_t tr_ctx
;
293 btle_mesh_proxy_ctx_t
*proxy_ctx
= NULL
;
295 DISSECTOR_ASSERT(proxy_data
);
296 proxy_ctx
= (btle_mesh_proxy_ctx_t
*)proxy_data
;
297 DISSECTOR_ASSERT(proxy_ctx
->proxy_side
< E_BTMESH_PROXY_SIDE_LAST
);
299 if (pinfo
->fd
->visited
&& first_pass
) {
301 for (int i
=0; i
< E_BTMESH_PROXY_SIDE_LAST
; i
++ ){
302 sequence_counter
[i
] = 0;
303 fragment_counter
[i
] = 0;
307 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "BT Mesh Proxy");
309 item
= proto_tree_add_item(tree
, proto_btmesh_proxy
, tvb
, offset
, -1, ENC_NA
);
310 sub_tree
= proto_item_add_subtree(item
, ett_btmesh_proxy
);
312 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_sar
, tvb
, offset
, 1, ENC_NA
);
313 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_type
, tvb
, offset
, 1, ENC_NA
);
315 uint8_t proxy_sar
= (tvb_get_uint8(tvb
, offset
) & 0xC0 ) >> 6;
316 uint8_t proxy_type
= tvb_get_uint8(tvb
, offset
) & 0x3F;
318 uint32_t length
= tvb_reported_length(tvb
) - offset
;
320 bool packet_reassembled
= false;
321 bool packet_completed
= false;
323 col_set_str(pinfo
->cinfo
, COL_INFO
, val_to_str_const(proxy_type
, btmesh_proxy_type
, "Unknown Proxy PDU"));
326 case PROXY_COMPLETE_MESSAGE
:
327 packet_completed
= true;
328 next_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, -1, tvb_captured_length(tvb
) - offset
);
329 col_append_str(pinfo
->cinfo
, COL_INFO
," (Complete)");
332 case PROXY_FIRST_SEGMENT
:
333 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data_fragment
, tvb
, offset
, length
, ENC_NA
);
334 sequence_counter
[proxy_ctx
->proxy_side
]++;
335 if (!pinfo
->fd
->visited
) {
336 fragment_counter
[proxy_ctx
->proxy_side
]=0;
338 fragment_add_seq(&proxy_reassembly_table
,
340 sequence_counter
[proxy_ctx
->proxy_side
], NULL
,
341 fragment_counter
[proxy_ctx
->proxy_side
],
342 tvb_captured_length_remaining(tvb
, offset
),
345 fragment_counter
[proxy_ctx
->proxy_side
]++;
347 col_append_str(pinfo
->cinfo
, COL_INFO
," (First Segment)");
350 case PROXY_CONTINUATION_SEGMENT
:
351 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data_fragment
, tvb
, offset
, length
, ENC_NA
);
352 if (!pinfo
->fd
->visited
) {
353 fragment_add_seq(&proxy_reassembly_table
,
355 sequence_counter
[proxy_ctx
->proxy_side
], NULL
,
356 fragment_counter
[proxy_ctx
->proxy_side
],
357 tvb_captured_length_remaining(tvb
, offset
),
359 fragment_counter
[proxy_ctx
->proxy_side
]++;
361 col_append_str(pinfo
->cinfo
, COL_INFO
," (Continuation Segment)");
364 case PROXY_LAST_SEGMENT
:
366 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data_fragment
, tvb
, offset
, length
, ENC_NA
);
367 if (!pinfo
->fd
->visited
) {
368 fragment_add_seq(&proxy_reassembly_table
,
370 sequence_counter
[proxy_ctx
->proxy_side
], NULL
,
371 fragment_counter
[proxy_ctx
->proxy_side
],
372 tvb_captured_length_remaining(tvb
, offset
),
374 fragment_counter
[proxy_ctx
->proxy_side
]++;
376 //add mapping "pinfo->num" -> "sequence_counter"
377 storage
= wmem_alloc0(pool
, sizeof(sequence_counter
[proxy_ctx
->proxy_side
]));
378 *((uint32_t *)storage
) = sequence_counter
[proxy_ctx
->proxy_side
];
379 wmem_tree_insert32(connection_info_tree
, pinfo
->num
, storage
);
381 packet_reassembled
= true;
382 col_append_str(pinfo
->cinfo
, COL_INFO
," (Last Segment)");
385 //No default since this is 2 bit value
388 if (packet_reassembled
|| packet_completed
) {
389 if (next_tvb
== NULL
) {
390 sequence_counter_ptr
= (uint32_t *)wmem_tree_lookup32(connection_info_tree
, pinfo
->num
);
392 if (sequence_counter_ptr
!= NULL
) {
393 fd_head
= fragment_get(&proxy_reassembly_table
, pinfo
, *sequence_counter_ptr
, NULL
);
396 next_tvb
= process_reassembled_data(tvb
, offset
, pinfo
,
397 "Reassembled Message", fd_head
, &btmesh_proxy_frag_items
,
399 col_append_str(pinfo
->cinfo
, COL_INFO
, " (Message Reassembled)");
406 tr_ctx
.transport
= E_BTMESH_TR_PROXY
;
407 if (packet_completed
) {
408 tr_ctx
.fragmented
= false;
410 tr_ctx
.fragmented
= true;
412 tr_ctx
.segment_index
= 0;
414 switch (proxy_type
) {
415 case PROXY_PDU_NETWORK
:
417 call_dissector(btmesh_handle
, next_tvb
, pinfo
, proto_tree_get_root(tree
));
419 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data
, next_tvb
, offset
, length
, ENC_NA
);
423 case PROXY_PDU_MESH_BEACON
:
424 if (btmesh_beacon_handle
) {
425 call_dissector_with_data(btmesh_beacon_handle
, next_tvb
, pinfo
, proto_tree_get_root(tree
), &tr_ctx
);
427 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data
, next_tvb
, offset
, length
, ENC_NA
);
431 case PROXY_PDU_CONFIGURATION
:
432 dissect_btmesh_proxy_configuration_msg(next_tvb
, pinfo
, sub_tree
, NULL
);
435 case PROXY_PDU_PROVISIONING
:
436 if (btmesh_provisioning_handle
) {
437 call_dissector_with_data(btmesh_provisioning_handle
, next_tvb
, pinfo
, proto_tree_get_root(tree
), &tr_ctx
);
439 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data
, next_tvb
, offset
, length
, ENC_NA
);
444 proto_tree_add_item(sub_tree
, hf_btmesh_proxy_data
, next_tvb
, offset
, length
, ENC_NA
);
450 return tvb_reported_length(tvb
);
454 proxy_init_routine(void)
456 for (int i
=0; i
< E_BTMESH_PROXY_SIDE_LAST
; i
++ ){
457 sequence_counter
[i
] = 0;
458 fragment_counter
[i
] = 0;
461 pool
= wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE
);
465 proxy_cleanup_dissector(void)
467 wmem_destroy_allocator(pool
);
472 proto_register_btmesh_proxy(void)
474 static hf_register_info hf
[] = {
475 { &hf_btmesh_proxy_type
,
476 { "Type", "btmproxy.type",
477 FT_UINT8
, BASE_DEC
, VALS(btmesh_proxy_type
), 0x3F,
480 { &hf_btmesh_proxy_sar
,
481 { "SAR", "btmproxy.sar",
482 FT_UINT8
, BASE_DEC
, VALS(btmesh_proxy_sar
), 0xC0,
485 { &hf_btmesh_proxy_data
,
486 { "Data", "btmproxy.data",
487 FT_BYTES
, BASE_NONE
, NULL
, 0x00,
490 { &hf_btmesh_proxy_data_fragment
,
491 { "Data Fragment", "btmproxy.data_fragment",
492 FT_BYTES
, BASE_NONE
, NULL
, 0x00,
495 //Proxy Payload Reassembly
496 { &hf_btmesh_proxy_fragments
,
497 { "Reassembled Proxy Payload Fragments", "btmproxy.fragments",
498 FT_NONE
, BASE_NONE
, NULL
, 0x0,
501 { &hf_btmesh_proxy_fragment
,
502 { "Proxy Payload Fragment", "btmproxy.fragment",
503 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
506 { &hf_btmesh_proxy_fragment_overlap
,
507 { "Fragment overlap", "btmproxy.fragment.overlap",
508 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
509 "Fragment overlaps with other fragments", HFILL
}
511 { &hf_btmesh_proxy_fragment_overlap_conflict
,
512 { "Conflicting data in fragment overlap", "btmproxy.fragment.overlap.conflict",
513 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
514 "Overlapping fragments contained conflicting data", HFILL
}
516 { &hf_btmesh_proxy_fragment_multiple_tails
,
517 { "Multiple tail fragments found", "btmproxy.fragment.multipletails",
518 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
519 "Several tails were found when defragmenting the packet", HFILL
}
521 { &hf_btmesh_proxy_fragment_too_long_fragment
,
522 { "Fragment too long", "btmproxy.fragment.toolongfragment",
523 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
524 "Fragment contained data past end of packet", HFILL
}
526 { &hf_btmesh_proxy_fragment_error
,
527 { "Defragmentation error", "btmproxy.fragment.error",
528 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
529 "Defragmentation error due to illegal fragments", HFILL
}
531 { &hf_btmesh_proxy_fragment_count
,
532 { "Fragment count", "btmproxy.fragment.count",
533 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
536 { &hf_btmesh_proxy_reassembled_length
,
537 { "Reassembled Proxy Payload length", "btmproxy.reassembled.length",
538 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
539 "The total length of the reassembled payload", HFILL
}
541 { &hf_btmesh_proxy_ivi
,
542 { "IVI", "btmproxy.ivi",
543 FT_UINT8
, BASE_DEC
, NULL
, 0x80,
546 { &hf_btmesh_proxy_nid
,
547 { "NID", "btmproxy.nid",
548 FT_UINT8
, BASE_DEC
, NULL
, 0x7f,
551 { &hf_btmesh_proxy_ctl
,
552 { "CTL", "btmproxy.ctl",
553 FT_UINT8
, BASE_DEC
, VALS(btmesh_proxy_ctl_vals
), 0x80,
556 { &hf_btmesh_proxy_ttl
,
557 { "TTL", "btmproxy.ttl",
558 FT_UINT8
, BASE_DEC
, NULL
, 0x7f,
561 { &hf_btmesh_proxy_seq
,
562 { "SEQ", "btmproxy.seq",
563 FT_UINT24
, BASE_DEC
, NULL
, 0x0,
566 { &hf_btmesh_proxy_src
,
567 { "SRC", "btmproxy.src",
568 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
571 { &hf_btmesh_proxy_dst
,
572 { "DST", "btmproxy.dst",
573 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
576 { &hf_btmesh_proxy_transport_pdu
,
577 { "Proxy Transport PDU", "btmproxy.transport_pdu",
578 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
581 { &hf_btmesh_proxy_netmic
,
582 { "ProxyNetMIC", "btmproxy.netmic",
583 FT_UINT64
, BASE_HEX
, NULL
, 0x0,
586 { &hf_btmesh_proxy_control_opcode
,
587 { "Opcode", "btmproxy.control.opcode",
588 FT_UINT8
, BASE_DEC
, VALS(btmesh_proxy_control_opcode
), 0x0,
591 { &hf_btmesh_proxy_control_parameters
,
592 { "Proxy Control Parameters", "btmproxy.control.parameters",
593 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
596 { &hf_btmesh_proxy_control_filter_type
,
597 { "Filter Type", "btmproxy.control.filter_type",
598 FT_UINT8
, BASE_DEC
, VALS(btmesh_proxy_control_filter_type
), 0x0,
601 { &hf_btmesh_proxy_control_list_size
,
602 { "List Size", "btmproxy.control.list_size",
603 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
606 { &hf_btmesh_proxy_control_list_item
,
607 { "List Item", "btmproxy.control.list_item",
608 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
613 static int *ett
[] = {
615 &ett_btmesh_proxy_network_pdu
,
616 &ett_btmesh_proxy_transport_pdu
,
617 &ett_btmesh_proxy_fragments
,
618 &ett_btmesh_proxy_fragment
,
621 static ei_register_info ei
[] = {
622 { &ei_btmesh_proxy_unknown_opcode
,{ "btmproxy.unknown_opcode", PI_PROTOCOL
, PI_ERROR
, "Unknown Opcode", EXPFILL
} },
623 { &ei_btmesh_proxy_unknown_payload
,{ "btmproxy.unknown_payload", PI_PROTOCOL
, PI_ERROR
, "Unknown Payload", EXPFILL
} },
624 { &ei_btmesh_proxy_wrong_ctl
,{ "btmproxy.wrong_ctl", PI_PROTOCOL
, PI_ERROR
, "Wrong CTL value", EXPFILL
} },
625 { &ei_btmesh_proxy_wrong_ttl
,{ "btmproxy.wrong_ttl", PI_PROTOCOL
, PI_ERROR
, "Wrong TTL value", EXPFILL
} },
626 { &ei_btmesh_proxy_wrong_dst
,{ "btmproxy.wrong_dst", PI_PROTOCOL
, PI_ERROR
, "Wrong DST value", EXPFILL
} },
627 { &ei_btmesh_proxy_unknown_filter_type
,{ "btmproxy.unknown_filter_type", PI_PROTOCOL
, PI_ERROR
, "Unknown Filter Type", EXPFILL
} },
628 { &ei_btmesh_proxy_wrong_address_type
,{ "btmproxy.wrong_address_type", PI_PROTOCOL
, PI_ERROR
, "Wrong Address Type", EXPFILL
} },
631 expert_module_t
* expert_btmesh_proxy
;
633 proto_btmesh_proxy
= proto_register_protocol("Bluetooth Mesh Proxy", "BT Mesh proxy", "btmproxy");
635 proto_register_field_array(proto_btmesh_proxy
, hf
, array_length(hf
));
636 proto_register_subtree_array(ett
, array_length(ett
));
638 expert_btmesh_proxy
= expert_register_protocol(proto_btmesh_proxy
);
639 expert_register_field_array(expert_btmesh_proxy
, ei
, array_length(ei
));
641 prefs_register_protocol_subtree("Bluetooth", proto_btmesh_proxy
, NULL
);
642 register_dissector("btmesh.proxy", dissect_btmesh_proxy_msg
, proto_btmesh_proxy
);
644 connection_info_tree
= wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
646 register_init_routine(proxy_init_routine
);
647 register_cleanup_routine(proxy_cleanup_dissector
);
648 reassembly_table_register(&proxy_reassembly_table
, &addresses_reassembly_table_functions
);
652 proto_reg_handoff_btmesh_proxy(void)
654 btmesh_handle
= find_dissector("btmesh.msg");
655 btmesh_provisioning_handle
= find_dissector("btmesh.provisioning");
656 btmesh_beacon_handle
= find_dissector("btmesh.beacon");
665 * indent-tabs-mode: nil
668 * vi: set shiftwidth=4 tabstop=8 expandtab:
669 * :indentSize=4:tabSize=8:noTabs=true: