<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/c/nslookup.c, branch master</title>
<subtitle>gbos - a tiny Unix-flavored OS for the Game Boy Color (kernel, shell, coreutils in C, RAM filesystem)</subtitle>
<id>https://git.sl0p.foo/gbos.git/atom/c/nslookup.c?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/c/nslookup.c?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-07-17T22:38:38Z</updated>
<entry>
<title>refactor: c/ -&gt; usr/, compiled program blobs out of the source tree</title>
<updated>2026-07-17T22:38:38Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T22:38:38Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c'/>
<id>urn:sha1:ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>net: wget-by-hostname + shared DNS resolver (a Game Boy fetches example.com)</title>
<updated>2026-07-17T11:11:53Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T11:11:53Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=a565bcd942efeb617f5424ae5a881211a7bd0216'/>
<id>urn:sha1:a565bcd942efeb617f5424ae5a881211a7bd0216</id>
<content type='text'>
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 -&gt; TCP connect -&gt; "GET / HTTP/1.0" with the real
Host header -&gt; 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
    &lt;!doctype html&gt;&lt;html lang="en"&gt;&lt;head&gt;&lt;title&gt;Example Domain&lt;/title&gt;...
    &lt;/body&gt;&lt;/html&gt;
    [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")
</content>
</entry>
<entry>
<title>net: UDP sockets in the kernel + a DNS resolver (real hostname lookups)</title>
<updated>2026-07-17T10:54:43Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T10:54:43Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=26a2ccb8368a9968b6ec16068ad68dd0edb40641'/>
<id>urn:sha1:26a2ccb8368a9968b6ec16068ad68dd0edb40641</id>
<content type='text'>
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   -&gt;  example.com -&gt; 172.66.147.243

This gives us name resolution for the TCP/HTTP demo next.
</content>
</entry>
</feed>
