Bluetooth: host: Device name handling of invalid length

Add a build assert if the device name has been misconfigured. The device
name has a max length of 248. When configured as dynamic make sure that
the initial device length can fit in the dynamic max length.
This prevents us from having to handle length overflow when setting
device name in advertising data which has an 8-bit length field.

Log a warning if failing to set the device name in bt_enable.
Remove unused defines in the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2021-08-20 09:40:42 +02:00 committed by Christopher Friedt
commit d76bba4b5e
2 changed files with 11 additions and 4 deletions

View file

@ -36,9 +36,6 @@
#include "ll.h"
#include "hci.h"
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
/* Multiply bt 1.25 to get MS */
#define BT_INTERVAL_TO_MS(interval) ((interval) * 5 / 4)