Andreas Kling
649c81a714
Kernel: Move networking related files into Kernel/Net/.
2019-04-02 19:54:38 +02:00
Andreas Kling
718bea73b3
Kernel: Add a LoopbackAdapter for talking to yourself via 127.0.0.1.
...
Choosing adapter for transmit is done by adapter_for_route_to(IPv4Address).
This is just hard-coded logic right now but can be expanded to support a
proper routing table.
Also start moving kernel networking code into Kernel/Net/.
2019-04-02 15:46:44 +02:00
Andreas Kling
239c0bd6a6
Kernel: Make block() and yield() automatically call Scheduler::yield().
...
This exposed some places we were accidentally doing a double yield().
2019-03-24 01:52:10 +01:00
Andreas Kling
60d25f0f4a
Kernel: Introduce threads, and refactor everything in support of it.
...
The scheduler now operates on threads, rather than on processes.
Each process has a main thread, and can have any number of additional
threads. The process exits when the main thread exits.
This patch doesn't actually spawn any additional threads, it merely
does all the plumbing needed to make it possible. :^)
2019-03-23 22:03:17 +01:00
Andreas Kling
c24d4b07db
IPv4: Add simple pseudorandom ephemeral port allocators for TCP and UDP.
2019-03-18 04:03:44 +01:00
Andreas Kling
1c6dfc3282
AK: Make ByteBuffer's copy() and wrap() take void*.
...
This way we don't have to cast whatever we're passing to copy()/wrap().
2019-03-17 00:36:41 +01:00
Andreas Kling
f9569db1e5
TCP: Collect the payload if present in a packet with FIN set.
2019-03-14 15:28:23 +01:00
Andreas Kling
25e521f510
TCP: Start working on auto-closing connections when we get FIN.
2019-03-14 15:23:32 +01:00
Andreas Kling
edb986c276
IPv4: Factor out UDP parts of IPv4Socket into a UDPSocket class.
2019-03-14 12:43:18 +01:00
Andreas Kling
274b500bac
IPv4: Move more stuff from IPv4Socket to TCPSocket.
2019-03-14 12:28:30 +01:00
Andreas Kling
d2176eddfc
Kernel: Factor out TCP parts of IPv4Socket into a TCPSocket class.
2019-03-14 12:20:38 +01:00
Andreas Kling
54e7df0586
Kernel: Add SocketHandle helper class that wraps locked sockets.
...
This allows us to have a comfy IPv4Socket::from_tcp_port() API that returns
a socket that's locked and safe to access. No need to worry about locking
at the client site.
2019-03-14 09:19:24 +01:00
Andreas Kling
3d5296a901
IPv4: Last burst of TCP hacking for today.
...
Connecting to a test server and exchanging data back and forth works.
2019-03-14 01:44:42 +01:00
Andreas Kling
be46f1bb1f
IPv4: More work on the TCP implementation.
...
Reading from the peer now kinda works. Something still going wrong with
sending packets but it's getting closer.
2019-03-14 01:00:10 +01:00
Andreas Kling
66d55f8e0c
IPv4: More work on the TCP implementation.
...
I can now establish a connection to my little test server on the host.
2019-03-14 00:20:44 +01:00
Andreas Kling
032d9d7065
IPv4: More hacking on bringing up TCP support.
...
This was a bit more complicated than I expected, but it's moving forward.
2019-03-13 23:14:30 +01:00
Andreas Kling
c588653f76
IPv4: Begin fleshing out TCP support.
2019-03-13 17:17:07 +01:00
Andreas Kling
ef5d0a397c
IPv4: Do the TCP-to-socket mapping in the same way as UDP.
...
We don't actually have TCP support yet, but we'll get there soon. :^)
2019-03-13 16:43:42 +01:00
Andreas Kling
3ad9561b80
IPv4: Use the UDP-to-socket map to handle incoming UDP packets.
2019-03-13 16:23:22 +01:00
Andreas Kling
209a16bb7f
IPv4: Dynamically allocate the UDP source port if needed.
2019-03-13 16:05:56 +01:00
Andreas Kling
4dddf949c8
IPv4: More work on UDP support.
...
I'm now able to connect to a simple UDP server on my host machine and
exchange some data. Very cool! :^)
2019-03-13 15:40:30 +01:00
Andreas Kling
a9dc332a11
IPv4: recvfrom() shouldn't care about what's in the outparam on entry.
2019-03-13 15:00:28 +01:00
Andreas Kling
19a51132f5
Kernel: recvfrom() should treat the address arguments as outparams.
2019-03-13 14:47:21 +01:00
Andreas Kling
b59d588c04
Kernel: Start fleshing out an UDP implementation.
2019-03-13 14:22:27 +01:00
Andreas Kling
562663df7c
Add support for socket send/receive timeouts.
...
Only the receive timeout is hooked up yet. You can change the timeout by
calling setsockopt(..., SOL_SOCKET, SO_RCVTIMEO, ...).
Use this mechanism to make /bin/ping report timeouts.
2019-03-13 13:15:05 +01:00
Andreas Kling
cf250e1245
More work on IPv4 sockets and /bin/ping.
...
It's now actually possible to ping other hosts on the network! :^)
I've switched the "run" script over to starting QEMU with user networking
since that works better for my testing needs right now.
2019-03-13 03:26:01 +01:00
Andreas Kling
a7d5e9781a
Kernel+LibC+Userland: Yet more networking bringup hacking.
...
All ICMP sockets now receive all ICMP packets. All this buffering is gonna
need some limits and such.
2019-03-12 17:27:07 +01:00
Andreas Kling
a017a77442
Kernel+LibC+Userland: Start working on an IPv4 socket backend.
...
The first userland networking program will be "ping" :^)
2019-03-12 15:51:42 +01:00