From 285bcc404f973e1270d443743791aaff12b289e5 Mon Sep 17 00:00:00 2001 From: chenyong <1521761801@qq.com> Date: Tue, 23 Apr 2019 15:16:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=20netdev=20DNS=20=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD=E6=94=B9=E5=8A=A8=20=E3=80=90?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E3=80=91esp8266=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenyong <1521761801@qq.com> --- at_socket_ec20.c | 4 ++-- at_socket_esp8266.c | 12 ++++-------- at_socket_m26.c | 4 ++-- at_socket_sim800c.c | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/at_socket_ec20.c b/at_socket_ec20.c index 22c8234..658673e 100644 --- a/at_socket_ec20.c +++ b/at_socket_ec20.c @@ -1483,7 +1483,7 @@ static int ec20_netdev_set_down(struct netdev *netdev) return RT_EOK; } -static int ec20_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_server) +static int ec20_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, ip_addr_t *dns_server) { #define EC20_DNS_RESP_LEN 8 #define EC20_DNS_RESP_TIMEO rt_tick_from_millisecond(300) @@ -1511,7 +1511,7 @@ static int ec20_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_serv goto __exit; } - netdev_low_level_set_dns_server(netdev, 0, dns_server); + netdev_low_level_set_dns_server(netdev, dns_num, dns_server); __exit: if (resp) diff --git a/at_socket_esp8266.c b/at_socket_esp8266.c index fd61686..48fd9ee 100644 --- a/at_socket_esp8266.c +++ b/at_socket_esp8266.c @@ -565,7 +565,6 @@ static void exp8266_get_netdev_info(struct rt_work *work, void *work_data) char dns_server1[AT_ADDR_LEN] = {0}, dns_server2[AT_ADDR_LEN] = {0}; const char *resp_expr = "%*[^\"]\"%[^\"]\""; const char *resp_dns = "+CIPDNS_CUR:%s"; - const char *resp_dhcp = "+CWDHCP_CUR:%d"; ip_addr_t sal_ip_addr; rt_uint32_t mac_addr[6] = {0}; rt_uint32_t num = 0; @@ -668,7 +667,7 @@ static void exp8266_get_netdev_info(struct rt_work *work, void *work_data) goto __exit; } - /* Bit0: SoftAP DHCP status, Bit1: Station DHCP status */ + /* Bit0 - SoftAP DHCP status, Bit1 - Station DHCP status */ if (dhcp_stat & 0x02) { netdev_low_level_set_dhcp_status(netdev, RT_TRUE); @@ -861,7 +860,7 @@ __exit: return result; } -static int esp8266_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_server) +static int esp8266_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, ip_addr_t *dns_server) { #define RESP_SIZE 128 at_response_t resp = RT_NULL; @@ -887,11 +886,10 @@ static int esp8266_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_s } else { - netdev_low_level_set_dns_server(netdev, 0, dns_server); + netdev_low_level_set_dns_server(netdev, dns_num, dns_server); LOG_D("esp8266 set dns server successfully."); } -__exit: if (resp) { at_delete_resp(resp); @@ -1024,8 +1022,7 @@ void esp8266_netdev_netstat(struct netdev *netdev) #define ESP8266_NETSTAT_EXPRESSION "+CIPSTATUS:%*d,\"%[^\"]\",\"%[^\"]\",%d,%d,%*d" at_response_t resp = RT_NULL; - rt_err_t result = RT_EOK; - int remote_ip, remote_port, local_port, i; + int remote_port, local_port, i; char *type = RT_NULL; char *ipaddr = RT_NULL; @@ -1050,7 +1047,6 @@ void esp8266_netdev_netstat(struct netdev *netdev) if (at_exec_cmd(resp, "AT+CIPSTATUS") < 0) { LOG_E("netstat: send commond AT+CIPSTATUS failed"); - result = -RT_ERROR; goto __exit; } diff --git a/at_socket_m26.c b/at_socket_m26.c index 5a419d5..7b02099 100644 --- a/at_socket_m26.c +++ b/at_socket_m26.c @@ -1044,7 +1044,7 @@ static int m26_netdev_set_down(struct netdev *netdev) return RT_EOK; } -static int m26_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_server) +static int m26_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, ip_addr_t *dns_server) { #define M26_DNS_RESP_LEN 8 #define M26_DNS_RESP_TIMEO rt_tick_from_millisecond(300) @@ -1071,7 +1071,7 @@ static int m26_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_serve goto __exit; } - netdev_low_level_set_dns_server(netdev, 0, dns_server); + netdev_low_level_set_dns_server(netdev, dns_num, dns_server); __exit: if (resp) diff --git a/at_socket_sim800c.c b/at_socket_sim800c.c index 613ab43..755f1a3 100644 --- a/at_socket_sim800c.c +++ b/at_socket_sim800c.c @@ -1066,7 +1066,7 @@ static int sim800c_netdev_set_down(struct netdev *netdev) return RT_EOK; } -static int sim800c_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_server) +static int sim800c_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, ip_addr_t *dns_server) { #define SIM800C_DNS_RESP_LEN 8 #define SIM800C_DNS_RESP_TIMEO rt_tick_from_millisecond(300) @@ -1094,7 +1094,7 @@ static int sim800c_netdev_set_dns_server(struct netdev *netdev, ip_addr_t *dns_s goto __exit; } - netdev_low_level_set_dns_server(netdev, 0, dns_server); + netdev_low_level_set_dns_server(netdev, dns_num, dns_server); __exit: if (resp)