aboutsummaryrefslogtreecommitdiffstats
path: root/usr/nslookup.c (unfollow)
Commit message (Collapse)AuthorFilesLines
4 daysrefactor: c/ -> usr/, compiled program blobs out of the source treeuser1-0/+0
Userland sources live in usr/ (fits the Unix theme better than 'c'). SDCC output .bin blobs land in build/usr/ with the other build artifacts instead of littering the source dir; programs.asm INCBINs them from there. Byte-identical ROM.
4 daysnet: wget-by-hostname + shared DNS resolver (a Game Boy fetches example.com)user1-74/+9
resolve.h: shared helper that turns a dotted-quad or a hostname into an IPv4 address (DNS A query over a UDP socket to 1.1.1.1). nslookup now uses it and slims down; wget uses it so you can name a host directly. wget HOST|IP now: resolve -> TCP connect -> "GET / HTTP/1.0" with the real Host header -> stream the body to the LCD/console until EOF. One command does DNS + TCP + HTTP, all on the kernel socket layer. Verified over tunbridge's NAT against the real internet: /# wget example.com connecting 172.66.147.243 HTTP/1.1 200 OK Server: cloudflare <!doctype html><html lang="en"><head><title>Example Domain</title>... </body></html> [eof] The full HTML page arrives across many TCP segments and is reassembled and printed - real DNS, real TCP, real HTTP, fetched by a Game Boy by name. (tunbridge.py already sets up + tears down the NAT, so the demo is a one-liner: sudo python3 tools/tunbridge.py "wget example.com")
4 daysnet: UDP sockets in the kernel + a DNS resolver (real hostname lookups)user1-0/+88
Adds UDP to the kernel socket layer on top of the ICMP core: - net_sum() (raw folded sum) split out of net_cksum() so a UDP pseudo-header (src/dst IP + proto + length) can seed the segment checksum. - udp_send: builds IP+UDP with the pseudo-header checksum; NET_BIND sets the local/source port; net_connect sets the peer. - udp_in: demuxes inbound UDP by destination port to the bound socket (net_find_udp), delivers the payload + source addr. Also fixes a real recv bug: net_pump clobbers BC/DE/HL, so the old recv timeout counted in registers and was effectively random. recv now counts in WRAM. New `nslookup HOST` (PROG_NSLOOKUP=28, bank 30): builds a DNS A query and parses the answer (with 0xC0 name-compression) entirely in userland over a UDP socket - the kernel never sees DNS, just UDP. Verified through the bridge NAT: /# nslookup example.com -> example.com -> 172.66.147.243 This gives us name resolution for the TCP/HTTP demo next.