Skip to content

Add initial layered IPv4 networking stack (Ethernet/ARP/IPv4/ICMP/UDP/DNS + ping/wget scaffolding)#49

Merged
pradosh-arduino merged 1 commit into
mainfrom
codex/implement-tcp/ip-networking-stack
Jul 5, 2026
Merged

Add initial layered IPv4 networking stack (Ethernet/ARP/IPv4/ICMP/UDP/DNS + ping/wget scaffolding)#49
pradosh-arduino merged 1 commit into
mainfrom
codex/implement-tcp/ip-networking-stack

Conversation

@pradosh-arduino

Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a small, maintainable Linux-like layered networking stack on top of the existing RTL8139 driver so upper layers never touch hardware registers.
  • Ship core link/network/transport primitives (Ethernet, ARP, IPv4, ICMP, UDP, DNS) and a simple application surface so the OS can ping and attempt HTTP downloads.
  • Keep the driver integration minimal and clear by exposing a netif_* boundary that hides rtl8139 details from protocol code.

Description

  • Add a public networking header and packet buffer abstraction via source/includes/net/net.h and net_packet_t to allow safe prepend/append/pull operations and headroom management.
  • Implement core modules: net_core.c (byte-order, checksum, packet buffer, netif_* wrapper), ethernet.c (Ethernet II parsing/construction and EtherType dispatch), and arp_ipv4_icmp_udp.c (ARP cache & resolution, IPv4 parsing/building/checksum, ICMP echo, UDP send/receive queues).
  • Add dns_tcp_http_dhcp.c with a UDP DNS resolver and an HTTP client that is wired to the networking API while TCP is provided as a scaffold (TCP state machine/retransmit/congestion features are noted as pending full wire-mode implementation); DHCP is a placeholder.
  • Integrate with shell by adding ping and wget commands, register them in the shell table, and initialize the stack during startup with QEMU user-network defaults via ipv4_init(...); document architecture and QEMU testing notes in source/kernel/C/net/README.md.

Testing

  • Ran make -C source which compiled the new networking C files and integrated objects into the build, but the final link failed due to pre-existing build environment issues where versions.sh could not generate versions/date symbols (xorriso missing), so the linker reported unrelated undefined references; all new networking objects compiled successfully before the link step.
  • The build run demonstrated that the new files are included in the build system and that netif_send/netif_poll are wired to the existing rtl8139_send_packet/rtl8139_receive_packet polling path as intended.
  • No further automated network runtime tests were executed in this environment; recommended runtime validation is described in the new README (example: QEMU with -netdev user,id=n0 -device rtl8139,netdev=n0 and ping 10.0.2.2 / wget http://...).

Codex Task

@pradosh-arduino pradosh-arduino merged commit 08fac2f into main Jul 5, 2026
2 checks passed
@pradosh-arduino pradosh-arduino deleted the codex/implement-tcp/ip-networking-stack branch July 5, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant