Merge pull request #45 from Lawlieta/master
【修改】同步 netdev DNS 服务器设置功能改动
This commit is contained in:
commit
1445d72992
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue