You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2017/11/09 08:26:50 UTC

[GitHub] michal-narajowski closed pull request #646: mesh: Fail init on keys generation error

michal-narajowski closed pull request #646: mesh: Fail init on keys generation error
URL: https://github.com/apache/mynewt-core/pull/646
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/net/nimble/host/mesh/src/mesh.c b/net/nimble/host/mesh/src/mesh.c
index c74fb1e9f..73ef2bb3f 100644
--- a/net/nimble/host/mesh/src/mesh.c
+++ b/net/nimble/host/mesh/src/mesh.c
@@ -173,7 +173,11 @@ bt_mesh_init(uint8_t own_addr_type, const struct bt_mesh_prov *prov,
     }
 
     if (MYNEWT_VAL(BLE_MESH_PROV)) {
-        bt_mesh_prov_init(prov);
+        err = bt_mesh_prov_init(prov);
+        if (err) {
+            return err;
+        }
+
     }
 
 #if (MYNEWT_VAL(BLE_MESH_PROXY))
diff --git a/net/nimble/host/mesh/src/prov.c b/net/nimble/host/mesh/src/prov.c
index 8b1dd8c36..fcad1386e 100644
--- a/net/nimble/host/mesh/src/prov.c
+++ b/net/nimble/host/mesh/src/prov.c
@@ -1502,8 +1502,9 @@ bool bt_prov_active(void)
 	return atomic_test_bit(link.flags, LINK_ACTIVE);
 }
 
-void bt_mesh_prov_init(const struct bt_mesh_prov *prov_info)
+int bt_mesh_prov_init(const struct bt_mesh_prov *prov_info)
 {
+	int err;
 	static struct bt_pub_key_cb pub_key_cb = {
 		.func = pub_key_ready,
 	};
@@ -1512,8 +1513,10 @@ void bt_mesh_prov_init(const struct bt_mesh_prov *prov_info)
 
 #endif
 
-	if (bt_pub_key_gen(&pub_key_cb)) {
-		BT_ERR("Failed to generate public key");
+	err = bt_pub_key_gen(&pub_key_cb);
+	if (err) {
+		BT_ERR("Failed to generate public key (%d)", err);
+		return err;
 	}
 
 	prov = prov_info;
@@ -1530,6 +1533,8 @@ void bt_mesh_prov_init(const struct bt_mesh_prov *prov_info)
 #endif
 
 #endif /* MYNEWT_VAL(BLE_MESH_PB_ADV) */
+
+	return 0;
 }
 
 void bt_mesh_prov_reset_link(void) {
diff --git a/net/nimble/host/mesh/src/prov.h b/net/nimble/host/mesh/src/prov.h
index 46ceaebd2..1ac4757a5 100644
--- a/net/nimble/host/mesh/src/prov.h
+++ b/net/nimble/host/mesh/src/prov.h
@@ -29,7 +29,7 @@ bt_mesh_pb_gatt_recv(uint16_t conn_handle, struct os_mbuf *buf);
 const u8_t *
 bt_mesh_prov_get_uuid(void);
 
-void
+int
 bt_mesh_prov_init(const struct bt_mesh_prov *prov);
 
 void


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services