Merge branch 'bugfix/fix_the_for_smartconfig_send_broadcast_to_phone_v3.1' into 'release/v3.1'

fix the bugs in smartconfig_ack (backport v3.1)

See merge request espressif/esp-idf!6075
This commit is contained in:
Jiang Jiang Jian 2019-09-25 12:00:41 +08:00
commit 83458426ac
2 changed files with 4 additions and 3 deletions

View File

@ -42,7 +42,7 @@ typedef enum {
*
* @param status Status of SmartConfig:
* - SC_STATUS_GETTING_SSID_PSWD : pdata is a pointer of smartconfig_type_t, means config type.
* - SC_STATUS_LINK : pdata is a pointer of struct station_config.
* - SC_STATUS_LINK : pdata is a pointer to wifi_config_t.
* - SC_STATUS_LINK_OVER : pdata is a pointer of phone's IP address(4 bytes) if pdata unequal NULL.
* - otherwise : parameter void *pdata is NULL.
* @param pdata According to the different status have different values.

View File

@ -46,7 +46,8 @@ static void sc_ack_send_task(void *pvParameters)
{
sc_ack_t *ack = (sc_ack_t *)pvParameters;
tcpip_adapter_ip_info_t local_ip;
uint8_t *remote_ip = ack->ctx.ip;
uint8_t remote_ip[4];
memcpy(remote_ip, ack->ctx.ip, sizeof(remote_ip));
int remote_port = (ack->type == SC_ACK_TYPE_ESPTOUCH) ? SC_ACK_TOUCH_SERVER_PORT : SC_ACK_AIRKISS_SERVER_PORT;
struct sockaddr_in server_addr;
socklen_t sin_size = sizeof(server_addr);
@ -60,7 +61,7 @@ static void sc_ack_send_task(void *pvParameters)
bzero(&server_addr, sizeof(struct sockaddr_in));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr((const char*)remote_ip);
memcpy(&server_addr.sin_addr.s_addr, remote_ip, sizeof(remote_ip));
server_addr.sin_port = htons(remote_port);
esp_wifi_get_mac(WIFI_IF_STA, ack->ctx.mac);