espressif / esp-aliyun

Aliyun Iotkit-embedded, support esp32 & esp8266.
340 stars 151 forks source link

配网时,域名解析失败 #194

Open a273097203 opened 4 years ago

a273097203 commented 4 years ago

----------------------------- 以下请删除 -----------------------------

提交问题时,请先仔细阅读该段提示信息!!

为了更高效的解决 issue 中提交的问题,请按照以下 issue 模板进行提交,请注意以下信息:

  1. 提交时请删除这段提示文字;
  2. 提交时删除以下由 // 开头的文字,并对此做详细补充,如没有特殊信息,可写

感谢配合。

----------------------------- 以上请删除 -----------------------------

1. 开发环境

2. 问题描述

目前遇到在某一网络下,使用esp-aliyun 进行配网时出现域名解析失败的问题, 现为了更好的描述问题,以及进行的对照测试,我做了以下定义: (使用esp demo 板 ,及测试均使用demo 工程) 域名解析失败的网络, => [网络A] 可以正常配网的网络, => [网络B] 还使用了手机热点, => [热点A] 还使用了对照路由器 => [路由A] [路由B] 使用了对照SDK/IDF => [esp-idf v3.2] [esp-idf v3.3] [esp-aliyun v2.0] [esp-aliyun master] [alios-things v3.01]

问题发现: 使用 [esp-idf v3.2] [esp-aliyun v2.0] [路由A] [网络A] 进行配网时 出现域名解析失败问题.

对照测试: 失败对照,失败问题相同,并且100% 出现

  1. [esp-idf v3.2] [esp-aliyun v2.0] [路由B] [网络A] -> 域名解析失败.

  2. [esp-idf v3.3] [esp-aliyun v2.0] [路由A] [网络A] -> 域名解析失败.

  3. [esp-idf v3.2] [esp-aliyun master] [路由A] [网络A] -> 域名解析失败.

  4. [esp-idf v3.3] [esp-aliyun master] [路由A] [网络A] -> 域名解析失败.

    成功对照

  5. [esp-idf v3.2] [esp-aliyun v2.0] [路由A] [网络B] -> 配网成功.

  6. [esp-idf v3.3] [esp-aliyun v2.0] [路由A] [网络B] -> 配网成功.

  7. [esp-idf v3.2] [esp-aliyun master] [路由A] [网络B] -> 配网成功.

  8. [esp-idf v3.3] [esp-aliyun master] [路由A] [网络B] -> 配网成功.

  9. [esp-idf v3.2] [esp-aliyun v2.0] [热点A] -> 配网成功.

  10. [esp-idf v3.3] [esp-aliyun v2.0] [热点A]-> 配网成功.

  11. [esp-idf v3.2] [esp-aliyun master] [热点A] -> 配网成功.

  12. [esp-idf v3.3] [esp-aliyun master] [热点A] -> 配网成功.

  13. [alios-things v3.01] [路由A] [网络A] -> 配网成功.

然后直接在 [网络A] 下 ping 域名 成功

2.1 复现步骤

  1. 下载 [esp-idf v3.2] [esp-aliyun v2.0]
  2. 使用examples\solutions\smart_light demo 工程 修改四元组,
  3. 烧录到esp32demo板
  4. 在 [网络A] 下进行配网
  5. 出现域名解析失败

2.2 复现问题的代码

// 如果需要提交复现问题的代码, 可通过 GIST 或通过附件的方式提交。

3. 调试 Logs

[20:40:04.481] [crt] awss_config_press(180): enable awss [20:40:04.502] [inf] zconfig_init(260): zconfig_init [20:40:04.502] [crt] aws_switch_channel(166): chan 1 [20:40:04.502] [crt] awss_save_apinfo(273): [1] ssid:360WiFi-DB91CC, mac:70af6adb91cc, chn:1, rssi:-86, adha:0 [20:40:04.542] [crt] awss_save_apinfo(273): [2] ssid:LYJ_24G, mac:60833485c074, chn:1, rssi:-36, adha:0 [20:40:04.542] FourTupleDownloadExit [20:40:04.575] [crt] awss_save_apinfo(273): [3] ssid:, mac:60833485c075, chn:1, rssi:-38, adha:0 [20:40:04.590] [crt] aws_switch_channel(166): chan 6 [20:40:04.719] [crt] awss_save_apinfo(273): [4] ssid:熊达, mac:14e6e44e7c82, chn:6, rssi:-85, adha:0 [20:40:04.756] [crt] awss_save_apinfo(273): [5] ssid:, mac:9c216a7e553c, chn:6, rssi:-91, adha:0 [20:40:04.777] [crt] aws_switch_channel(166): chan 11 [20:40:04.921] [crt] awss_save_apinfo(273): [6] ssid:801, mac:603a7cea113c, chn:11, rssi:-88, adha:0 [20:40:04.962] [crt] awss_save_apinfo(273): [7] ssid:, mac:a8154d484714, chn:11, rssi:-72, adha:0 [20:40:04.984] [crt] aws_switch_channel(166): chan 1 [20:40:05.145] [crt] awss_save_apinfo(273): [8] ssid:TP-LINK_8451, mac:b0958ea18451, chn:1, rssi:-99, adha:0 [20:40:05.145] [inf] zconfig_callback_channel_locked(118): channel lock @ 1 [20:40:05.239] [inf] zconfig_callback_over(136): zconfig done. ssid:LYJ_24G, mac:000000000000 [20:40:05.239]  [20:40:07.541] [inf] dm_client_open(37): CM Fd: 0 [20:40:07.541] [wrn] IOT_MQTT_Construct(467): Using default hostname: 'a1r4NH3efLf.iot-as-mqtt.cn-shanghai.aliyuncs.com' [20:40:07.712] [wrn] IOT_MQTT_Construct(474): Using default port: [443] [20:40:07.712] [wrn] IOT_MQTT_Construct(481): Using default client_id: a1r4NH3efLf.ZN01900001|timestamp=2524608000000,securemode=2,signmethod=hmacsha256,gw=0,ext=0,_v=sdk-c-3.0.1| [20:40:07.712] [wrn] IOT_MQTT_Construct(488): Using default username: ZN01900001&a1r4NH3efLf [20:40:07.712] [wrn] IOT_MQTT_Construct(496): Using default password: ** [20:40:07.712] [inf] iotx_mc_init(230): MQTT init success! [20:40:07.712] user_awss_status_event_handler.74: Awss Status 4109 [20:40:07.848] user_awss_status_event_handler.74: Awss Status 4110 [20:40:08.000] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:08.000] [inf] awss_notify_dev_info(209): send notify success [20:40:08.000] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:08.107] [inf] awss_notify_dev_info(209): send notify success [20:40:08.107] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:08.315] [inf] awss_notify_dev_info(209): send notify success [20:40:08.315] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:08.623] [inf] awss_notify_dev_info(209): send notify success [20:40:08.623] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:09.032] [inf] awss_notify_dev_info(209): send notify success [20:40:09.032]  [20:40:09.541] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:09.541] [inf] awss_notify_dev_info(209): send notify success [20:40:09.541]  [20:40:10.149] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:10.149] [inf] awss_notify_dev_info(209): send notify success [20:40:10.149]  [20:40:10.836] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:10.857] [inf] awss_notify_dev_info(209): send notify success [20:40:10.857]  [20:40:11.640] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:11.661] [inf] awss_notify_dev_info(209): send notify success [20:40:11.661]  [20:40:12.571] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:12.571] [inf] awss_notify_dev_info(209): send notify success [20:40:12.571]  [20:40:13.563] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:13.584] [inf] awss_notify_dev_info(209): send notify success [20:40:13.584] E (13437) esp-tls: couldn't get hostname for :a1r4NH3efLf.iot-as-mqtt.cn-shanghai.aliyuncs.com: [20:40:13.911] E (13437) esp-tls: Failed to open new connection [20:40:13.911] [err] wrapper_mqtt_connect(2702): TCP or TLS Connection failed [20:40:13.911]  [20:40:14.695] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:14.695] [inf] awss_notify_dev_info(209): send notify success [20:40:14.695]  [20:40:15.907] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:15.907] [inf] awss_notify_dev_info(209): send notify success [20:40:15.907]  [20:40:17.215] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:17.215] [inf] awss_notify_dev_info(209): send notify success [20:40:17.215]  [20:40:18.621] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:18.621] [inf] awss_notify_dev_info(209): send notify success [20:40:18.621]  [20:40:20.108] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:20.129] [inf] awss_notify_dev_info(209): send notify success [20:40:20.129]  [20:40:21.740] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:21.740] [inf] awss_notify_dev_info(209): send notify success [20:40:21.740] E (21437) esp-tls: couldn't get hostname for :a1r4NH3efLf.iot-as-mqtt.cn-shanghai.aliyuncs.com: [20:40:21.910] E (21437) esp-tls: Failed to open new connection [20:40:21.910] [err] wrapper_mqtt_connect(2702): TCP or TLS Connection failed [20:40:21.910]  [20:40:23.448] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:23.448] [inf] awss_notify_dev_info(209): send notify success [20:40:23.448]  [20:40:25.256] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:25.256] [inf] awss_notify_dev_info(209): send notify success [20:40:25.256]  [20:40:27.142] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:27.164] [inf] awss_notify_dev_info(209): send notify success [20:40:27.164]  [20:40:29.172] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:29.172] [inf] awss_notify_dev_info(209): send notify success [20:40:29.172]  [20:40:29.911] E (29437) esp-tls: couldn't get hostname for :a1r4NH3efLf.iot-as-mqtt.cn-shanghai.aliyuncs.com: [20:40:29.911] E (29437) esp-tls: Failed to open new connection [20:40:29.911] [err] wrapper_mqtt_connect(2702): TCP or TLS Connection failed [20:40:29.911]  [20:40:30.947] [inf] _mqtt_connect(778): connect params: MQTTVersion=4, clientID=a1r4NH3efLf.ZN01900001|timestamp=2524608000000,securemode=2,signmethod=hmacsha256,gw=0,ext=0,_v=sdk-c-3.0.1|, keepAliveInterval=30, username=ZN01900001&a1r4NH3efLf [20:40:30.947] E (30457) iot_import_tls: HAL_SSL_Write, handle == NULL [20:40:30.947] [err] MQTTConnect(460): send connect packet failed [20:40:30.947] [err] _mqtt_connect(786): send connect packet failed, rc = -14 [20:40:30.947] [err] IOT_MQTT_Construct(578): wrapper_mqtt_connect failed [20:40:30.947] [inf] iotx_mc_disconnect(2637): mqtt disconnect! [20:40:31.039] [inf] wrapper_mqtt_release(2782): mqtt release! [20:40:31.135] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:31.283] [inf] awss_notify_dev_info(209): send notify success [20:40:31.283] [err] _mqtt_connect(276): mqtt connect failed [20:40:31.650] [err] _iotx_linkkit_master_connect(959): DM Start Failed [20:40:31.650] linkkit_main.494: IOT_Linkkit_Connect failed! retry after 5000 ms [20:40:31.650]  [20:40:31.650] [20:40:33.472] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:33.493] [inf] awss_notify_dev_info(209): send notify success [20:40:33.493]  [20:40:35.780] [inf] awss_notify_dev_info(205): topic:/sys/awss/event/connectap/notify [20:40:35.802] [inf] awss_notify_dev_info(209): send notify success

配网失败log---1-2020-7-6.txt 配网失败---3-2020-7-6.txt 配网失败log-启明---1--2020-7-10.txt

4. 其他项

// 如果涉及到配网或其他兼容性问题,请提供具体手机型号、路由型号或其他信息。

配网手机 -> 华为 P10 plus 路由 -- > 华为 A1

ljy770 commented 4 years ago

请问下网络 A 和 网络 分别是什么样的网络?两者的区别?

a273097203 commented 4 years ago

请问下网络 A 和 网络 分别是什么样的网络?两者的区别?

你好,

目前发现的 [网络A] 为租房集体网络,有终端交换机分接到各个租房 , 对照的 [网络B] 为直接光纤到路由出来的公司WiFi网络,

其他并未发现别的区别.

ljy770 commented 4 years ago

@a273097203 请抓取一下域名解析时候的空气包,对比成功和不成功时候的 DNS 包。

a273097203 commented 4 years ago

@a273097203 请抓取一下域名解析时候的空气包,对比成功和不成功时候的 DNS 包。

附件为配网失败与配网成功的log 在同一时间段,由使用[网络A] 进行配网的失败log ,与使用[热点]进行配网的成功log 配网失败log---1-2020-7-6.txt 配网成功---2-2020-7-6.txt 配网失败---3-2020-7-6.txt

a273097203 commented 4 years ago

你好,

附件为配网失败与配网成功的log 在同一时间段,由使用[网络A] 进行配网的失败log ,与使用[热点]进行配网的成功log

东莞市智纳家具有限公司 Dongguan Zhi Na Furniture Co., Ltd. 林瑜杰 研发部 Mobile:+86 15820843060 E-Mail:RDD01@dgzhina.com 地址:东莞市厚街镇南环路新后街产业创新园H栋四楼H408A H408A, four H, new industrial park, New South Street, houhuan Town, Houjie Town, Dongguan

发件人: ljy770 发送时间: 2020-07-13 16:30 收件人: espressif/esp-aliyun 抄送: a273097203; Mention 主题: Re: [espressif/esp-aliyun] 配网时,域名解析失败 (#194) @a273097203 请抓取一下域名解析时候的空气包,看一下 DNS 是否回复。 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ljy770 commented 4 years ago

@a273097203 不是设备 log. 是需要 [Omnipeek 抓包软件]和[抓包器]设置[设备和路由器mac地址为 filter ]进行抓包,为了看到包的内容,也要设置路由器加密方式为 无。

a273097203 commented 4 years ago

@a273097203 不是设备 log. 是需要 [Omnipeek 抓包软件]和[抓包器]设置[设备和路由器mac地址为 filter ]进行抓包,为了看到包的内容,也要设置路由器加密方式为 无。

你好,非常抱歉,没有抓包设备可以进行相关的抓包,你看下是否还有别的方式或者提供一下详细的方法,谢谢

ljy770 commented 4 years ago

@a273097203 那只能打开LWIP里DNS的log, 在components/lwip/lwip/src/include/lwip/opt.h里将DNS_DEBUG置1,并且将components/lwip/port/esp32/include/lwipopts.h里LWIP_DEBUG也置1. 对比成功和不成功时候的设备 log.

yuanjianmin commented 4 years ago

@a273097203 我看抓包文件配网成功---2-2020-7-6.txt里,连接的WIFI是WIFI_T1_TEST,可以解析域名连上云,两个失败的配网失败log---1-2020-7-6.txt和配网失败---3-2020-7-6.txt,连接的WIFI是LYJ_24G,请确认下是不是该WIFI就是网络A,然后您说使用alios-things v3.01可以配网成功,能否提供相关log