diff --git a/apps/init/init.nim b/apps/init/init.nim index d274c17..797f55e 100644 --- a/apps/init/init.nim +++ b/apps/init/init.nim @@ -78,6 +78,32 @@ proc main() = print(cstring("[TEST] - ICMP Echo Request (10.0.2.15 -> 10.0.2.2)\n")) print(cstring("[TEST] - ICMP Echo Reply (10.0.2.2 -> 10.0.2.15)\n\n")) + # --- DNS RESOLUTION TEST --- + print(cstring("\n[TEST] ══════════════════════════════════════\n")) + print(cstring("[TEST] DNS Resolution Test\n")) + print(cstring("[TEST] Target: google.com\n")) + print(cstring("[TEST] ══════════════════════════════════════\n\n")) + + var dns_success = false + for attempt in 1..3: + print(cstring("[TEST] DNS Attempt... ")) + + if getaddrinfo("google.com", nil, nil, addr res) == 0: + print(cstring("SUCCESS!\n")) + dns_success = true + freeaddrinfo(res) + break + else: + print(cstring("FAILED. Retrying in 2s...\n")) + for j in 1..20: + pump_membrane_stack() + discard syscall(0x65, 100000000'u64) + + if dns_success: + print(cstring("[TEST] ✓ DNS: PASS\n\n")) + else: + print(cstring("[TEST] ✗ DNS: FAIL\n\n")) + # Spawn mksh as a separate fiber fibers (NOT execv - we stay alive as supervisor) proc spawn_fiber(path: cstring): int = # SYS_SPAWN_FIBER = 0x300