summaryrefslogtreecommitdiff
path: root/mesh
Commit message (Collapse)AuthorAgeFilesLines
* mesh: Update the behavior of --io optionInga Stotland2023-05-126-37/+40
| | | | | | | | | | | | | | | This aligns the behavior of command line option --io to add new "auto" value and modify the behavior of "generic" value: *auto* - Use first available controller: via MGMT interface if kernel supports it, otherwise, via raw HCI socket (i.e., default to *generic*). *generic:[hci]<index>* - Use generic HCI io on interface hci<index> The default value is now *auto*, whereas *generic* is used only if the specific HCI controller is explicitly specified.
* mesh: Tighten IO and fix out-of-bounds array accessInga Stotland2023-04-036-160/+50
| | | | | | | This fixes the out-of-bounds array access in mesh-io-mgmt.c caught by address sanitizer. Similar fixes were applied earlier to generic and unit IOs. With this patch, the common code is factored into a centralized location.
* mesh: On exit free timer for filtering duplicatesInga Stotland2023-03-201-1/+5
| | | | | This frees resources associated with duplicate filter timer when destroying management IO.
* mesh: Don't send Prov Failed on non-existant linksBrian Gix2023-03-151-2/+4
| | | | | | If remote device does not respond to a Prov Link Open request, then the callbacks do not get established, and attempting to send Failure messages on the non-existent link rersult in seg fault.
* mesh: Make MGMT mesh-io less noisyBrian Gix2023-03-151-3/+3
| | | | Remove excessive logging traffic
* mesh: Filter originated Provisioning Data packetsBrian Gix2023-03-151-11/+47
| | | | | | | The mesh daemon can process incoming mesh packets on more than one controller, but if a Provisioning data packet that originated from the local daemon is received by a different controller, it must be filtered and disregarded, or it will break the provisioning protocol.
* mesh: Loopback unprovisioned beaconsBrian Gix2023-03-142-7/+69
| | | | | | | | | | Because the daemon explicitly supports multiple nodes, we need local Config Clients to be able to see local unprovisioned devices. This loops the unprovisioned beacon, so that local Provisioning servers can see it. Fixes Issue: https://github.com/bluez/bluez/issues/341
* mesh: Fix uninitialized memory usageBrian Gix2023-03-141-1/+1
| | | | | When attempting to cancel an unknown Scan request structure must be NULL initialized.
* mesh: Fix node when loading from storageInga Stotland2023-03-121-3/+9
| | | | | | | | | This fixes adding mandatory models (config server, remote provisioner) to a node whose configuration is being loaded from storage: mesh_model_add() was called with a wrong argument. Was: mesh_model_add(..., PRIMARY_ELE_IDX, ...); Correct: mesh_model_add(..., ele->models, ...);
* mesh: Remove unused byte swap for ScanBuildBrian Gix2023-01-301-7/+0
|
* mesh: Fix Checksmatch warningBrian Gix2023-01-301-1/+1
|
* mesh: Switch beaconing net keyBrian Gix2023-01-301-0/+16
| | | | | | When transitioning from Phase 1 to Phase 2 of a network key and we are beaconing, we need to halt the beaconing on the old key version, and begin beaconing on the new key version.
* mesh: Add internal Mesh Private Beacon modelBrian Gix2023-01-306-10/+86
| | | | | Adds recgnition that the Mesh Private Beacon model is internal and foundational, without bindings.
* mesh: Add Tx/Rx support of Mesh Private BeaconsBrian Gix2023-01-305-174/+519
| | | | | | | With this change, we start evaluating received Mesh Private Beacons in addition to the legacy Secure Network Beacons. We also add the ability to request Tx of Mesh Private Beacons, which are regenerated with new Random Nonce a minimum of every 0 - 2550 seconds.
* mesh: Add Mesh Private Beacon serverBrian Gix2023-01-302-0/+159
| | | | | | This initial server supports only the Mesh Private Beacon and returns "Not Suppoerted" for Get/Set of Private GATT Proxy and Private Node Identity beacons.
* mesh: Add storage of Mesh Private Beacon settingsBrian Gix2023-01-302-0/+54
| | | | | If current storage does not exist in node.json, the Mesh Private Beacon will be disabled.
* mesh: Rename parameter list per crypto usageBrian Gix2023-01-302-3/+3
| | | | | The derived key generated by the "nkpk" salt and network master key is used to create Private Beacons as of Mesh Profile Specification v1.1
* mesh: Add Remote ProvisioningBrian Gix2023-01-3017-367/+2244
| | | | | | | | Add Remote Provisioning Server Add Remote Provisioning Client Remove local scanning/provisioning Add delete-all dev key function Add NPPI procedures
* mesh: Keep cancelled SAR data for at least 10 secIsak Westin2022-10-121-5/+26
| | | | | | | When a SAR transmission has been completed or cancelled, the recipent should store the block authentication values for at least 10 seconds and ignore new segments with the same values during this period. See MshPRFv1.0.1 section 3.5.3.4.
* mesh: Fix msg cache ring bufferIsak Westin2022-10-071-2/+1
| | | | | The message cache should be a strict ring buffer, suppressed message should not move to the front of the queue.
* mesh: provisionee: Check prov start parametersIsak Westin2022-10-061-11/+46
| | | | | Verify that all parameters in a Provisioning Start PDU are valid, also compared to the capabilities that has been sent.
* mesh: provisionee: Handle failed provisioningIsak Westin2022-10-061-1/+6
| | | | | | When a provisioning fails, all additionally received PDU should be unexpected until link is closed by provisioner. See MshPRFv1.0.1 section 5.4.4.
* mesh: provisionee: Handle unknown PDUsIsak Westin2022-10-061-2/+7
| | | | | If an unknown PDU is received during provisioning, the provisioning should fail with "Invalid PDU".
* mesh: Update Key Refresh flag after provisionIsak Westin2022-10-061-2/+2
| | | | | The Key Refresh flag in the Secure Network beacon is now correctly updated based on provisioning data after being successfully provisioned.
* mesh: Always relay messages from Low Power nodesIsak Westin2022-10-061-11/+36
| | | | | | | If we receive a message from one of our Low Power nodes, which is encrypted using frendship credentials and where the destination is not us, we must relay that message using master credentials. See MshPRFv1.0.1 section 3.6.6.2.
* mesh: Queue a friend update on IV Update changeIsak Westin2022-10-061-0/+1
| | | | | A friend update should be queued when we receive a Secure Network beacon that changes the IV Update state.
* mesh: Verify padding bits in Friend Poll messagesIsak Westin2022-10-061-1/+1
| | | | | The padding bits in a Friend Poll message must be zero. See MshPRFv1.0.1 section 3.6.5.1.
* mesh: Correct size of friend cacheIsak Westin2022-10-061-1/+1
| | | | | The cache size communicated to the Low Power node should be the same as the cache size actually used.
* mesh: Fix mesh to work with MESH_IO_TYPE_UNIT_TESTInga Stotland2022-10-052-2/+8
| | | | | | | This fixes mesh io flow for MESH_IO_TYPE_UNIT_TEST which got broken after: commit 9966cb8b6999a5f54fc13acbd7e1526512a84342 ("mesh: Add new kernel MGMT based IO transport")
* mesh: Allow Key Refresh Phase 0 to 3 transitionIsak Westin2022-10-031-0/+4
| | | | | Transition to Phase 3 from Phase 0 does not cause any state change, but is a valid transition. See MshPRFv1.0.1 section 4.2.14.
* mesh: Allow Key refresh to skip Phase 2Isak Westin2022-10-031-2/+3
| | | | | | If we are in Key Refresh Phase 1, and receive a Secure Network beacon using the new NetKey and with KR flag set to 0, Phase 2 should be skipped. See MshPRFv1.0.1 section 3.10.4.1.
* mesh: Ignore SNB with invalid IV Index valuesIsak Westin2022-10-031-0/+4
| | | | | | If we are in IV update in progress state, and receive a Secure Network beacon with an IV index equal to last known IV index + 1, and IV update flag set to 1, it should be ignored. See MshPRFv1.0.1 section 3.10.5.
* mesh: Ignore Secure Network Beacon from subnetIsak Westin2022-10-031-1/+12
| | | | | | | If this node is a member of a primary subnet and receives a Secure Network beacon on a secondary subnet with an IV Index greater than the last known IV Index of the primary subnet, the Secure Network beacon shall be ignored. See MshPRFv1.0.1 section 3.10.5.
* mesh: Clear HB sub status field if disabledIsak Westin2022-09-261-2/+24
| | | | | | When replying to a HB subscription get message, and the current state of source or destination fields is zero (which means that HB subscription is disabled), all fields in the status reply should be zero.
* mesh: Correct HB sub state updatesIsak Westin2022-09-262-17/+5
| | | | | | | | | If heartbeat subscription is disabled, all fields should be set to zero but collected data should be preserved. If HB subscription is enabled, the collected data should be reset (which includes Min Hops = 0x7f). HB subscription is disabled by setting any of the following fields to zero: Source, destination or period log. HB subscription is enabled by setting all the same fields to valid values.
* mesh: Reply to HB pub set with same fieldsIsak Westin2022-09-261-1/+11
| | | | | | If a Config Heartbeat Publication Set message is unsuccessfully processed, the fields in the status reply should be the same as in the original message. See MshPRFv1.0.1 section 4.4.1.2.15.
* mesh: Correct u32 to u8 log transformationIsak Westin2022-09-261-4/+4
| | | | | Fixed the log transformation to correctly follow the value mapping defined in the mesh profile (section 4.1.2).
* mesh: Add new kernel MGMT based IO transportBrian Gix2022-09-2612-136/+1150
| | | | | | | | | | | 1. Re-structures MGMT handling such that it is used to detect kernel support of the mesh MGMT opcodes and events before selecting between using MGMT or the legacy raw HCI socket method. 2. Re-structures main() to allow command line to prefer MGMT over HCI or visa versa, plus optionally pass an explicte controller. 3. Adds mesh-io-mgmt as a transport.
* mesh: Improve PB-ADV timing for reliabilityBrian Gix2022-09-261-3/+6
| | | | | | Because provisioning is not speed dependent, Timing on outbound PB-ADV packets have been modified to be less likely missed by remote controlers with looser timing capabilities.
* mesh: Reply error if appkey added for wrong netkeyIsak Westin2022-09-231-1/+3
| | | | | If a known appkey is added for a different netkey, the status reply should be Invalid NetKey.
* mesh: Clear addr field if virt sub failedIsak Westin2022-09-231-0/+4
| | | | | | If processing failed for a Config Model Subscription Virtual Address Add/Delete/Overwrite message, the address field in the status reply should be set to zero. See MshPRFv1.0.1 section 4.4.1.2.8.
* mesh: Remove RFU check for publication setIsak Westin2022-09-221-2/+0
| | | | | | | It is not stated in the mesh profile that the RFU bits in a Model Publication Set message have to be zero. In fact, PTS test MESH/NODE/CFG/MP/BV-01-C is sending that command with non-zero RFU and expects a reply.
* mesh: Do not accept publication for unbound appkeyIsak Westin2022-09-221-1/+2
| | | | | If a user tries to configure publication of a model with an appkey that is not bound to that model, an error should be returned.
* mesh: Add interface output filterIsak Westin2022-09-221-0/+28
| | | | | According to the mesh profile (3.4.5.2), if TTL is set to 1 for an outgoing message, that message shall be dropped.
* mesh: Fix potential memory leakBrian Gix2022-09-221-1/+3
| | | | | | This memory leak will never happen, however since we added a new return from function that malloc'd memory, the free should still be done.
* mesh: Fix snprintf return values not being checkedBrian Gix2022-06-301-31/+57
| | | | | Some versions of the GCC compiler complain when the return value of snprintf is not checked. This patch cleans up the Mesh JSON parser.
* mesh: Use correct net_id for received CTL messagesIsak Westin2022-06-301-2/+2
| | | | | | | | For received CTL mesh messages, the wrong network ID variable was passed to ctl_received. This patch changes to the correct variable. Also, changed type of net_key_id argument in ctl_received function to be consistent wich the whole call chain.
* mesh: Fix bug where bluetooth-meshd stops sendingJonas Maes2022-06-211-11/+8
| | | | | | | | | | | | | | | | | When there is a backlog of mesh packets to be sent, the packet sender Fix bug where bluetooth-meshd stops sending When there is a backlog of mesh packets to be sent, the packet sender incorrectly infers that the tx worker thread is already running and therefore needn't be invoked. As a result, the mesh daemon will sometimes stop broadcasting while there are still packets in the queue. It will not resume broadcasting. This patch will invoke the tx worker thread correctly in that case. The logic to send packets at least twice when the transmitter is idle was slightly modified accordingly, and should behave the same way as before.
* mesh: Fix keyring snprintf usage range checkingBrian Gix2022-06-141-28/+40
| | | | | | | snprintf performs it's own range checking and returns a negative value if string construction fails. Not checking the return value throws a warning at compile time on GCC 12 and later. This patch removes redundent range chacking and checks all snprintf return values.
* mesh: Fix issue with snprintf return value check and format-truncation errorMarcel Holtmann2022-06-101-2/+7
|