Remove DNS support.
This commit is contained in:
parent
74c5c70ea3
commit
2f50ebad61
@ -32,7 +32,6 @@ config_load_default(sysconfig_p config)
|
||||
config->client_watchdog = -1;
|
||||
|
||||
IP4_ADDR(&config->network_addr, 192, 168, 4, 1);
|
||||
config->dns_addr.addr = 0; // use DHCP
|
||||
config->my_addr.addr = 0; // use DHCP
|
||||
config->my_netmask.addr = 0; // use DHCP
|
||||
config->my_gw.addr = 0; // use DHCP
|
||||
|
||||
@ -44,7 +44,6 @@ typedef struct
|
||||
int32_t client_watchdog;
|
||||
|
||||
ip_addr_t network_addr; // Address of the internal network
|
||||
ip_addr_t dns_addr; // Optional: address of the dns server
|
||||
|
||||
ip_addr_t my_addr; // Optional (if not DHCP): IP address of the uplink side
|
||||
ip_addr_t my_netmask; // Optional (if not DHCP): IP netmask of the uplink side
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#include "os_type.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/lwip_napt.h"
|
||||
#include "lwip/app/dhcpserver.h"
|
||||
#include "lwip/app/espconn.h"
|
||||
@ -46,7 +45,6 @@ sysconfig_t config;
|
||||
static ringbuf_t console_rx_buffer, console_tx_buffer;
|
||||
|
||||
static ip_addr_t my_ip;
|
||||
static ip_addr_t dns_ip;
|
||||
bool connected;
|
||||
uint8_t my_channel;
|
||||
bool do_ip_config;
|
||||
@ -305,7 +303,7 @@ console_handle_command(struct espconn *pespconn)
|
||||
os_sprintf(response, "show [config|stats]\r\n");
|
||||
to_console(response);
|
||||
|
||||
os_sprintf(response, "set [ssid|password|auto_connect|ap_ssid] <val>\r\nset [sta_mac|sta_hostname] <val>\r\nset [dns|ip|netmask|gw] <val>\r\n");
|
||||
os_sprintf(response, "set [ssid|password|auto_connect|ap_ssid] <val>\r\nset [sta_mac|sta_hostname] <val>\r\nset [ip|netmask|gw] <val>\r\n");
|
||||
to_console(response);
|
||||
os_sprintf(response, "set [speed|status_led|config_port] <val>\r\nsave [config|dhcp]\r\nconnect | disconnect| reset [factory] | quit\r\n");
|
||||
to_console(response);
|
||||
@ -369,12 +367,6 @@ console_handle_command(struct espconn *pespconn)
|
||||
IP2STR(&config.network_addr));
|
||||
to_console(response);
|
||||
|
||||
// if static DNS, add it
|
||||
os_sprintf(response,
|
||||
config.dns_addr.addr?" DNS: %d.%d.%d.%d\r\n":"\r\n",
|
||||
IP2STR(&config.dns_addr));
|
||||
to_console(response);
|
||||
|
||||
// if static IP, add it
|
||||
os_sprintf(response,
|
||||
config.my_addr.addr?"Static IP: %d.%d.%d.%d Netmask: %d.%d.%d.%d Gateway: %d.%d.%d.%d\r\n":"",
|
||||
@ -757,27 +749,6 @@ console_handle_command(struct espconn *pespconn)
|
||||
goto command_handled;
|
||||
}
|
||||
|
||||
if (strcmp(tokens[1], "dns") == 0)
|
||||
{
|
||||
if (os_strcmp(tokens[2], "dhcp") == 0)
|
||||
{
|
||||
config.dns_addr.addr = 0;
|
||||
os_sprintf(response, "DNS from DHCP\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
config.dns_addr.addr = ipaddr_addr(tokens[2]);
|
||||
os_sprintf(response, "DNS set to %d.%d.%d.%d\r\n",
|
||||
IP2STR(&config.dns_addr));
|
||||
if (config.dns_addr.addr)
|
||||
{
|
||||
dns_ip.addr = config.dns_addr.addr;
|
||||
dhcps_set_DNS(&dns_ip);
|
||||
}
|
||||
}
|
||||
goto command_handled;
|
||||
}
|
||||
|
||||
if (strcmp(tokens[1], "ip") == 0)
|
||||
{
|
||||
if (os_strcmp(tokens[2], "dhcp") == 0)
|
||||
@ -1041,17 +1012,10 @@ wifi_handle_event_cb(System_Event_t *evt)
|
||||
|
||||
case EVENT_STAMODE_GOT_IP:
|
||||
{
|
||||
if (config.dns_addr.addr == 0)
|
||||
{
|
||||
dns_ip = dns_getserver(0);
|
||||
}
|
||||
dhcps_set_DNS(&dns_ip);
|
||||
|
||||
os_printf("ip:" IPSTR ",mask:" IPSTR ",gw:" IPSTR ",dns:" IPSTR "\n",
|
||||
os_printf("ip:" IPSTR ",mask:" IPSTR ",gw:" IPSTR "\n",
|
||||
IP2STR(&evt->event_info.got_ip.ip),
|
||||
IP2STR(&evt->event_info.got_ip.mask),
|
||||
IP2STR(&evt->event_info.got_ip.gw),
|
||||
IP2STR(&dns_ip));
|
||||
IP2STR(&evt->event_info.got_ip.gw));
|
||||
|
||||
my_ip = evt->event_info.got_ip.ip;
|
||||
connected = true;
|
||||
@ -1145,9 +1109,6 @@ user_set_softap_ip_config(void)
|
||||
|
||||
wifi_softap_dhcps_start();
|
||||
|
||||
// Change the DNS server again
|
||||
dhcps_set_DNS(&dns_ip);
|
||||
|
||||
// Enter any saved dhcp enties if they are in this network
|
||||
for (i = 0; i<config.dhcps_entries; i++)
|
||||
{
|
||||
@ -1230,18 +1191,6 @@ user_init()
|
||||
easygpio_outputSet (config.status_led, 0);
|
||||
}
|
||||
|
||||
// Configure the AP and start it, if required
|
||||
if (config.dns_addr.addr == 0)
|
||||
{
|
||||
// Google's DNS as default, as long as we havn't got one from DHCP
|
||||
IP4_ADDR(&dns_ip, 8, 8, 8, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have a static DNS server
|
||||
dns_ip.addr = config.dns_addr.addr;
|
||||
}
|
||||
|
||||
wifi_set_opmode(STATIONAP_MODE);
|
||||
wifi_set_macaddr(SOFTAP_IF, config.mac_list[config.current_mac_address]);
|
||||
user_set_softap_wifi_config();
|
||||
@ -1260,7 +1209,6 @@ user_init()
|
||||
info.gw.addr = config.my_gw.addr;
|
||||
info.netmask.addr = config.my_netmask.addr;
|
||||
wifi_set_ip_info(STATION_IF, &info);
|
||||
espconn_dns_setserver(0, &dns_ip);
|
||||
}
|
||||
|
||||
remote_console_disconnect = 0;
|
||||
|
||||
Reference in New Issue
Block a user