ping with DNS name

This commit is contained in:
martin-ger
2018-12-22 21:06:57 +01:00
parent c1f51488b0
commit c2e0d99472
6 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ Most of the set-commands are effective only after save and reset.
- portmap add [TCP|UDP] _external_port_ _internal_ip_ _internal_port_: adds a port forwarding
- portmap remove [TCP|UDP] _external_port_: deletes a port forwarding
- nslookup _name_: starts a DNS lookup for the given name and displays the result
- ping _ip-addr_: checks IP connectivity with ICMP echo request/reply
- ping _host_: checks IP connectivity with ICMP echo request/reply (host as IP address or DNS name)
### Firewall/Monitor Config
- acl [from_sta|to_sta] [TCP|UDP|IP] _src-ip_ [_src_port_] _desr-ip_ [_dest_port_] [allow|deny|allow_monitor|deny_monitor]: adds a new rule to the ACL
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,3 +1,3 @@
89709d6484a66253d3159f2740da338337805e0f firmware/0x02000.bin
04fdebd28ce94542519c08a4f94bec262ff343c6 firmware/0x82000.bin
83db266f74801f2d9236314c6beccb0cd2c085c9 firmware/0x02000.bin
37cc650900e4df9fa368f84a2b49f8d0dc986e59 firmware/0x82000.bin
9bd7d25204d71b3db5f35e0b2def8a6aaa7f765c firmware/0x00000.bin
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _USER_CONFIG_
#define _USER_CONFIG_
#define ESP_REPEATER_VERSION "V2.2.3"
#define ESP_REPEATER_VERSION "V2.2.4"
#define LOCAL_ACCESS 0x01
#define REMOTE_ACCESS 0x02
+9 -5
View File
@@ -278,11 +278,11 @@ void ICACHE_FLASH_ATTR user_ping_sent(void *arg, void *pdata)
system_os_post(0, SIG_CONSOLE_TX, (ETSParam) currentconn);
}
void ICACHE_FLASH_ATTR user_do_ping(uint32_t ipaddr)
void ICACHE_FLASH_ATTR user_do_ping(const char *name, ip_addr_t *ipaddr, void *arg)
{
ping_opt.count = 4; // try to ping how many times
ping_opt.coarse_time = 2; // ping interval
ping_opt.ip = ipaddr;
ping_opt.ip = ipaddr->addr;
ping_success_count = 0;
ping_regist_recv(&ping_opt,user_ping_recv);
@@ -1654,7 +1654,6 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
os_sprintf(response, INVALID_NUMARGS);
goto command_handled;
}
to_console("\r\n");
uint32_t result = espconn_gethostbyname(NULL, tokens[1], &resolve_ip, dns_resolved);
if (result == ESPCONN_OK) {
os_sprintf(response, "DNS lookup for %s: " IPSTR "\r\n", tokens[1], IP2STR(&resolve_ip));
@@ -1682,9 +1681,14 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
os_sprintf(response, INVALID_NUMARGS);
goto command_handled;
}
to_console("\r\n");
currentconn = pespconn;
user_do_ping(ipaddr_addr(tokens[1]));
uint32_t result = espconn_gethostbyname(NULL, tokens[1], &resolve_ip, user_do_ping);
if (result == ESPCONN_OK) {
ip_addr_t ip;
ip.addr = ipaddr_addr(tokens[1]);
user_do_ping(tokens[1], &ip, NULL);
}
//user_do_ping(ipaddr_addr(tokens[1]));
return;
}
#endif