diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c index 56a906debf..6243de12ae 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c @@ -822,30 +822,6 @@ static void gatt_proxy_set(struct bt_mesh_model *model, bt_mesh_store_cfg(); } - if (cfg->gatt_proxy == BLE_MESH_GATT_PROXY_DISABLED) { - int i; - - /* Section 4.2.11.1: "When the GATT Proxy state is set to - * 0x00, the Node Identity state for all subnets shall be set - * to 0x00 and shall not be changed." - */ - for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) { - struct bt_mesh_subnet *sub = &bt_mesh.sub[i]; - - if (sub->net_idx != BLE_MESH_KEY_UNUSED) { - bt_mesh_proxy_identity_stop(sub); - } - } - - /* Section 4.2.11: "Upon transition from GATT Proxy state 0x01 - * to GATT Proxy state 0x00 the GATT Bearer Server shall - * disconnect all GATT Bearer Clients. - */ - bt_mesh_proxy_gatt_disconnect(); - } - - bt_mesh_adv_update(); - if (cfg->hb_pub.feat & BLE_MESH_FEAT_PROXY) { bt_mesh_heartbeat_send(); } @@ -2493,12 +2469,8 @@ static void node_identity_set(struct bt_mesh_model *model, } else { net_buf_simple_add_u8(&msg, STATUS_SUCCESS); net_buf_simple_add_le16(&msg, idx); - /* Section 4.2.11.1: "When the GATT Proxy state is set to - * 0x00, the Node Identity state for all subnets shall be set - * to 0x00 and shall not be changed." - */ - if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && - bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED) { + + if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) { if (node_id) { bt_mesh_proxy_identity_start(sub); } else { diff --git a/components/bt/esp_ble_mesh/mesh_core/net.c b/components/bt/esp_ble_mesh/mesh_core/net.c index 36308d9df9..10619903ad 100644 --- a/components/bt/esp_ble_mesh/mesh_core/net.c +++ b/components/bt/esp_ble_mesh/mesh_core/net.c @@ -1439,13 +1439,19 @@ void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi, /* Save the state so the buffer can later be relayed */ net_buf_simple_save(&buf, &state); + rx.local_match = (bt_mesh_fixed_group_match(rx.ctx.recv_dst) || + bt_mesh_elem_find(rx.ctx.recv_dst)); + if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && net_if == BLE_MESH_NET_IF_PROXY) { bt_mesh_proxy_addr_add(data, rx.ctx.addr); - } - rx.local_match = (bt_mesh_fixed_group_match(rx.ctx.recv_dst) || - bt_mesh_elem_find(rx.ctx.recv_dst)); + if (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_DISABLED && + !rx.local_match) { + BT_INFO("Proxy is disabled; ignoring message"); + return; + } + } /* The transport layer has indicated that it has rejected the message, * but would like to see it again if it is received in the future. diff --git a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c index 914b80f7c2..4305a3ebb2 100644 --- a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c +++ b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c @@ -1174,7 +1174,7 @@ static bool advertise_subnet(struct bt_mesh_subnet *sub) } return (sub->node_id == BLE_MESH_NODE_IDENTITY_RUNNING || - bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED); + bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_NOT_SUPPORTED); } static struct bt_mesh_subnet *next_sub(void) @@ -1252,11 +1252,7 @@ static s32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub) } if (sub->node_id == BLE_MESH_NODE_IDENTITY_STOPPED) { - if (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED) { - net_id_adv(sub); - } else { - return gatt_proxy_advertise(next_sub()); - } + net_id_adv(sub); } subnet_count = sub_count();