Commit Graph

50 Commits

Author SHA1 Message Date
Martin Mathieson ed8ee831fd More fussing with items and calls. 2023-01-31 17:32:05 +00:00
Piotr Winiarczyk d5a0d390e8 btmesh: More information displayed
In some cases the available information on packets were not displayed.
This change displays this information. Some code formatting and
variable renaming was also done.
2022-05-09 18:44:23 +00:00
John Thacker b80cdaa243 libgcrypt: Require version 1.8.0
Libgcrypt 1.8.x is required for a large amount of decryption
support and is the current LTS version of libgcrypt. The 1.6 and
1.7 series have been end-of-life since 2017-06-30 and 2019-06-30,
respectively.

The Linux distributions that have versions of libgcrypt before 1.8.0
are nearing or at end of support (RHEL7, SLES 12, Debian stretch,
Ubuntu 16.04LTS) and can be supported by the Wireshark 3.6 LTS release
series.

Remove an enormous amount of ifdefs based on libgcrypt versions
1.6.0, 1.7.0, and 1.8.0. There will be a second pass for the
commons defines HAVE_LIBGCRYPT_AEAD, HAVE_LIBGCRYPT_CHACHA20, and
HAVE_LIBGCRYPT_CHACHA20_POLY1305, which are now always defined.

The ISAKMP dissector has some comments noting that some workarounds
were used for libgcrypt 1.6 that aren't needed with 1.7; perhaps
that could be updated now.
2022-04-20 21:30:21 -04:00
Lin Sun 5da3992c8e BT Mesh: Fix build error when GCRYPT_VERSION_NUMBER >= 0x010600 is false 2022-01-14 10:01:34 +00:00
João Valverde 0ccd69e530 Replace g_strdup_printf() with ws_strdup_printf()
Use macros from inttypes.h.
2021-12-19 21:21:58 +00:00
João Valverde 22ee2764a7 Replace g_snprintf() with snprintf() (dissectors)
Use macros from inttypes.h with format strings.
2021-12-19 20:25:11 +00:00
Jaap Keuter adbaced04c Dissectors should not include stdio.h, unless needed 2021-12-05 12:45:46 +00:00
Piotr Winiarczyk 5d4eb4bc66 btmesh: Add dissectors of sensors opcodes
Add dissectors of sensors and generic properites from Mesh Models document. All opcodes from Mesh Models 1.0.1 are now dissected, but not all Mesh Properties are dissected. Closes #17734.
2021-11-30 08:15:29 +00:00
Lin Sun fdd1a82ed9 packet-btmesh: fix build without GCRYPT 2021-10-11 19:10:41 +00:00
Piotr Winiarczyk 4661e1ddd9 btmesh: improve scheduler dissection
Add better month and week of day dissections for three messages.
2021-10-05 04:26:10 +00:00
Martin Mathieson fee630dbdc Fix the lengths of some masks. 2021-09-22 09:38:09 +01:00
Piotr Winiarczyk bf55ff9b47 btmesh: Add mesh models lighting opcodes dissector
Add all mesh models lighting opcodes dissector (chapter 6 of Mesh Models document). Closes #17578.
2021-09-21 14:07:06 +00:00
João Valverde 5f79503d67 Fix config.h include order
The header "config.h" needs to be the first header included in the
source file, no exceptions.
2021-09-20 20:16:52 +01:00
Guy Harris e3d93143c8 btmesh: don't provide stub custom field formatting routines.
Use the non-stub versions even if we don't have libgcrypt 1.6.0 or
newer; yes, it's code that won't ever be used, but if you want to
eliminate waste, remove all the fields that aren't used if we don't have
libgcrypt 1.6.0 or later.

This avoids the need to create stub routines, making the code a bit less
confusing (and avoiding the risk of using those fields with
non-functional formatting routines).

It also eliminates "function argument unused" warnings when building
with an older version of libgcrypt, and does so more cleanly than adding
a bunch of _U_s to the stub functions.
2021-08-24 00:40:50 -07:00
Piotr Winiarczyk 74424dddfc btmesh: Add dissectors of scheduler and time opcodes
Add dissectors of some opcodes for Scheduler (5.2.3 Scheduler messages) and Time (5.2.1 Time messages) from Mesh Models document. Closes #17511
2021-08-02 23:46:05 +00:00
Piotr Winiarczyk c8ac8e7407 btmesh: Fix for crash in UAT CBs
Fixing crashes in UAT callbacks. Adding various format checks. Closes #17460.
2021-06-30 12:37:41 +00:00
Piotr Winiarczyk 6846271b76 btmesh: Enhanced messages reassembly
This commit adds enhanced messages reassembly for access and control
message. Closes #17417.
2021-06-04 08:40:31 +00:00
Piotr Winiarczyk f7c6d2e9e5 btmesh: Add dissectors of some generic opcodes
Add dissectors of some opcodes from Mesh Models document. Closes #17402
2021-05-20 11:08:43 +00:00
Piotr Winiarczyk 91d21fc334 btmesh: Fix typo in PDU name
The Light Lightness Get is the proper name for the PDU 0x824B
2021-04-24 09:02:31 +02:00
Moshe Kaplan e16166a74c Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing
occurrences of `g_malloc()` and `wmem_alloc()` with
`g_new()` and `wmem_new()`, to improve the
readability of Wireshark's code, and
occurrences of
`g_malloc(sizeof(struct myobj) * foo)`
with
`g_new(struct myobj, foo)`
to prevent integer overflows

Also fixes all existing occurrences across
the codebase.
2020-12-22 14:56:38 +00:00
Martin Mathieson fc64ba242a More dissector spelling fixes. 2020-09-24 16:40:51 +00:00
Yehonatan Zecharia d75ebf1139 Move btmesh frag items inside gcrypt version #if 2020-08-24 17:10:31 +00:00
Anders Broman 1484c1e7f6 Fix Wpointer-sign warnings.
Change-Id: Ia51998293b967f363856d2b9ac92f498a9f54d76
Reviewed-on: https://code.wireshark.org/review/37769
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-07 18:42:07 +00:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Moshe Kaplan fd7895d37c Replace instances of wmem_alloc with wmem_new
This commit replaces instances of
  (myobj *)wmem_alloc(wmem_file_scope(), sizeof(myobj))
and replaces them with:
  wmem_new(wmem_file_scope(), myobj)
to improve the readability of Wireshark's code.

The replacement locations were identified with grep
and replaced with the Python script below.

grep command:
  egrep "wmem_alloc0?\(wmem_file_scope\(\), sizeof\([a-z_]+\)\)" . -R -l

python script:

import re
import sys
import fileinput

pattern = r'\(([^\s]+) ?\*\) ?wmem_alloc(0?)\((wmem_[a-z]+_scope\(\)), sizeof\(\1\)\)'
replacewith = r'wmem_new\2(\3, \1)'

fname = sys.argv[1]

for line in fileinput.input(fname, inplace=1, mode='rb'):
    output = re.sub(pattern, replacewith, line)
    sys.stdout.write(output)

Change-Id: Ieac246c104bf01e32cbc6e11e53e81c7f639d870
Reviewed-on: https://code.wireshark.org/review/37158
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-05-07 14:47:54 +00:00
Alexis La Goutte dc6fc9bfc3 btmesh: fix typo (Accesss => Access)
Change-Id: I17b94100139d3262315cb42b66fc245ade82224b
Reviewed-on: https://code.wireshark.org/review/36544
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-23 10:52:27 +00:00
Pedro Malagon eab718e8d0 BTMesh: Add support for manufacturer-specific opcodes
Access Layer: add support for manufacturer-specific opcodes (customizable)
of 3-octets when bits 7 and 6 of the first opcode octet are set,
as specified in Table 3.43: Opcode formats of document
Mesh Profile v1.0.1, Bluetooth Specification

Change-Id: I3edf8f86bf58d28f15cc2a8f72618cc577a75a44
Reviewed-on: https://code.wireshark.org/review/34787
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-18 03:44:22 +00:00
Dario Lombardo 7cb77f5ca7 btmesh: fix indentation.
Change-Id: I34dd4c34668fab717e7fdec0ceaee8ef2359c339
Reviewed-on: https://code.wireshark.org/review/33462
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-06-04 14:10:02 +00:00
Dario Lombardo 690f0f4d24 btmesh: fix compilation with older gcrypt version.
Fix compilation on Centos.

Change-Id: Id51b6681d01e65e6a46ca4a62663c3b4e01669da
Reviewed-on: https://code.wireshark.org/review/33463
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-06-04 14:09:30 +00:00
Piotr Winiarczyk 32aeca13ec BTMESH: Add dissector for Foundation models
Add dissector for all messages of Bluetooth Mesh Foundation models.

Bug: 15797
Change-Id: Ife831fe24bbbcaf2e99c9bff69b24c0d4fe2d1de
Reviewed-on: https://code.wireshark.org/review/33361
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jonas Jonsson <jonas@ludd.ltu.se>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-03 15:40:58 +00:00
Joakim Karlsson 41813ba202 BTMESH: fix unused compile error without/older GCrypt
Change-Id: Ic9f9e323420bf6add83c7a8f7b56a6206eeb2c67
Reviewed-on: https://code.wireshark.org/review/33295
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-21 13:39:26 +00:00
Gerald Combs 8e3b16ffe2 BT Mesh: Mark a couple of unused parameters.
Change-Id: I4a6204bc7fef6ab2dccc06d2df334daa710c5c52
Reviewed-on: https://code.wireshark.org/review/33115
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-05-08 18:34:35 +00:00
Piotr Winiarczyk 47f58d32c5 BTMESH: Fix for compilation without GCrypt
Fix for compilation on platforms without GCrypt library.

Change-Id: I049f7d60f3b65f713ee3e43f62361790901982a6
Reviewed-on: https://code.wireshark.org/review/33113
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-08 16:41:35 +00:00
Dario Lombardo 6d160dad2d btmesh: fix compilation with older gcrypt versions.
Fix compilation on Centos:
epan/dissectors/packet-btmesh.c: In function 'uat_btmesh_record_update_cb':
epan/dissectors/packet-btmesh.c:2057:9: error: implicit declaration of function 'k4' [-Werror=implicit-function-declaration]
         if (k4(rec)) {
         ^
epan/dissectors/packet-btmesh.c: In function 'uat_btmesh_label_uuid_record_update_cb':
epan/dissectors/packet-btmesh.c:2198:9: error: implicit declaration of function 'label_uuid_hash' [-Werror=implicit-function-declaration]
         if (label_uuid_hash(rec)) {
         ^
cc1: some warnings being treated as errors
[224/2387] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-btmesh-pbadv.c.o
ninja: build stopped: subcommand failed.

Change-Id: I0ffbce46285c7883f3ef604d06fad3a94b2197cd
Reviewed-on: https://code.wireshark.org/review/33108
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-08 13:51:38 +00:00
Piotr Winiarczyk 5ad40e0cd0 BTMESH: Add access layer decryption
Add access layer Application Key decryption
Add access layer Device Key decryption
Add Label UUID authentication
Add list of all opcodes

Bug: 15761
Change-Id: I290c6a4f2f990ccfa58701b7183a41afcc6e92c8
Reviewed-on: https://code.wireshark.org/review/33093
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-07 15:28:35 +00:00
Piotr Winiarczyk 4828e45432 BTMESH: Adding defragmentation of messages
Adding defragmentation of control and access layer messages.
Adding dissection of Friend Update and Heartbeat control messages.

Bug: 15722
Change-Id: Ib6d8899a2d089dfa3b3eee6cd3e5248b8dc26aff
Reviewed-on: https://code.wireshark.org/review/32948
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-25 03:46:17 +00:00
Jim Young 5d71a8560c Stub version of dissect_btmesh_msg() missing _U_.
Change-Id: I4d7cb901c657df8d351305ba4f411d4776b2dc6a
Reviewed-on: https://code.wireshark.org/review/32393
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-13 04:26:40 +00:00
Piotr Winiarczyk e3ae91e4c6 btmesh: Adding support Proxy Protocol control messages
Added support for Bluetooth Mesh Proxy protocol control messages
Refactoring and fixing Bluetooth Mesh network decryption so it can be
reused to decrypt proxy control messages

Link to Bluetooth Mesh Profile specification
https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=457092

Bug: 15583
Change-Id: I04ca16dc91ce43d27416ee2eb18ac81ef4aef1c6
Reviewed-on: https://code.wireshark.org/review/32368
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-12 11:36:18 +00:00
Piotr Winiarczyk a8df0c0e13 Expanding Bluetooth Mesh Profile dissector
Added support for Bluetooth Mesh beacons
Added support for Bluetooth Mesh Provisioning protocol
Added support for Bluetooth Mesh Proxy protocol
Added support for Bluetooth Mesh PB-ADV provisioning bearer
Added support for Bluetooth Mesh PB-GATT provisioning bearer

Link to Bluetooth Mesh Profile specification
https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=457092

Bug: 15523
Change-Id: I408726c0bc7e1d81077539d451c2047f540dd865
Reviewed-on: https://code.wireshark.org/review/32076
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-20 06:10:52 +00:00
Stig Bjørlykke 469d7bf9d9 btmesh: Fix memleaks in UAT handling
Free allocated strings before allocating new and in free callback.

Change-Id: If7bd0ee8455cf3c3e0c6300ce79e20557256eb8e
Reviewed-on: https://code.wireshark.org/review/31773
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-01-29 07:40:51 +00:00
Gerald Combs 8f08a4e74e Try to discourage the use of APIs via counting.
Add the ability to specify maximum function counts for each group to
checkAPIs. Add maximum counts for the "termoutput" and "abort" groups
where needed. Show summaries in various checkAPI targets.

Switch uses of ws_g_warning back to plain g_warning.

Change-Id: I5cbddc8c671729e424eed8551f69116d16491976
Reviewed-on: https://code.wireshark.org/review/29721
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-19 16:07:03 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Stig Bjørlykke 29798bb8c9 bluetooth: Group Bluetooth dissector preferences
Change-Id: Ib5360fcbfd8f6b2aee6b33ec7d9dc77362feb50e
Reviewed-on: https://code.wireshark.org/review/25162
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-06 14:30:10 +00:00
Anders f71b148edd [BTMESH] Dissect more of Upper transport Layer.
Change-Id: I5d33c64a57689939c9915336701accba8b893415
Reviewed-on: https://code.wireshark.org/review/25115
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-03 10:10:20 +00:00
Graham Bloice 1fa22c2ee9 btmesh: replace\convert g_warning
Replace g_warning with ws_g_warning, add expert info.

Change-Id: I54ae5959f89ee85bdd821f07af8cf4ec3172748e
Reviewed-on: https://code.wireshark.org/review/25090
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2017-12-31 18:15:43 +00:00
João Valverde 129cb60f56 Remove unused dissector registration prototypes, fix typo
Change-Id: Ide5d7f2241db4ac87ed516f91f0bcaca347bb546
Reviewed-on: https://code.wireshark.org/review/24496
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-20 05:34:00 +00:00
Alexis La Goutte ff302a283d btmesh: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I7218d74e1dc4d014dadd86f55b7805ba1581f9c3
Reviewed-on: https://code.wireshark.org/review/24346
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-11 15:43:49 +00:00
Stig Bjørlykke 428b354f0d btmesh: Remove a debug g_warning
Change-Id: Ifc822efccfff5de32a54ca1f148a09ac3be4d0e3
Reviewed-on: https://code.wireshark.org/review/24308
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 21:04:30 +00:00
Stig Bjørlykke 1a3bd52e91 btmesh: Fix building without gcrypt
Change-Id: If77b36d764c07acd87a553134cebff246b8368fe
Reviewed-on: https://code.wireshark.org/review/24296
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2017-11-08 10:56:36 +00:00
Anders 1e707e33fa [BT Mesh] Add Bluetooth Mesh dissector.
Bug: 14161

Change-Id: Ia76d283c6c8e00526948a0ee9cda9e35b4ca0e2a
Reviewed-on: https://code.wireshark.org/review/24216
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-06 23:36:10 +00:00