summaryrefslogtreecommitdiff
path: root/Kernel/Net/UDPSocket.cpp
AgeCommit message (Collapse)Author
2020-04-18Kernel: Use shared locking mode in some placesSergey Bugaev
The notable piece of code that remains to be converted is Ext2FS.
2020-04-05Kernel: Add the SO_BINDTODEVICE socket optionAnotherTest
This patch adds a way for a socket to ask to be routed through a specific interface. Currently, this option only applies to sending, however, it should also apply to receiving...somehow :^)
2020-03-02Kernel: Use klog() instead of kprintf()Liav A
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-01-29Kernel: Make IPv4Socket::protocol_send() use a size_t for buffer sizeAndreas Kling
2020-01-26IPv4: Mark UDP sockets as connected immediately upon connect()Andreas Kling
This makes it possible to write() to a blocking UDPSocket. Previously this was not possible since can_write() depends on is_connected().
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-03Kernel: Add a more expressive API for getting random bytesAndreas Kling
We now have these API's in <Kernel/Random.h>: - get_fast_random_bytes(u8* buffer, size_t buffer_size) - get_good_random_bytes(u8* buffer, size_t buffer_size) - get_fast_random<T>() - get_good_random<T>() Internally they both use x86 RDRAND if available, otherwise they fall back to the same LCG we had in RandomDevice all along. The main purpose of this patch is to give kernel code a way to better express its needs for random data. Randomness is something that will require a lot more work, but this is hopefully a step in the right direction.
2019-09-30ByteBuffer: Remove pointer() in favor of data()Andreas Kling
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-19IPv4: Support overriding the default TTL (64)Andreas Kling
Made getsockopt() and setsockopt() virtual so we can handle them in the various Socket subclasses. The subclasses map kinda nicely to "levels". This will allow us to implement things like "traceroute", although.. I spent some time trying to do that, but then hit a wall when it turned out that the user-mode networking in QEMU doesn't preserve TTL in the ICMP packets passing through.
2019-08-29Kernel: Implement is_zero for RoutingDecisionConrad Pankoff
2019-08-29Kernel: Add simple ARP routing layerConrad Pankoff
This replaces the previous placeholder routing layer with a real one! It's still very primitive, doesn't deal with things like timeouts very well, and will probably need several more iterations to support more normal networking things. I haven't confirmed that this works with anything other than the QEMU user networking layer, but I suspect that's what nearly everybody is using at this point, so that's the important target to keep working.
2019-08-11Kernel: Move socket role tracking to the Socket class itselfSergey Bugaev
This is more logical and allows us to solve the problem of non-blocking TCP sockets getting stuck in SocketRole::None. The only complication is that a single LocalSocket may be shared between two file descriptions (on the connect and accept sides), and should have two different roles depending from which side you look at it. To deal with it, Socket::role() is made a virtual method that accepts a file description, and LocalSocket internally tracks which FileDescription is the which one and returns a correct role.
2019-08-09ProcFS: Expose UDP sockets in /proc/net/udpSergey Bugaev
2019-08-09Kernel: Merge FooSocketHandle classes into a single SocketHandle<Foo>Andreas Kling
- IPv4SocketHandle => SocketHandle<IPv4Socket> - TCPSocketHandle => SocketHandle<TCPSocket> - UDPSocketHandle => SocketHandle<UDPSocket>
2019-08-09Kernel: Use WeakPtr<NetworkAdapter> instead of NetworkAdapter* in net codeConrad Pankoff
2019-08-05IPv4: Remove an unnecessary copy of each outgoing IPv4 payloadAndreas Kling
There's no need for send_ipv4() to take a ByteBuffer&&, the data is immediately cooked into a packet and transmitted. Instead, just pass it the address+length of whatever buffer we've been using locally. The more we can reduce the pressure on kmalloc the better. :^)
2019-08-04IPv4: Use KBuffer instead of ByteBuffer for socket receive queuesAndreas Kling
This drastically reduces the pressure on the kernel heap when receiving data from IPv4 sockets.
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-22Kernel: Fix all compiler warnings.Andreas Kling
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-06-07Kernel: Run clang-format on everything.Andreas Kling
2019-05-04IPv4: Rename source/destination in socket classes to local/peer.Andreas Kling
It was way too ambiguous who's the source and who's the destination, and it didn't really follow a logical pattern. "Local port" vs "Peer port" is super obvious, so let's call it that.
2019-05-04IPv4: Save the source address/port together with incoming packet payloads.Andreas Kling
We need the address/port to fill in the out-params in recvfrom(). It should now be more or less possible to create a UDP server. :^)
2019-05-03IPv4: Implement bind() for TCP and UDP sockets.Andreas Kling
We can't accept connections just yet, but this patch makes it possible to bind() to a given source address/port.
2019-05-03Kernel: Prepare Socket for becoming a File.Andreas Kling
Make the Socket functions take a FileDescriptor& rather than a socket role throughout the code. Also change threads to block on a FileDescriptor, rather than either an fd index or a Socket.
2019-04-22Kernel: Make sure we don't use any FPU/MMX/SSE instructions.Andreas Kling
2019-04-08Kernel: Support non-blocking connect().Andreas Kling
If connect() is called on a non-blocking socket, it will "fail" immediately with -EINPROGRESS. After that, you select() on the socket and wait for it to become writable.
2019-04-03Kernel: Move devices into Kernel/Devices/.Andreas Kling
2019-04-02Kernel: Move networking related files into Kernel/Net/.Andreas Kling