summaryrefslogtreecommitdiff
path: root/Kernel/Net
AgeCommit message (Collapse)Author
2022-08-22Kernel: Use Process::credentials() and remove user ID/group ID helpersAnthony Iacono
Move away from using the group ID/user ID helpers in the process to allow for us to take advantage of the immutable credentials instead.
2022-08-21Kernel: Make sys$recvfrom() with MSG_DONTWAIT not so racyAndreas Kling
Instead of temporary changing the open file description's "blocking" flag while doing a non-waiting recvfrom, we instead plumb the currently wanted blocking behavior all the way through to the underlying socket.
2022-08-21Kernel: Make Socket::connect() take credentials as inputAndreas Kling
2022-08-21Kernel: Make Socket::bind() take credentials as inputAndreas Kling
2022-08-21Kernel: Make LocalSocket do chown/chmod through VFSAndreas Kling
This ensures that all the permissions checks are made against the provided credentials. Previously we were just calling through directly to the inode setters, which did no security checks!
2022-08-21Kernel: Make File::{chown,chmod} take credentials as inputAndreas Kling
...instead of getting them from Process::current(). :^)
2022-08-21Kernel: Make VirtualFileSystem functions take credentials as inputAndreas Kling
Instead of getting credentials from Process::current(), we now require that they be provided as input to the various VFS functions. This ensures that an atomic set of credentials is used throughout an entire VFS operation.
2022-08-21Kernel: Use credentials object in Socket set_origin/acceptorJames Bellamy
2022-08-21Kernel: Use credentials object in LocalSocket constructorJames Bellamy
2022-08-20Kernel: Make self-contained locking smart pointers their own classesAndreas Kling
Until now, our kernel has reimplemented a number of AK classes to provide automatic internal locking: - RefPtr - NonnullRefPtr - WeakPtr - Weakable This patch renames the Kernel classes so that they can coexist with the original AK classes: - RefPtr => LockRefPtr - NonnullRefPtr => NonnullLockRefPtr - WeakPtr => LockWeakPtr - Weakable => LockWeakable The goal here is to eventually get rid of the Lock* classes in favor of using external locking.
2022-08-20AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernelAndreas Kling
Instead of having two separate implementations of AK::RefCounted, one for userspace and one for kernelspace, there is now RefCounted and AtomicRefCounted.
2022-08-19Kernel: Annotate SpinlockProtected<PacketList> in NetworkAdapter classLiav A
2022-08-19Kernel: Require lock rank for Spinlock constructionkleines Filmröllchen
All users which relied on the default constructor use a None lock rank for now. This will make it easier to in the future remove LockRank and actually annotate the ranks by searching for None.
2022-08-19Kernel: Put too small unused network packets back into the listTim Schumacher
2022-08-19Kernel: Protect the list of unused network packets with a SpinlockTim Schumacher
2022-08-01Kernel: Silently discard `SO_REUSEADDR`Tim Schumacher
We were previously rejecting `SO_REUSEADDR` with an `ENOPROTOOPT`, but that made QEMU unhappy. Instead, just silently discard it and print a FIXME message in case anybody wonders what went wrong if the system won't reuse an address.
2022-07-21Kernel: Remove the Socket::{protocol,}connect ShouldBlock argumentIdan Horowitz
This argument is always set to description.is_blocking(), but description is also given as a separate argument, so there's no point to piping it through separately.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-07-12Kernel: Annotate all `KBuffer` and `DoubleBuffer` with a custom nameTim Schumacher
2022-07-10Kernel: Support sys$connect to LocalSockets with short sockaddr_unsIdan Horowitz
This is not explicitly specified by POSIX, but is supported by other *nixes, already supported by our sys$bind, and expected by various programs. While were here, also clean up the user memory copies a bit.
2022-07-10Kernel: Handle SHUT_RDWR in Socket::shutdownIdan Horowitz
We were previously assuming that the how value was a bitfield, but that is not the case, so we must explicitly check for SHUT_RDWR when deciding on the read and write shutdowns.
2022-07-09Kernel/Routing: Hide some leftover debugging under a debug flagMaciej
2022-07-09Kernel/Net: Support removing route entries with unknown gatewayMaciej
If you specify gateway as 0.0.0.0, the SIOCDELRT ioctl will remove all route entries that match all the other arguments.
2022-07-04Kernel: Negate condition in ARPTableBlockerSet::should_add_blockerIdan Horowitz
To prevent a race condition in case we received the ARP response in the window between creating and initializing the Thread Blocker and the actual blocking, we were checking if the IP address was updated in the ARP table just before starting to block. Unfortunately, the condition was partially flipped, which meant that if the table was updated with the IP address we would still end up blocking, at which point we would never end unblocking again, which would result in LookupServer locking up as well.
2022-06-05Kernel: Unify Kernel task names for consistencyBrian Gianforcaro
This change unifies the naming convention for kernel tasks. The goal of this change is to: - Make the task names more descriptive, so users can more easily understand their purpose in System Monitor. - Unify the naming convention so they are consistent.
2022-06-02Kernel: Implement InterruptDisabler using generic Processor functionsTimon Kruiper
Now that the code does not use architectural specific code, it is moved to the generic Arch directory and the paths are modified accordingly.
2022-05-31Kernel: Ignore interfaces without an IP address when updating ARPbrapru
For the same reason we ignore interfaces without an IP address when choosing where to send a route, we should also ignore interfaces without IP addresses when updating the ARP table on incoming packets from local addresses. On an interface with a null address, the mask checking would always result in zero, which resulted in the system updating the ARP table on almost every incoming packet from any address (private or public). This patch fixes this behavior by only applying this check to interfaces with valid addresses and now the ARP table won't get constantly hammered. Closes #13713
2022-05-26Kernel: Add support for route flagsbrapru
Previously the routing table did not store the route flags. This adds basic support and exposes them in the /proc directory so that a userspace caller can query the route and identify the type of each route.
2022-05-01Kernel: Stop exposing gateway fieldMaciej
It doesn't make sense after introduction of routing table which allows having multiple gateways for every interface, and isn't used by any of the userspace programs now.
2022-04-30Kernel+route: Support global routing table deletionbrapru
2022-04-30Kernel: Make Route's operator== overload constbrapru
2022-04-28Kernel: Add a global routing tablebrapru
Previously the system had no concept of assigning different routes for different destination addresses as the default gateway IP address was directly assigned to a network adapter. This default gateway was statically assigned and any update would remove the previously existing route. This patch is a beginning step towards implementing #180. It implements a simple global routing table that is referenced during the routing process. With this implementation it is now possible for a user or service (i.e. DHCP) to dynamically add routes to the table. The routing table will select the most specific route when possible. It will select any direct match between the destination and routing entry addresses. If the destination address overlaps between multiple entries, the Kernel will use the longest prefix match, or the longest number of matching bits between the destination address and the routing address. In the event that there is no entries found for a specific destination address, this implementation supports entries for a default route to be set for any specified interface. This is a small first step towards enhancing the system's routing capabilities. Future enhancements would include referencing a configuration file at boot to load pre-defined static routes.
2022-04-28Kernel: Generalize the UpdateArp table to UpdateTablebrapru
We can use the same enum cases to apply to updates on different networking tables within the Kernel (i.e. a routing table)
2022-04-21Kernel: Allow sys$bind() on local sockets with short socket addressAndreas Kling
Previously, we required local socket addresses to be exactly sizeof(sockaddr_un). There was no real reason for this, so let's not enforce it.
2022-04-21Kernel: Report AF_UNIX address family when accepting local socketsAndreas Kling
Previously we just wrote the local socket bind path into the sockaddr_un buffer. With this patch, we actually report the family as well.
2022-04-09Kernel: Move NNRP<Socket>s instead of copying in queue_connection_fromIdan Horowitz
2022-04-09Kernel: Accept NNRP<Socket> instead of RP<Socket> in release_for_acceptIdan Horowitz
This value is always non-null, so let's make it explicit.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-18Kernel: When receiving unexpected TCP flags, print the flagsAndreas Kling
It'll be easier to understand what might be happening if we know which unexpected flags are actually showing up. :^)
2022-03-18Kernel: Rename TCPFlags::PUSH => PSHAndreas Kling
Let's use the proper name of this TCP flag.
2022-03-17Kernel: Make number of RTL8168 rx/tx descriptors constexprLenny Maiorani
2022-03-17Kernel: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-14Kernel/PCI: Don't hold spinlocks when doing fast device enumerationLiav A
Instead, hold the lock while we copy the contents to a stack-based Vector then iterate on it without any locking. Because we rely on heap allocations, we need to propagate errors back in case of OOM condition, therefore, both PCI::enumerate API function and PCI::Access::add_host_controller_and_enumerate_attached_devices use now a ErrorOr<void> return value to propagate errors. OOM Error can only occur when enumerating the m_device_identifiers vector under a spinlock and trying to expand the temporary Vector which will be used locklessly to actually iterate over the PCI::DeviceIdentifiers objects.
2022-03-02Kernel/Net: Don't try to enumerate PCI adapters if PCI is disabledLiav A
2022-02-27Kernel: Add UDPSocket::try_for_each() for fallible iterationIdan Horowitz
This API will allow users to short circuit iteration and properly propagate errors.
2022-02-27Kernel: Add TCPSocket::try_for_each() for fallible iterationIdan Horowitz
This API will allow users to short circuit iteration and properly propagate errors.
2022-02-27Kernel: Add LocalSocket::try_for_each() for fallible iterationIdan Horowitz
This API will allow users to short circuit iteration and properly propagate errors.
2022-02-27Kernel: Add NetworkingManagement::try_for_each() for fallible iterationIdan Horowitz
This API will allow users to short circuit iteration and properly propagate errors.
2022-02-18Kernel: Lock socket Mutex when servicing IPv4Socket ioctlsIdan Horowitz
This prevents a kernel panic found in CI when m_receive_queue's size is queried and found to be non-zero, then a different thread clears the queue, and finally the first thread continues into the if block and calls the queue's first() method, which then fails an assertion that the queue's size is non-zero.