Commit Graph

37 Commits

Author SHA1 Message Date
Inga Stotland
c0509b127a mesh: Helper packet print should depend on debug setting
This changes the utility function print_packet() to check if
daemon is running in debug mode.
2020-06-01 10:23:10 -07:00
Michał Lowas-Rzechonek
b31eee8907 mesh: Rename --index to --io, support additional io types.
This allows specifying io type and options when invoking the daemon.

When no "-i" is passed, meshd still runs with MESH_IO_TYPE_GENERIC and
tries to attach to the first available HCI interface.

Options "-i <n>" and "-i hci<n>" are just shortcuts for
"--io=generic:<n>" and "--io=generic:hci<n>", respectively.
2020-01-16 08:45:31 -08:00
Inga Stotland
4a1bea28b1 mesh: Add mesh-main.conf file with general mesh configuration
This adds key file with default settings for the mesh daemon.
The following settings are included:

    Beacon:          Default setting for to indicate whether
                     secure network beaconing is enabled for a
                     node whose Beacon state hasn't been configured
                     by a configuration client, i.e., this setting
                     apllies to a newly provisioned, created or
                     imported node.

    Relay:           Default setting for supporting relay

    Friendship:      Default setting for supporting Friendship

    CRPL:            Default depth of replay protection list.

    FriendQueueSize: Default size of friend queue: the number
                     of messages that each Friend node can store
                     for the Low Power node.

    ProvTimeout:     Provisioning timeout in seconds.
2019-12-16 14:52:36 -08:00
Inga Stotland
dcc46d4cee mesh: Fix io inititalization sequence
This introduces a chain of callbacks to indicate whether mesh io
is initialized and mesh network is ready to use.

This fixes the reported situation when the receive callbacks
were setup before the HCI was fully initialized. In other words,
BT_HCI_CMD_LE_SET_SCAN_PARAMETERS was called before BT_HCI_CMD_RESET
and, as the result, the callback issueing BT_HCI_CMD_LE_SET_SCAN_ENABLE
command was not called.
2019-11-15 09:23:16 -08:00
Marcel Holtmann
ba617285b8 mesh: Adjust for changed l_dbus_object_manager_enable parameters 2019-10-31 07:33:48 +01:00
Brian Gix
f62350b702 mesh: test AEAD at startup to check kernel support
One time test at startup to ensure either kernel version v4.9 or later,
*or* that required AES-CCM support has been back-ported. If support not
there, daemon will run without providing D-Bus service or attaching to
controllers (prevents systemd thrashing).
2019-09-01 08:34:00 -07:00
Michał Lowas-Rzechonek
12b984d1d4 mesh: Move HCI handling to mesh-io-generic
This patch separates 'mesh' module from 'mesh_io', particularly
regarding configuration and initialization.

Main code is no longer aware of MGMT and HCI usage - querying available
HCI interfaces now happens in mesh-io-generic.

MGMT code is now extracted into mesh-mgmt module, which mesh-io-generic
uses to query interfaces.
2019-06-24 09:04:44 -07:00
Inga Stotland
0f8cf75f62 mesh: Do not daemonize, run in foreground or as service
This removes call to daemon(). "--nodetach" option is retained
to set umask().

Also, adds description for dbus-debug option.
2019-06-06 11:58:31 -07:00
Inga Stotland
6df5c5e379 mesh: Remove unnecessary includes from .c files 2019-05-17 13:14:40 -07:00
Inga Stotland
00d7b3cbe5 mesh: Update init for D-Bus and multi-node support
This adds D-Bus initialization, modifications for mulitple nodes and
optional control of storage directory location.
2019-01-08 08:26:22 -08:00
Marcel Holtmann
261948090e build: Move declaration of _GNU_SOURCE back into individual source files 2018-12-06 21:28:18 +01:00
Marcel Holtmann
f0619047c2 mesh: Fix various compiler warnings 2018-12-03 19:54:33 +01:00
Brian Gix
d800a11512 mesh: Up-rev ELL dependancies to >= 0.14 2018-11-28 08:41:21 -08:00
Inga Stotland
a38796b18d mesh: Add start up management command chain
This allows co-existense of meshd and bluetoothd. meshd will
automatically take control of the first available LE-capable
controller that is powered down.
2018-09-06 12:38:17 -07:00
Inga Stotland
e594aefd3a mesh: Source files for mesh access layer and utilities
This adds initial implementation of BT Mesh access layer
functionality plus utilities.
2018-08-20 12:48:23 -07:00
Inga Stotland
f0d0c48e82 tools: Move meshctl tool under tools directory 2018-07-06 13:03:33 +02:00
ERAMOTO Masaya
fde2b0580e mesh: Return exit status for non-interactive 2018-03-29 15:42:24 +03:00
Inga Stotland
0a2a2b0c7f mesh/meshctl: Exit cleanly if start up fails
This addresses the following issue: if the program exits
after bt_shell_init() has been called, but prior to calling
bt_shell_run() (e.g., failing to start meshctl due to invalid
input configuration), the original shell is messed up after that.
Calling bt_shell_cleanup() on faiure fixes this.
2018-03-27 13:59:16 +03:00
Atul Rai
1c1f807c30 Mesh: Close net session on device disconnection
On device disconnection, net session is not closed. On next
attempt to provision/connect a device, net session proxy is
not updated by net_session_open() as proxy_in is not NULL.
This causes meshctl to use invalid proxy resulting in below
crash.

0  strlen () at ../sysdeps/x86_64/strlen.S:106
1  0x00007f3a3c8b1ac4 in _dbus_string_init_const () from libdbus-1.so.3
2  0x00007f3a3c89ed15 in ?? () from libdbus-1.so.3
3  0x00007f3a3c89fba0 in dbus_message_new_method_call () from libdbus-1.so.3
4  0x0000000000419880 in g_dbus_proxy_method_call at gdbus/client.c:997
5  0x000000000040ab9d in mesh_gatt_write at mesh/gatt.c:347
6  0x000000000040d761 in send_mesh_pkt at mesh/net.c:1227
7  send_seg at mesh/net.c:1325
8  0x000000000040fa60 in net_access_layer_send at mesh/net.c:2163
9  0x0000000000413c74 in config_send at mesh/config-client.c:418
10 0x0000000000414886 in cmd_composition_get at mesh/config-client.c:470
11 0x000000000041ffd9 in cmd_exec at src/shared/shell.c:356
12 menu_exec at src/shared/shell.c:383
13 0x00000000004203a5 in shell_exec at src/shared/shell.c:426
14 0x0000000000420d24 in rl_handler (input=0x2259aa0 "composition-get ")
at src/shared/shell.c:571
15 0x00007f3a3c45d6f5 in rl_callback_read_char () from libreadline.so.6
16 0x0000000000420229 in input_read at src/shared/shell.c:1034
17 0x0000000000421655 in watch_callback at src/shared/io-glib.c:170
18 0x00007f3a3cb1a04a in g_main_context_dispatch () from libglib-2.0.so.0
19 0x00007f3a3cb1a3f0 in ?? () from libglib-2.0.so.0
20 0x00007f3a3cb1a712 in g_main_loop_run () from libglib-2.0.so.0
21 0x0000000000421bf5 in mainloop_run () at src/shared/mainloop-glib.c:73
22 0x000000000042115a in bt_shell_run () at src/shared/shell.c:962
23 0x0000000000405c5d in main at mesh/main.c:1992
2018-03-18 10:43:12 +02:00
Luiz Augusto von Dentz
480ff6961d mesh: Fix lines going beyond 80 columns 2018-03-01 12:21:04 +02:00
ERAMOTO Masaya
3b4008d00c mesh: Use g_dbus_dict_append_{entry,array}() 2018-03-01 10:49:05 +02:00
Luiz Augusto von Dentz
5d24fe74da mesh/meshctl: Quit when done with command
This ensures that the commands don't stay hanging since bt_shell no
longer quits immediatelly after executing a command.
2018-02-28 16:17:13 +02:00
Steve Brown
b80e4f58f6 mesh: meshctl: Correct display security
The case of a security command without an argument is not handled
and throws a segv.
2017-12-25 21:05:35 +02:00
Luiz Augusto von Dentz
7a03b61ee8 tools: Remove monitor/uuid.{c,h}
Use the shared/util.h helpers instead.
2017-12-21 10:08:22 -02:00
Luiz Augusto von Dentz
d1f9544681 mesh: Remove cmd_scan
cmd_scan is only used internally by discover-unprovisioned.
2017-12-08 13:06:21 +02:00
Luiz Augusto von Dentz
f11a25d42d mesh: Rework set_scan_filter_uuids parameters
set_scan_filter_uuids is not a command handler which means it doesn't
need to take argc and argv instead just pass the filter array.
2017-12-08 13:06:20 +02:00
Luiz Augusto von Dentz
7c16c4044d shell: Add bt_shell_opt
Make use of struct option and getopt_long to parse the options given.
2017-12-08 13:06:19 +02:00
Luiz Augusto von Dentz
fc53175b8a mesh: Make meshctl use bt_shell helpers
This makes meshctl use bt_shell to manage the menus and command
handling.
2017-12-08 13:06:12 +02:00
Steve Brown
cb1c2622fa mesh: meshctl add Node Identity option to connect command
This adds the option to connect via either Node Identity or Network ID
advertisements. Adding the node unicast address selects Node Identity.

See Mesh Profile Specification 7.2.2.2 for further details.
2017-12-04 19:51:26 +02:00
Luiz Augusto von Dentz
a446569b86 mesh: Add 'security' command
This adds 'security' command which can be used to display and change
the provision security level:

[meshctl]# security
Provision Security Level set to 1 (medium)
[meshctl]# security 2
Provision Security Level set to 2 (high)

Note: This doesn't change the default which is still medium.
2017-09-14 11:22:24 +03:00
Inga Stotland
9c2c9d3c71 mesh: Add characteristic property name check
If PropertyChanged signal is not emitted due to a change in
characteristic's "Value" property, the characteristic does
not need to be processed.
2017-09-11 16:02:12 +03:00
Łukasz Rymanowski
a75b37a476 mesh: Typo fix 2017-09-04 14:57:36 +03:00
Łukasz Rymanowski
22d943a798 mesh: Fix for handling unprovisioned device
If there is no ServiceData there is no valid provisioning data for
PB-GATT
2017-09-04 14:57:32 +03:00
Luiz Augusto von Dentz
a5b844cb8f mesh: Use DuplicateData filter
Also use the term duplicate instead of reset to make it more clear
the intent of the filter.
2017-08-30 14:59:55 +03:00
Luiz Augusto von Dentz
e5562190af mesh: Make use of rl_prompt_input
This removes unnecessary code to ask user input which is already
supported by rl_prompt_input.
2017-08-28 13:54:24 +03:00
Marcel Holtmann
8e96790482 mesh: Fix includes to use root relative path names 2017-08-21 13:40:03 +02:00
Brian Gix
9b92507843 mesh: Baseline Mesh implementation 2017-08-21 12:40:35 +02:00