sortix-mirror/kernel
Jonas 'Sortie' Termansen 2ef6804ead Add networking stack.
This change adds all the kernel parts of a network stack. The network stack
is partial but implements many of the important parts.

Add if(4) network interface abstraction. Network interfaces are registered
in a global list that can be iterated and each assigned an unique integer
identifier.

Add reference counted packets with a cache that recycles recent packets.

Add support for lo(4) loopback and ether(4) ethernet network interfaces.
The /dev/lo0 loopback device is created automatically on boot.

Add arp(4) address resolution protocol driver for translation of inet(4)
network layer addresses into ether(4) link layer addresses. arp(4) entries
are cached and evicted from the cache when needed or when the entry has not
been used for a while. The cache is limited to 256 entries for now.

Add ip(4) internet protocol version 4 support. IP fragmentation and options
are not implemented yet.

Add tcp(4) transmission control protocol sockets for a reliable transport
layer protocol that provides a reliable byte stream connection between two
hosts. The implementation is incomplete and does not yet implement out of
band data, options, and high performance extensions.

Add udp(4) user datagram protocol sockets for a connectionless transport
layer that provides best-effort delivery of datagrams.

Add ping(4) sockets for a best-effort delivery of echo datagrams.

Change type of sa_family_t from unsigned short to uint16_t.

Add --disable-network-drivers to the kernel(7) options and expose it with a
bootloader menu. tix-iso-bootconfig can set this option by default.

Import CRC32 code from libz for the Ethernet checksum.

This is a compatible ABI change that adds features to socket(2) (AF_INET,
IPPROTO_TCP, IPPROTO_UDP, IPPROTO_PING), the ioctls for if(4), socket
options, and the lo0 loopback interface.

This commit is based on work by Meisaka Yukara contributed as the commit
bbf7f1e8a5238a2bd1fe8eb1d2cc5c9c2421e2c4. Almost no lines of this work
remains in this final commit as it has been rewritten or refactored away
over the years, see the individual file headers for which files contain
remnants of this work.

Co-authored-by: Meisaka Yukara <Meisaka.Yukara@gmail.com>
2022-12-11 13:40:34 +01:00
..
disk Rename CLOCK_BOOT to CLOCK_BOOTTIME. 2022-02-22 18:01:57 +00:00
fs Never deliver signals during stat(2), readlink(2), open(2), and truncate(2). 2022-04-26 00:50:54 +02:00
gpu/bga Switch bga(4) to the new PCI API. 2022-11-16 20:22:29 +01:00
include/sortix Add networking stack. 2022-12-11 13:40:34 +01:00
kb Include the main kernel header in some kernel files. 2022-04-26 01:08:42 +02:00
mouse Include the main kernel header in some kernel files. 2022-04-26 01:08:42 +02:00
net Add networking stack. 2022-12-11 13:40:34 +01:00
x64 Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
x86 Support i686 without SSE. 2022-01-09 23:38:16 +02:00
x86-family Rename CLOCK_BOOT to CLOCK_BOOTTIME. 2022-02-22 18:01:57 +00:00
.gitignore Allow bootloader bitmap framebuffer modesetting. 2016-01-08 19:56:11 +01:00
Makefile Add networking stack. 2022-12-11 13:40:34 +01:00
addralloc.cpp Fix kernel/addralloc.cpp file header comment. 2017-08-20 12:44:59 +02:00
alarm.cpp Fix handling of overflow and non-canonical values in timespec APIs. 2021-06-22 21:48:27 +02:00
clock.cpp Fix absolute timers triggering in the wrong order. 2022-12-03 22:43:33 +01:00
com.cpp Fix concurrent serial port read and write. 2016-11-03 22:10:45 +01:00
com.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
copy.cpp Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
crc32.cpp Add networking stack. 2022-12-11 13:40:34 +01:00
descriptor.cpp Add networking stack. 2022-12-11 13:40:34 +01:00
dnsconfig.cpp Add getdnsconfig(2) and setdnsconfig(2). 2021-06-13 23:27:52 +02:00
dtable.cpp Fix dtable allocation overflow on INT_MAX. 2022-06-09 22:47:06 +02:00
elf.cpp Optimize is_power_of_two. 2016-11-06 17:42:13 +01:00
end.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
fcache.cpp Fix SEEK_END, file offset overflow, and read/write/mkpartition syscall bugs. 2017-12-04 23:56:46 +01:00
fsfunc.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
hostname.cpp Fix sethostname(2) nul termination. 2022-10-23 14:42:10 +02:00
identity.cpp Fix setuid(2) and setgid(2) not setting the effective user and group. 2021-07-27 00:46:42 +02:00
initrd.cpp Add --append-to kernel(7) multiboot module option. 2018-12-08 22:54:28 +01:00
initrd.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
inode.cpp Fix chown(2) not supporting -1 to not set the owner and group. 2022-01-15 20:48:54 +01:00
interlock.cpp Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
interrupt.cpp Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
io.cpp Return EBADF on negative fds for dup2(2) and dup3(2). 2022-02-10 17:56:25 +00:00
ioctx.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
kernel.cpp Add networking stack. 2022-12-11 13:40:34 +01:00
kernelinfo.cpp Fix kernelinfo(2) user-space pointer deference. 2022-04-26 01:08:39 +02:00
kthread.cpp Fix deadlocks and lost wakeups in threading primitives. 2022-12-10 21:29:23 +01:00
lfbtextbuffer.cpp Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
lfbtextbuffer.h Fix LFBTextBuffer GetChar starting worker thread when paused. 2018-08-06 23:59:35 +02:00
libk.cpp Abort on overlapping memcpy. 2021-05-30 23:48:19 +02:00
linebuffer.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
linebuffer.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
log.cpp Add cache-aware memory mapping functions. 2017-02-19 12:13:32 +01:00
logterminal.cpp Implement Alt + key mapping to Esc followed by key in kernel tty 2021-05-05 00:19:56 +02:00
logterminal.h Add support for sessions. 2016-11-23 22:30:47 +01:00
memorymanagement.cpp Fix SEEK_END, file offset overflow, and read/write/mkpartition syscall bugs. 2017-12-04 23:56:46 +01:00
mtable.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
multiboot.h Upgrade to latest upstream multiboot header. 2014-12-01 22:51:07 +01:00
op-new.cpp Fix non-throwing operator new failure checks being optimized away. 2022-04-26 01:08:19 +02:00
palette.h Support 8-bit/24-bit color and more escape codes in the graphical console. 2016-11-27 11:19:03 +01:00
panic.cpp Fix technical typo. 2017-04-08 22:20:03 +02:00
partition.cpp Implement file descriptor passing. 2021-12-31 22:24:11 +01:00
partition.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
pci-mmio.cpp Add cache-aware memory mapping functions. 2017-02-19 12:13:32 +01:00
pci.cpp Add PCI scanning functions and busmastering functions. 2017-02-19 12:10:59 +01:00
pipe.cpp Implement file descriptor passing. 2021-12-31 22:24:11 +01:00
poll.cpp Fix kernel deadlock in ppoll(2). 2021-07-14 15:41:28 +02:00
process.cpp Make execve(2) require 1 <= argc. 2022-02-13 16:31:41 +00:00
psctl.cpp Fix psctl(2) not setting uid, euid, gid, and egid. 2021-02-11 20:47:49 +01:00
ptable.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
pty.cpp Fix pty write and read logic. 2022-12-03 22:36:34 +01:00
pty.h Add pseudo terminals. 2016-11-23 22:31:05 +01:00
random.cpp Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
refcount.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
registers.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
resource.cpp Add support for sessions. 2016-11-23 22:30:47 +01:00
scheduler.cpp Fix deadlocks and lost wakeups in threading primitives. 2022-12-10 21:29:23 +01:00
segment.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
signal.cpp Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
sockopt.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
string.cpp Include the main kernel header in some kernel files. 2022-04-26 01:08:42 +02:00
syscall.cpp Implement threading primitives that truly sleep. 2021-06-23 22:10:47 +02:00
textbuffer.cpp Fix operator spacing in kernel/textbuffer.cpp. 2017-04-18 23:32:00 +02:00
textterminal.cpp Fix saving and restoring console cursor position. 2017-01-22 22:28:58 +01:00
textterminal.h Support 8-bit/24-bit color and more escape codes in the graphical console. 2016-11-27 11:19:03 +01:00
thread.cpp Fix deadlocks and lost wakeups in threading primitives. 2022-12-10 21:29:23 +01:00
time.cpp Rename CLOCK_BOOT to CLOCK_BOOTTIME. 2022-02-22 18:01:57 +00:00
timer.cpp Fix handling of overflow and non-canonical values in timespec APIs. 2021-06-22 21:48:27 +02:00
tty.cpp Fix improper uses of ScopedLockSignal. 2021-02-11 20:47:47 +01:00
tty.h Add support for sessions. 2016-11-23 22:30:47 +01:00
uart.cpp Add debug uart utility functions. 2016-11-27 11:18:48 +01:00
uart.h Add debug uart utility functions. 2016-11-27 11:18:48 +01:00
user-timer.cpp Fix handling of overflow and non-canonical values in timespec APIs. 2021-06-22 21:48:27 +02:00
vga.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
vga.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
vgafont.f16 Allow bootloader bitmap framebuffer modesetting. 2016-01-08 19:56:11 +01:00
vgatextbuffer.cpp Support 8-bit/24-bit color and more escape codes in the graphical console. 2016-11-27 11:19:03 +01:00
vgatextbuffer.h Refactor graphical resolution changes. 2016-11-27 11:18:48 +01:00
video.cpp Refactor graphical resolution changes. 2016-11-27 11:18:48 +01:00
vnode.cpp Implement file descriptor passing. 2021-12-31 22:24:11 +01:00
worker.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00