InsaneMiner / xv6-net

xv6 OS with TCP/IP Network Stack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xv6-net

This project is implement TCP/IP Network Stack on xv6.

The network stack uses https://github.com/pandax381/microps

microps is a user-mode TCP/IP stack that I'm developing. This project ported it to the xv6 kernel.

demo

Features

  • Network device
    • PCI
      • Bus scan
      • Find device driver
    • Intel 8254x (e1000) driver
      • Initialization
      • Basic operation of RX/TX with DMA
      • Interrupt trap
      • Detect interrupt souce (if multiple NICs)
    • Device abstraction
      • Define structure for physical device abstraction (struct netdev)
      • Support multiple link protocols and physical devices
  • Protocols
    • Ethernet
    • ARP
    • IP
    • ICMP
    • UDP
    • TCP
  • Network Interface
    • Interface abstraction
      • Define structure for logical interface abstraction (struct netif)
      • Support multiple address family and logical interfaces
    • Configuration
      • ifconfig
  • Socket API
    • Systemcalls
      • socket
      • bind
      • connect
      • listen
      • accept
      • recv
      • send
      • recvfrom
      • sendto
    • Socket descriptor (compatible with File descriptor)
    • Socket address (struct sockaddr)

Task

  • ARP resolution waiting queue (Currently discards data)
  • TCP timer (Currently retransmission timer is not working)
  • DHCP client
  • DNS stub resolver

Tutorial

Build & Run

$ sudo make docker-build
$ sudo make docker-run

...(xv6-net starts on qemu in the container)...

$ ifconfig net1 172.16.100.2 netmask 255.255.255.0
$ ifconfig net1 up
$ tcpechoserver
Starting TCP Echo Server
socket: success, soc=3
bind: success, self=0.0.0.0:7
waiting for connection...

...(client connection information and received data are output)...

(switch to qemu monitor with Ctrl-a + c and exit by typing `quit`)

Ping Test (at another terminal)

$ sudo docker exec -it xv6-net ping 172.16.100.2

TCP Test (at another terminal)

$ sudo docker exec -it xv6-net nc 172.16.100.2 7

License

xv6: Under the MIT License. See LICENSE file.

Additional code: Under the MIT License. See header of each source code.

About

xv6 OS with TCP/IP Network Stack

License:Other


Languages

Language:C 87.7%Language:C++ 3.0%Language:Assembly 2.3%Language:Makefile 2.3%Language:Shell 1.4%Language:Perl 1.2%Language:Objective-C 0.8%Language:Ruby 0.6%Language:OpenEdge ABL 0.5%Language:Dockerfile 0.0%Language:Emacs Lisp 0.0%