mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
dns: show the last lookup with the servers
The answer to a lookup arrives after the command has returned, so the console of the web interface never shows it. Plain "dns" now prints the name and the address, or whether it is still pending or failed.
This commit is contained in:
1 parent
67b8c718fb
commit
de0d413c0c
2 files changed
+17
-1
No files matched your search
@@ -200,6 +200,18 @@ void dns_show(void) __banked
|
|||||||
print_string(", from DHCP ");
|
print_string(", from DHCP ");
|
||||||
print_ip(dhcp_state.dns);
|
print_ip(dhcp_state.dns);
|
||||||
write_char('\n');
|
write_char('\n');
|
||||||
|
if (!dns_state.name[0])
|
||||||
|
return;
|
||||||
|
print_string("Last lookup ");
|
||||||
|
print_string_x(dns_state.name);
|
||||||
|
print_string(": ");
|
||||||
|
if (dns_state.status == DNS_DONE)
|
||||||
|
print_ip(dns_state.addr);
|
||||||
|
else if (dns_state.status == DNS_PENDING)
|
||||||
|
print_string("pending");
|
||||||
|
else
|
||||||
|
print_string("failed");
|
||||||
|
write_char('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -6,9 +6,13 @@ for anything else that is given a name instead of an address.
|
|||||||
```
|
```
|
||||||
dns server <ip> [<ip>] # one or two servers, 0.0.0.0 removes them
|
dns server <ip> [<ip>] # one or two servers, 0.0.0.0 removes them
|
||||||
dns lookup <name> # resolve a name and print the address
|
dns lookup <name> # resolve a name and print the address
|
||||||
dns # show the servers
|
dns # show the servers and the last lookup
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The answer to a lookup arrives after the command has returned, so it is
|
||||||
|
printed on the serial console and in the syslog. In the console of the web
|
||||||
|
interface, run `dns` afterwards to see it.
|
||||||
|
|
||||||
Without a configured server the resolver uses the one handed out by DHCP.
|
Without a configured server the resolver uses the one handed out by DHCP.
|
||||||
Only address records are looked up; a query goes to the servers in turn,
|
Only address records are looked up; a query goes to the servers in turn,
|
||||||
every two seconds, and gives up after six tries. A name that already is a
|
every two seconds, and gives up after six tries. A name that already is a
|
||||||
|
|||||||
Reference in new issue
Block a user