So far our gopher client from section 18 is hard-wired to the host
IP address 192.80.49.99 (gopher.floodgap.com
) because
we can’t look up names to find other IP addresses.
DNS sockets were recently added to smoltcp but are not yet in a released version
00:53:40.493500 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:12:34:56 (oui Unknown), length 262
00:53:40.493585 IP 10.0.2.2.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length 548
00:53:40.554433 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:12:34:56 (oui Unknown), length 274
00:53:40.554502 IP 10.0.2.2.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length 548
00:53:40.670505 ARP, Request who-has 10.0.2.2 (Broadcast) tell 10.0.2.15, length 28
00:53:40.670571 ARP, Reply 10.0.2.2 is-at 52:55:0a:00:02:02 (oui Unknown), length 50
00:53:40.728456 IP 10.0.2.15.49152 > dns.google.domain: 49153+ A? www.google.com. (32)
00:53:40.746304 IP dns.google.domain > 10.0.2.15.49152: 49153 1/0/0 A 172.217.164.100 (48)
Some things have not been implemented but could/should be at some point:
- Non-ASCII domain names are not yet handled. These should be converted into Punycode before sending to the DNS server.
- Timeouts and connection failures: Currently we’ll just keep waiting forever, but there should be a mechanism to fall back to alternative DNS servers if one isn’t working.
Now that we can connect to other servers by using their hostname
rather than IP address, we can extend the gopher
program so
that it can follow links to other severs.
In figure fig-hngopher you can see a message from rtl8139
mixed in
with the gopher page. That’s because all processes are currently using
debug_println!
to write to screen. Before we develop any more
programs which output to screen we need to do something about this: we
need a way to separate outputs into workspaces/terminals/windows that
we can switch between. We’ll start doing this next, by moving the VGA
driver from kernel into userspace and extending what it can do in the
next section.